i3 and battery_nag, reached a point where it successfully kills then restarts on each reload.

This commit is contained in:
me
2026-08-22 12:12:43 -07:00
parent f59a4f90ba
commit c4964a1a1e
2 changed files with 6 additions and 5 deletions
+5 -4
View File
@@ -6,10 +6,9 @@
echo "`date` - Checking Active Programs" echo "`date` - Checking Active Programs"
PID="$$" ps -ef | grep battery_nag.sh | grep -v grep | grep -v "sh -c" | grep -v kill | grep -v $$
ps -ef | grep battery_nag.sh | grep -v grep | grep -v killall | grep -v $$
active=`ps -ef | grep battery_nag.sh | grep -v grep | grep -v killall | grep -vc $$` active=`ps -ef | grep battery_nag.sh | grep -v grep | grep -v "sh -c" | grep -v kill | grep -vc $$`
if (( "$active" >= 1 )); then if (( "$active" >= 1 )); then
echo "Program already running, exiting. Number of processes: $active" echo "Program already running, exiting. Number of processes: $active"
exit 1 exit 1
@@ -97,7 +96,9 @@ while true; do
fi fi
time=$sleep time=$sleep
if [[ "$accelerate" == "Y" ]]; then if [[ "$accelerate" == "Y" && $batt -lt $alert ]]; then
# Bash only returns whole numbers, so things like 20/11 only provide 1.
# Likewise, if the battery is full, 20/100 returns 0, which is bad. :)
if (( batt > 0 )); then if (( batt > 0 )); then
time=$(( time / (alert / batt) )) time=$(( time / (alert / batt) ))
else else
+1 -1
View File
@@ -380,4 +380,4 @@ exec_always --no-startup-id feh --recursive --randomize --bg-fill ~/Pictures/Wal
exec_always --no-startup-id "killall picom; picom -f" exec_always --no-startup-id "killall picom; picom -f"
# Battery # Battery
exec_always --no-startup-id "pkill -f battery_nag.sh; battery_nag.sh >~/Reports/battery_nag.log 2>&1" exec_always --no-startup-id bash -c 'pkill -ef "bash `which battery_nag.sh`" >~/Reports/battery_nag.log 2>&1; battery_nag.sh >>~/Reports/battery_nag.log 2>&1'