update scripts, add batAlarm and transsetter

This commit is contained in:
Iris Lightshard 2021-03-01 22:06:38 -05:00
parent f2ab754729
commit 3c181c194a
Signed by: Iris Lightshard
GPG key ID: 3B7FBC22144E6398
7 changed files with 129 additions and 12 deletions

View file

@ -5,12 +5,24 @@
## About ## 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 * kwin
* rox * konsole
* xfdesktop
* tint2 * tint2
* urxvt
* dunst * dunst
* xbindkeys
Ryudo:
* ryudo
* alacritty
* nitrogen
* xosview
* xclock
* dunst
* xbindkeys
### extdisplay ### extdisplay
@ -18,16 +30,36 @@ Wrapper script around xrandr to handle a second monitor on a laptop.
### nmtuiWin ### 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 ### 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>`. * __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 ## License

34
batAlarm.sh Executable file
View file

@ -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

View file

@ -8,7 +8,7 @@
# if we're feeling spartan, just print a simple string for the executor # if we're feeling spartan, just print a simple string for the executor
if [ -z $1 ]; then if [ -z $1 ]; then
echo "" echo ""
# if we pass '-x', spit a few hexadecimal bytes into the executor for eye-candy # if we pass '-x', spit a few hexadecimal bytes into the executor for eye-candy
elif [ "$1" = "-x" ]; then elif [ "$1" = "-x" ]; then

View file

@ -29,7 +29,11 @@ handler() {
zzz zzz
;; ;;
logout) 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) hibernate)
ZZZ ZZZ

View file

@ -15,7 +15,6 @@ acpi_listen | {
if [ ! -z "$(acpi -a | grep off-line)" ]; then if [ ! -z "$(acpi -a | grep off-line)" ]; then
if [ "${event}" = "button/lid LID close" ]; then if [ "${event}" = "button/lid LID close" ]; then
slock & sleep 1
zzz zzz
fi fi
fi fi

View file

@ -21,7 +21,7 @@ while true; do
output=offline output=offline
fi fi
echo -n "${output} " echo -n "${output} "
# battery # battery

48
transsetter.sh Executable file
View file

@ -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