update zenUtils

This commit is contained in:
Iris Lightshard 2022-01-13 21:57:24 -07:00
parent 72ef08cc8c
commit fa5f28ca3f
Signed by: Iris Lightshard
GPG key ID: 3B7FBC22144E6398
7 changed files with 209 additions and 2 deletions

View file

@ -38,6 +38,22 @@ Generate a timesheet for a given month by manipulating the output from `zeit`
Shell script to loosley emulate `rio` behavior in a EWMH-compliant WM Shell script to loosley emulate `rio` behavior in a EWMH-compliant WM
### desks
shell script to facilitate desktop switching via a tint2 executor
### xtraKeys
common keybinding operations with notifications
### t2stats
tint2 system load/memory, battery, and network info
### dynaclock
displays either regular or arvelie clock in a tint2 executor, with an action to switch them as well
## License ## License
This collection is released permissively under the MIT License. You can do whatever you want with it, as long as you leave my name on it. This collection is released permissively under the MIT License. You can do whatever you want with it, as long as you leave my name on it.

40
desks.sh Executable file
View file

@ -0,0 +1,40 @@
#!/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 we're feeling spartan, just print a simple string for the executor
if [ -z $1 ]; then
echo ""
# if we pass '-x', spit a few hexadecimal bytes into the executor for eye-candy
elif [ "$1" = "-x" ]; then
od -vAn -N2 -x < /dev/urandom
# otherwise switch desks
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

25
dynacal.sh Executable file
View file

@ -0,0 +1,25 @@
#!/bin/sh
if [ "$1" = "-t" ]; then
current=$(cat ~/.time_mode)
case ${current} in
"common")
echo "regular" > ~/.time_mode
;;
*)
echo "common" > ~/.time_mode
;;
esac
fi
if [ -z "$1" ]; then
mode=$(cat ~/.time_mode)
case ${mode} in
"regular")
echo "[$(~/bin/arvelie) $(~/bin/neralie -s)]"
;;
*)
echo "[$(date +"%F %H:%M")]"
;;
esac
fi

View file

@ -7,9 +7,10 @@
helpme() helpme()
{ {
echo "$0, wrapper for using xrandr to handle an external on a laptop" echo "$0, wrapper for using xrandr to handle an external display on a laptop"
echo "" echo ""
echo "USAGE: $0 solo|off|left-of|right-of|above|below [res]" echo "USAGE: $0 solo|off|left-of|right-of|above|below [res]"
echo " status\n prints connected/disconnected depending on if there is a monitor plugged in"
echo " solo\n activates the plugged monitor, deactivates the native display" echo " solo\n activates the plugged monitor, deactivates the native display"
echo " off\n activates the native display, deactivates the plugged monitor" echo " off\n activates the native display, deactivates the plugged monitor"
echo " left-of, right-of, above, below\n activates the plugged monitor in the given" echo " left-of, right-of, above, below\n activates the plugged monitor in the given"
@ -38,6 +39,13 @@ elif [ "$1" = off ]; then
xrandr --output ${plugged} --off xrandr --output ${plugged} --off
xrandr --output ${native} --auto xrandr --output ${native} --auto
elif [ "$1" = status ]; then
if [ -z "$(xrandr | grep connected | grep -v disconnected | grep -v LVDS)" ]; then
echo "disconnected"
else
echo "connected"
fi
else else
case $1 in case $1 in
right-of|left-of|above|below) right-of|left-of|above|below)

View file

@ -34,7 +34,7 @@ handler() {
elif pgrep ryudo; then elif pgrep ryudo; then
killall ryudo killall ryudo
else else
killall -0 Xorg killall fluxbox
fi fi
;; ;;
hibernate) hibernate)

79
t2stats.sh Executable file
View file

@ -0,0 +1,79 @@
#!/bin/sh
# t2stats:
# this is a simple network/battery status indicator to be used with tint2
# copyleft 2020 Derek Stevens <drkste@zoho.com>
# MIT License -- do whatever you want
if [ "$1" = "-l" ]; then
load=$(cat /proc/loadavg | awk '{print $1}')
memdata=$(free -h --si | grep Mem)
swapdata=$(free -h --si | grep Swap)
memused=$(echo ${memdata} | awk '{print $3}' )
swapused=$(echo ${swapdata} | awk '{print $3}')
echo " ${load} | ${memused} | ${swapused}"
fi
if [ "$1" = "-r" ]; then
# network
actives=$(nmcli connection show --active)
possiblywifi=$(echo "${actives}" | grep wifi)
possiblyeth=$(echo "${actives}" | grep Wired)
ORS=" "
if [ ! -z "${possiblyeth}" ]; then
output=wired
elif [ ! -z "${possiblywifi}" ]; then
output="wifi/$(echo ${possiblywifi} |\
awk 'BEGIN { ORS=" " }; {for (i=1; i<=(NF-3);i++) print $i}')"
else
output=offline
fi
echo -n "${output}"
# battery
powerlevel=$(cat /sys/class/power_supply/BAT*/capacity)
case $powerlevel in
0)
meter=" "
;;
1|2|3|4|5|6|7|8|9)
meter=" "
;;
10|11|12|13|14|15|16|17|18|19)
meter=" "
;;
20|21|22|23|24|25|26|27|28|29)
meter=" "
;;
30|31|32|33|34|35|36|37|38|39)
meter=" "
;;
40|41|42|43|44|45|46|47|48|49)
meter=" "
;;
50|51|52|53|54|55|56|57|58|59)
meter=" "
;;
60|61|62|63|64|65|66|67|68|69)
meter=" "
;;
70|71|72|73|74|75|76|77|78|79)
meter=" "
;;
80|81|82|83|84|85|86|87|88|89)
meter=""
;;
*)
meter=""
;;
esac
if ! grep Full /sys/class/power_supply/BAT*/status > /dev/null \
&& file /sys/class/power_supply/BAT* > /dev/null; then
echo " ${meter}"
fi
fi

39
xtraKeys.sh Executable file
View file

@ -0,0 +1,39 @@
#!/bin/sh
helpme(){
echo "$0 < v | b > < args >"
echo " args for v (volume) command:"
echo " u, d, m, mm (up, down, toggle mute, toggle mic mute)"
echo " args for b (brightness) command:"
echo " u, d (up, down)"
exit 1
}
if [ -z "$2" ]; then
helpme
fi
case ${1}${2} in
"vu")
amixer set Master 5%+; notify-send -u low -c volume volume $(amixer get Master | grep % | head -n 1 | awk '{print $5}')
;;
"vd")
amixer set Master 5%-; notify-send -u low -c volume volume $(amixer get Master | grep % | head -n 1 | awk '{print $5}')
;;
"vm")
amixer set Master toggle
;;
"vmm")
amixer set Capture toggle
;;
"bu")
xbacklight -inc 5; notify-send -u low -c brightness brightness [$(xbacklight -get)%]
;;
"bd")
xbacklight -dec 5; notify-send -u low -c brightness brightness [$(xbacklight -get)%]
;;
*)
helpme;;
esac
exit 0