From 2d8eff229896fe6e8d09de54062a63d1a331a104 Mon Sep 17 00:00:00 2001 From: Derek Stevens Date: Tue, 29 Sep 2020 23:58:30 -0400 Subject: [PATCH] added desks, sleepy; update copyleft notice --- desks.sh | 34 ++++++++++++++++++++++++++++++++++ extdisplay.sh | 2 +- nmtuiWin.sh | 4 +++- sleepy.sh | 23 +++++++++++++++++++++++ t2stats.sh | 27 +++++++++++++++------------ 5 files changed, 76 insertions(+), 14 deletions(-) create mode 100755 desks.sh create mode 100755 sleepy.sh diff --git a/desks.sh b/desks.sh new file mode 100755 index 0000000..c2a5fb8 --- /dev/null +++ b/desks.sh @@ -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 +# 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 diff --git a/extdisplay.sh b/extdisplay.sh index 60c3ded..8f304a9 100755 --- a/extdisplay.sh +++ b/extdisplay.sh @@ -2,7 +2,7 @@ # extdisplay: # this is a wrapper around xrandr to handle one external monitor on a laptop -# (c) 2020 Derek Stevens +# copyleft 2020 Derek Stevens # MIT License -- do whatever you want helpme() diff --git a/nmtuiWin.sh b/nmtuiWin.sh index 4bd6949..c3cfa0b 100755 --- a/nmtuiWin.sh +++ b/nmtuiWin.sh @@ -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 diff --git a/sleepy.sh b/sleepy.sh new file mode 100755 index 0000000..0c263a0 --- /dev/null +++ b/sleepy.sh @@ -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 +# 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 +} diff --git a/t2stats.sh b/t2stats.sh index 22c34e7..314df5d 100755 --- a/t2stats.sh +++ b/t2stats.sh @@ -2,7 +2,7 @@ # t2stats: # this is a simple network/battery status indicator to be used with tint2 -# (c) 2020 Derek Stevens +# copyleft 2020 Derek Stevens # 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 \ No newline at end of file +done