Add opt-in low battery sound hook

This commit is contained in:
lo0orde
2026-03-09 02:00:57 +00:00
parent b4cb5e287b
commit 49c3ea2703
3 changed files with 18 additions and 0 deletions
+1
View File
@@ -9,6 +9,7 @@ BATTERY_STATE=$(upower -i $(upower -e | grep 'BAT') | grep -E "state" | awk '{pr
send_notification() {
notify-send -u critical "󱐋 Time to recharge!" "Battery is down to ${1}%" -i battery-caution -t 30000
omarchy-hook battery-low "$1"
}
if [[ -n $BATTERY_LEVEL && $BATTERY_LEVEL =~ ^[0-9]+$ ]]; then
+10
View File
@@ -0,0 +1,10 @@
#!/bin/bash
# This hook is called with the current battery percentage when the low battery
# notification is sent. To put it into use, remove .sample from the name.
SOUND_FILE="/usr/share/sounds/freedesktop/stereo/dialog-warning.oga"
if omarchy-cmd-present mpv && [[ -f $SOUND_FILE ]]; then
mpv --no-video "$SOUND_FILE" >/dev/null 2>&1
fi
+7
View File
@@ -0,0 +1,7 @@
echo "Add sample low battery notification hook"
mkdir -p ~/.config/omarchy/hooks
if [[ ! -f ~/.config/omarchy/hooks/battery-low.sample ]]; then
cp "$OMARCHY_PATH/config/omarchy/hooks/battery-low.sample" ~/.config/omarchy/hooks/battery-low.sample
fi