mirror of
https://github.com/arthur-pbty/arthur-os.git
synced 2026-08-01 20:28:16 +02:00
Add opt-in low battery sound hook
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user