~mil/sxmo-devel

2 2

[PATCH 1/2] add notify-send message when battery is lower than 8% and not charging

Details
Message ID
<20240415181351.22217-1-hallo@magdesign.ch>
DKIM signature
permerror
Download raw message
Patch: +7 -0
---
 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

Fwd: [PATCH 1/2] add notify-send message when battery is lower than 8% and not charging

Details
Message ID
<239ffcbf694257a90d20e5d3a854f73a@magdesign.ch>
In-Reply-To
<20240415181351.22217-1-hallo@magdesign.ch> (view parent)
DKIM signature
permerror
Download raw message
please ignore this....
sorry... it was stock in my commit history

-------- Original Message -------- SUBJECT: [PATCH 1/2] add notify-send 
message when battery is lower than 8% and not charging DATE: 2024-04-15 
21:13 FROM: magdesign <hallo@magdesign.ch> TO: 
~mil/sxmo-devel@lists.sr.ht CC: magdesign <hallo@magdesign.ch> --- 
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"
Details
Message ID
<D0U1UJKH4VBA.F0OVLO2V67V2@willowbarraco.fr>
In-Reply-To
<20240415181351.22217-1-hallo@magdesign.ch> (view parent)
DKIM signature
pass
Download raw message
I sit on a similar patch for some time, with a saner implementation imo.
I prefer to merge this. It does not check the upower status, which I
think make it simplest, but enough for now. Feel free to improve it.

Marked as superseded !
Reply to thread Export thread (mbox)