summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-x.local/bin/statusbar/battery5
-rwxr-xr-x.local/bin/statusbar/moonphase7
-rwxr-xr-x.local/bin/sysact11
3 files changed, 13 insertions, 10 deletions
diff --git a/.local/bin/statusbar/battery b/.local/bin/statusbar/battery
index 97868bb..d348279 100755
--- a/.local/bin/statusbar/battery
+++ b/.local/bin/statusbar/battery
@@ -12,12 +12,15 @@ case $BLOCK_BUTTON in
❗: battery very low!" ;;
esac
+# acpi alternative
+# acpi | sed "s/Battery [0-9]: //;s/[Dd]ischarging, /🔋/;s/[Nn]ot charging, /🛑/;s/[Cc]harging, /🔌/;s/[Uu]nknown, /♻️/;s/[Ff]ull, /⚡/;s/ \(remaining\|until charged\)//"; exit
+
# Loop through all attached batteries.
for battery in /sys/class/power_supply/BAT?
do
# Get its remaining capacity and charge status.
capacity=$(cat "$battery"/capacity) || break
- status=$(sed "s/Discharging/🔋/;s/Not charging/🛑/;s/Charging/🔌/;s/Unknown/♻️/;s/Full/⚡/" "$battery"/status)
+ status=$(sed "s/[Dd]ischarging/🔋/;s/[Nn]ot charging/🛑/;s/[Cc]harging/🔌/;s/[Uu]nknown/♻️/;s/[Ff]ull/⚡/" "$battery"/status)
# If it is discharging and 25% or less, we will add a ❗ as a warning.
[ "$capacity" -le 25 ] && [ "$status" = "🔋" ] && warn="❗"
diff --git a/.local/bin/statusbar/moonphase b/.local/bin/statusbar/moonphase
index 12ed90b..739b8a8 100755
--- a/.local/bin/statusbar/moonphase
+++ b/.local/bin/statusbar/moonphase
@@ -2,7 +2,7 @@
# Shows the current moon phase. Requires `pom-perl`.
-mnphs=$(pom $1 | grep -o 'New\|Waxing Crescent\|First Quarter\|Waxing Gibbous\|Full\|Waning Gibbous\|Last Quarter\|Waning Crescent' | grep -m1 '.')
+mnphs=$(pom $1 | grep -o 'New\|Waxing Crescent\|First Quarter\|Waxing Gibbous\|Full\|Waning Gibbous\|Last Quarter\|Waning Crescent' | grep -m1 '.') || exit 1
prcnt=$(pom $1 | grep -o '[[:digit:]]*%' | grep -o '[[:digit:]]*' )
case "$mnphs" in
"New") icon="🌑" prcnt="0" ;;
@@ -13,13 +13,12 @@ case "$mnphs" in
"Waning Gibbous") icon="🌖" ;;
"Last Quarter") icon="🌗" prcnt="50" ;;
"Waning Crescent") icon="🌘" ;;
- *) echo errorrrr ;;
esac
-case $BLOCK_BUTTON in
+case ${BUTTON:-$BLOCK_BUTTON} in
1) $mnphs ;;
2) $mnphs ;;
3) notify-send " 🌜$(pom)" ;;
esac
-echo "$icon" "$prcnt"%
+echo "${icon:?}" "$prcnt"%
diff --git a/.local/bin/sysact b/.local/bin/sysact
index aaef469..3ba1940 100755
--- a/.local/bin/sysact
+++ b/.local/bin/sysact
@@ -3,11 +3,12 @@
# A dmenu wrapper script for system functions.
cmds="\
-lock screen slock
-leave dwm kill -TERM $(pidof -s dwm)
-refresh dwm kill -HUP $(pidof -s dwm)
-reboot sudo -A reboot
-shutdown sudo -A shutdown -h now"
+🔒 lock slock
+🚪 leave dwm kill -TERM $(pidof -s dwm)
+♻ renew dwm kill -HUP $(pidof -s dwm)
+🐻 hibernate sudo -A zzz
+🔃 reboot sudo -A reboot
+🖥 shutdown sudo -A shutdown -h now"
choice="$(echo "$cmds" | cut -d' ' -f 1 | dmenu)" || exit 1