diff --git a/.local/bin/AC_notify b/.local/bin/AC_notify
deleted file mode 100755
index f19937c..0000000
--- a/.local/bin/AC_notify
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/usr/bin/env sh
-
-######################################################################
-# @author : swytch
-# @file : AC_notify
-# @license : MIT
-# @created : Wednesday May 20, 2020 17:51:45 CEST
-#
-# @description : send a notification when AC status change
-# refresh statusbar
-######################################################################
-
-
-new_state="$(cat /sys/class/power_supply/AC/online)"
-prev_state="$new_state"
-
-notify() { \
- # $1 is $new_state
- if [ "$1" = 1 ]; then
- notify-send -u "normal" "AC plugged in - CHARGING"
- else
- notify-send -u "critical" "AC unplugged ! - DISCHARGING"
- fi
- }
-
-update(){ \
- new_state="$(cat /sys/class/power_supply/AC/online)"
- if [ "$prev_state" != "$new_state" ]; then
- notify "$new_state" && refbar
- fi
- prev_state="$new_state"
- }
-
-while :; do
- update
- # Sleep for 5s seconds before checking again
- sleep 5 &
- wait
-done
diff --git a/.local/bin/README.md b/.local/bin/README.md
index 3a7d947..5cbaf91 100644
--- a/.local/bin/README.md
+++ b/.local/bin/README.md
@@ -6,11 +6,9 @@
## Scripts
-- AC_notify : send a notification when the computer is plugged/unplugged
- arch_setup : my personnal machine setup script
- audio-notify : send a notification when audio level is changed
- backlight_notify : send a notification when backlight level is changed
-- bat_notify : send a notification when battery runs low
- bibinput : add a **.bib** entry through `dmenu`
- bibshow : retrieve a **.bib** reference and copy to `xclip`
- bulk : execute batch commands through your favorite $EDITOR
diff --git a/.local/bin/backlight_notify b/.local/bin/backlight_notify
deleted file mode 100755
index d5f7182..0000000
--- a/.local/bin/backlight_notify
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/usr/bin/env sh
-
-######################################################################
-# @author : swytch
-# @file : backlight_notify
-# @license : MIT
-# @created : Wednesday May 20, 2020 17:53:36 CEST
-#
-# @description : send a notification with xbacklight value
-######################################################################
-
-
-current=$(cat /sys/class/backlight/intel_backlight/brightness)
-max=$(cat /sys/class/backlight/intel_backlight/max_brightness)
-step=$(expr $max / 20)
-
-level=$(expr $(expr $current / $step) \* 5)
-
-dunstify -r 100001 -u "low" "Current xBacklight value :" "$level%"
diff --git a/.local/bin/bat_notify b/.local/bin/bat_notify
deleted file mode 100755
index 0ab54ca..0000000
--- a/.local/bin/bat_notify
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/usr/bin/env sh
-
-######################################################################
-# @author : swytch
-# @file : bat_notify
-# @license : MIT
-# @created : Wednesday May 20, 2020 17:54:08 CEST
-#
-# @description : send a notification with charge level
-######################################################################
-
-
-notify() { \
- for x in /sys/class/power_supply/BAT?/capacity;
- do
- case "$(cat "$x")" in
- 1[0-9]) notify-send -u "normal" "Battery is running low ($(cat "$x")%)" "Please plug your computer to a power source" ;;
- [0-9]) notify-send -u "critical" "Battery is dangerously low ($(cat "$x")%)" "Please plug your computer to a power source - NOW!" ;;
- esac
- done
- }
-
-update() { \
- # We want the notification to be sent every 5 mins
- # But only if the computer is unplugged
- if [ "$(cat /sys/class/power_supply/AC/online)" = 0 ]; then
- notify && kill -36 $(pidof dwmblocks)
- fi
- wait
- }
-
-update
diff --git a/.local/bin/refbar b/.local/bin/refbar
deleted file mode 100755
index 19a7bc6..0000000
--- a/.local/bin/refbar
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/usr/bin/env sh
-
-######################################################################
-# @author : swytch (adapted form Luke Smith - lukesmith.xyz)
-# @file : refbar
-# @license : MIT
-# @created : Wednesday May 20, 2020 18:21:19 CEST
-#
-# @description : refresh dwmbar
-######################################################################
-
-
-# Send SIGTRAP signal to dwmbar script, which will handle it with a trap.
-pkill -SIGTRAP dwmbar
diff --git a/.local/bin/statusbar/sb-battery b/.local/bin/statusbar/sb-battery
index 1f31f39..f32b1ba 100755
--- a/.local/bin/statusbar/sb-battery
+++ b/.local/bin/statusbar/sb-battery
@@ -13,6 +13,15 @@
# Will show all batteries with approximate icon for remaining power.
# Or show that the computer is plugged to a power source
# In any case, show the remaining battery percentage
+# Also sends a notification if battery running low
+
+notify() { \
+ case "$(cat "$x")" in
+ 1[0-9]) notify-send -u "normal" "Battery is $status and running low ($capacity%)" "Please plug your computer to a power source" ;;
+ [0-9]) notify-send -u "critical" "Battery is $status and dangerously low ($capacity%)" "Please plug your computer to a power source - NOW!" ;;
+ esac
+ }
+
for bat in /sys/class/power_supply/BAT?/
do
status="$(cat "$bat/status")"
@@ -27,7 +36,7 @@ do
7[0-9]|6[0-9]) status="" ;;
5[0-9]|4[0-9]) status="" ;;
3[0-9]|2[0-9]) status="" ;;
- *) status="" ; [ "$status" != "Charging" ] && notify;;
+ *) status="" ; [ "$status" != "Charging" ] && notify;;
esac
fi
printf "%s %3d%%\n" "$status" "$capacity";