[PATCH 1/2] add notify-send message when battery is lower than 8% and not charging
Export this patch
---
configs/default_hooks/sxmo_hook_battery.sh | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/configs/default_hooks/sxmo_hook_battery.sh b/configs/default_hooks/sxmo_hook_battery.sh
index e040f6d..4ceea4c 100755
--- a/configs/default_hooks/sxmo_hook_battery.sh
+++ b/configs/default_hooks/sxmo_hook_battery.sh
@@ -24,6 +24,13 @@ device_changed() {
sxmo_hook_statusbar.sh battery "$name" "$state" "$percentage"
}
+ # battery low warning
+ PERCENTAGE=$(upower -d | awk '/percentage/; /^$/ {exit}' | sed 's/[^0-9]//g')
+ STATE=$(upower -d | awk '/state/; /^$/ {exit}' | sed 's/state://g;s/ //g')
+
+ if [ $STATE = "discharging" ] && [ $PERCENTAGE -lt 8 ]; then
+ notify-send -t 5000 --urgency=critical "BATTERY is LOW" "(+_+) I will die soon"
+ fi
object="$1"
event="$2"
--
2.43.0
[PATCH 2/2] check if audio output is active since playerctl is no default in pmos
Export this patch
---
configs/default_hooks/sxmo_hook_block_suspend.sh | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/configs/default_hooks/sxmo_hook_block_suspend.sh b/configs/default_hooks/sxmo_hook_block_suspend.sh
index 7d096f7..ce46dde 100755
--- a/configs/default_hooks/sxmo_hook_block_suspend.sh
+++ b/configs/default_hooks/sxmo_hook_block_suspend.sh
@@ -76,6 +76,10 @@ playing_mpris() {
command -v playerctl && playerctl -a status | grep -q "Playing"
}
+ audio_active() {
+ pactl list sinks | grep -q 'State: RUNNING'
+ }
+
photos_processing() {
pgrep -f postprocess
}
@@ -93,5 +97,6 @@ while [ "$waited" != "0" ]; do
wait_item active_mosh
wait_item playing_mpc
wait_item playing_mpris
+ wait_item audio_active
wait_item photos_processing
done
--
2.43.0
Marked as superseded