all repos — zenUtils @ 3c181c194ad82c1afddd0dd32ae5aa3e5e41d840

misc utilities for computing zen

update scripts, add batAlarm and transsetter
Iris Lightshard nilix@nilfm.cc
PGP Signature
-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEEkFh6dA+k/6CXFXU4O3+8IhROY5gFAmA9q74ACgkQO3+8IhRO
Y5ircg/+PHx3CcVXuyItMkOlF00Sr/m7/H7iB0QaEyJNomnHio6ue5/nCOcml15O
7QG0QV9YnHNc6Z0KYMH/jzB9n24lSbn3Mt6QSRePmNS07Apn5t0o52Pr3vSj7cZd
ELMXil33PfyhaCTTnKlpN72edb9jTpHdX5Rur4YOU5VxOwYdCjHEBv4xy5vrkkrs
MapG5t2dm1GcLmuVFXt6WbxqnSZSNqj+vqNZOOUE0PYR9aVHbuBwCIKLwjm+nT+x
MsyvQMfEh5x7J1geYE1rhDH/FP2Urqa2fxK1oe0dCxzQDhBOkIE2b7MRXPP+Ai5n
FPOoRYNTGiMJ7NAwK0GbKOq5LVZeaI3vgff19HYoFiIuDec0Zy8fjxybm+bls53O
CoZmwNVRJvS3LN2Uh8O5rDidngYefkidg4CvOGHfP4tLK+rnfqQx4JRmgc7CJPUu
KvY3QasqxDrcGCzHQLbYpIKVdNtTvqZNEK/WVsMFXl0nwLqdBErFzrFNxbQJRUY4
E3UCEBu4FOgI7IXyRD/TSgBqXFYVfBbFsOy0P3G7fznq4ilFU6pF2SVHQtw8YG3P
CiFfBHrSPuWLOIZU7P+UykOuDRHoe6MVqfL+g9cHuv7dNO05rVU+NJ/aAq9zwWsH
s3Dt/FTtTS0uLya7YEGuHJAPc7bvRF1GVIZJf7tDESEx94Cv/f4=
=yj3r
-----END PGP SIGNATURE-----
commit

3c181c194ad82c1afddd0dd32ae5aa3e5e41d840

parent

f2ab754729dab2a4328954ef8348c1526b871e99

7 files changed, 129 insertions(+), 12 deletions(-)

jump to
M README.mdREADME.md

@@ -5,12 +5,24 @@ #### Derek Stevens <drkste@zoho.com>

## About -This is a simple collection of helper scripts to round out an experimental desktop environment: +This is a simple collection of helper scripts to round out my two common desktop sessions: + +Kwin Standalone: * kwin -* rox +* konsole +* xfdesktop * tint2 -* urxvt * dunst +* xbindkeys + +Ryudo: +* ryudo +* alacritty +* nitrogen +* xosview +* xclock +* dunst +* xbindkeys ### extdisplay

@@ -18,17 +30,37 @@ Wrapper script around xrandr to handle a second monitor on a laptop.

### nmtuiWin -Wrapper script around nmtui to aid in network configuration in the absence of nm-applet. +Wrapper script around `nmtui` to aid in network configuration in the absence of nm-applet. An alacritty config file hardcodes the colors for hte ncurses interface. ### t2stats -Status script to run in an Executor of tint2 which gives network and battery status. +Status script to run in an Executor of `tint2` which gives network and battery status. * __network__ is given as any of `offline`, `wired`, or `wifi/<network SSID>`. -* __battery__ is given as a progress/HP bar like so `[|||||| ]` where each pipe character (`|`) represents approximately 10% of charge. +* __battery__ is given as a progress/HP bar like so ` ` where each pipe character (``) represents approximately 20% of charge. -Battery alert notifications are handled by tint2 natively, even when the native battery applet is hidden, so that functionality is not present in the script. Network connection/disconnection notifications are planned. +Battery alert notifications are handled by `tint2` natively, even when the native battery applet is hidden, so that functionality is not present in the script. Network connection/disconnection notifications are planned. + +### desks + +Helper script to run in an Executor of `tint2` which allows scrolling of desktops on the executor. + +### logout + +Dmenu script to provide session/power management menu. + +## batAlarm + +Simple script to tell you when your battery's running out when you don't have a panel. + +### sleepy + +Lightweight ACPI handler to put a laptop to sleep when you close the lid and it's not plugged in. + +### transsetter + +Background script to apply translucency to terminal and editor windows with `transset`, `xshove`, and `xcompmgr` ## License -This collection is released permissively under the MIT License. You can do whatever you want with it.+This collection is released permissively under the MIT License. You can do whatever you want with it.
A batAlarm.sh

@@ -0,0 +1,34 @@

+#!/bin/sh + +# Just a background script to tell you when your battery's low if you don't +# have a panel. +# Lisenced under the MIT license -- do what you want +# Copyleft 2021 Derek Stevens <drkste@zoho.com> + +flag1=0 +flag2=0 + +while true; do + charge=$(cat /sys/class/power_supply/BAT0/capacity) + if [ $charge -lt 11 ]; then + if [ $flag1 -eq 0 ]; then + flag1=1 + notify-send -t 10000 BATTERY ${charge}% + fi + elif [ $charge -lt 21 ]; then + if [ $flag2 -eq 0 ]; then + flag2=1 + notify-send -t 10000 BATTERY ${charge}% + fi + fi + + if [ $charge -gt 20 ]; then + flag2=0 + fi + if [ $charge -gt 10 ]; then + flag1=0 + fi + + sleep 30 +done +
M desks.shdesks.sh

@@ -8,7 +8,7 @@ # MIT License - do whatever you want

# if we're feeling spartan, just print a simple string for the executor if [ -z $1 ]; then - echo "缾" + echo "" # if we pass '-x', spit a few hexadecimal bytes into the executor for eye-candy elif [ "$1" = "-x" ]; then
M logout.shlogout.sh

@@ -29,7 +29,11 @@ suspend)

zzz ;; logout) - pkill -9 -P $(pgrep .kwin-session) + if pgrep kwin; then + pkill -9 -P $(pgrep .kwin-session) + elif pgrep ryudo; then + kill $(pgrep ryudo) + else killall Xorg; fi ;; hibernate) ZZZ
M sleepy.shsleepy.sh

@@ -15,7 +15,6 @@ # if AC is offline

if [ ! -z "$(acpi -a | grep off-line)" ]; then if [ "${event}" = "button/lid LID close" ]; then - slock & sleep 1 zzz fi fi
M t2stats.sht2stats.sh

@@ -21,7 +21,7 @@ else

output=offline fi - echo -n "${output} " + echo -n "${output} " # battery
A transsetter.sh

@@ -0,0 +1,48 @@

+#!/bin/sh + +# A background script to provide terminal/editor compositing in a Ryudo +# session. +# Licensed under the MIT License -- do what you want with it. +# Copyleft 2021 Derek Stevens <drkste@zoho.com> + +termprog=Alacritty +geditor=kate +opacity=0.85 + +setter=$(which transset) +if [ -z "$setter" ]; then + setter=$(which transset-df) +fi + +if [ -z "$setter" ]; then + echo "we need transset or transset-df in PATH!" + exit 1 +fi + +if which xcompmgr > /dev/null; then + xcompmgr -n& +else + ehco "we need xcompmgr in PATH!" + exit 1 +fi + +if ! which xshove > /dev/null; then + echo "we need xshove in PATH!" + exit 1 +fi + +wlist=$(mktemp) + +while true; do + xshove > $wlist + while read wprop; do + wid=$(echo ${wprop} | awk '{print $1}') + wclass=$(echo ${wprop} | awk '{print $3}') + if [ "$wclass" = "${geditor}" ]; then + $setter -i 0x$wid ${opacity} > /dev/null + elif [ "${wclass}" = "${termprog}" ]; then + $setter -i 0x$wid ${opacity} > /dev/null + fi + done < $wlist + sleep 0.2 +done