added desks, sleepy; update copyleft notice

This commit is contained in:
Iris Lightshard 2020-09-29 23:58:30 -04:00
parent 51f0252b25
commit 2d8eff2298
Signed by: Iris Lightshard
GPG key ID: 3B7FBC22144E6398
5 changed files with 76 additions and 14 deletions

34
desks.sh Executable file
View file

@ -0,0 +1,34 @@
#!/bin/sh
# this is a simple script to both give some semblance of eye-candy for a tint2 executor
# and to switch virtual desktops programmatically, to be invoked by button click/scroll
# on said executor.
# copyleft 2020 Derek Stevens <drkste@zoho.com>
# MIT License - do whatever you want
if [ -z $1 ]; then
od -vAn -N2 -x < /dev/urandom
else
currentDeskNum=$(wmctrl -d | grep -n [*] | awk '{print $1}' | awk -F : '{print $1}')
numDesks=$(wmctrl -d | wc -l)
case $1 in
"-n")
if [ ${currentDeskNum} -eq ${numDesks} ]; then
newDesk=$(wmctrl -d | head -n 1 | awk '{print $1}')
else
newDesk=$(wmctrl -d | head -n $((currentDeskNum + 1)) | tail -n 1 | awk '{print $1}')
fi
;;
"-p")
if [ ${currentDeskNum} -eq 1 ]; then
newDesk=$(wmctrl -d | tail -n 1 | awk '{print $1}')
else
newDesk=$(wmctrl -d | head -n $((currentDeskNum - 1)) | tail -n 1 | awk '{print $1}')
fi
;;
esac
wmctrl -s ${newDesk}
fi

View file

@ -2,7 +2,7 @@
# extdisplay:
# this is a wrapper around xrandr to handle one external monitor on a laptop
# (c) 2020 Derek Stevens <drkste@zoho.com>
# copyleft 2020 Derek Stevens <drkste@zoho.com>
# MIT License -- do whatever you want
helpme()

View file

@ -7,5 +7,7 @@
# MIT License -- do whatever you want
if [ $(pgrep nmtui) -gt 0 ]; then
exec urxvt -geometry 80x30 +sb --depth 24 --background black --color4 black --color7 grey20 --color1 seagreen --color0 grey50 -e nmtui &
exec urxvtc -geometry 80x30 +sb --depth 24 --background black --color4 black --color7 grey20 --color1 seagreen --color0 grey50 -e nmtui &
else
killall nmtui
fi

23
sleepy.sh Executable file
View file

@ -0,0 +1,23 @@
#!/bin/sh
# this is a simple replacmeent for an ACPI handler script
# put it somewhere accessible for single-user mode and make a runit script for it
# copyleft 2020 Derek Stevens <drkste@zoho.com>
# MIT License -- do whatever you want
acpi_listen | {
while read event; do
# if no external monitor
# if [ ! -z "$(xrandr | grep HDMI | grep disconnected)" ]; then
# if AC is offline
if [ ! -z "$(acpi -a | grep off-line)" ]; then
if [ "${event}" = "button/lid LID close" ]; then
zzz
fi
fi
# fi
done
}

View file

@ -2,7 +2,7 @@
# t2stats:
# this is a simple network/battery status indicator to be used with tint2
# (c) 2020 Derek Stevens <drkste@zoho.com>
# copyleft 2020 Derek Stevens <drkste@zoho.com>
# MIT License -- do whatever you want
while true; do
@ -26,39 +26,42 @@ while true; do
powerlevel=$(cat /sys/class/power_supply/BAT*/capacity)
case $powerlevel in
0)
meter="[ ]"
;;
1|2|3|4|5|6|7|8|9)
meter="[| ]"
meter="[| ]"
;;
10|11|12|13|14|15|16|17|18|19)
meter="[|| ]"
meter="[| ]"
;;
20|21|22|23|24|25|26|27|28|29)
meter="[||| ]"
meter="[|| ]"
;;
30|31|32|33|34|35|36|37|38|39)
meter="[|||| ]"
meter="[|| ]"
;;
40|41|42|43|44|45|46|47|48|49)
meter="[||||| ]"
meter="[||| ]"
;;
50|51|52|53|54|55|56|57|58|59)
meter="[|||||| ]"
meter="[||| ]"
;;
60|61|62|63|64|65|66|67|68|69)
meter="[||||||| ]"
meter="[|||| ]"
;;
70|71|72|73|74|75|76|77|78|79)
meter="[|||||||| ]"
meter="[|||| ]"
;;
80|81|82|83|84|85|86|87|88|89)
meter="[||||||||| ]"
meter="[|||||]"
;;
*)
meter="[||||||||||]"
meter="[|||||]"
;;
esac
echo "${meter}"
sleep 10
done
done