fix low battery

This commit is contained in:
Venelin Dechkov
2026-07-30 11:54:49 +03:00
parent d6202280e9
commit 4ad49de088
+6
View File
@@ -29,6 +29,7 @@ namespace
Proc child; Proc child;
Cmd amixer("amixer"); Cmd amixer("amixer");
Cmd low_battery_notify("notify-send", "--urgency=critical", "Battery Low");
} }
extern "C" extern "C"
@@ -176,6 +177,10 @@ extern "C"
{ {
new_stat += "🔋"; new_stat += "🔋";
remaining = battery_remaining("BAT0"); remaining = battery_remaining("BAT0");
// Low battery warning
if(remaining && atoi(charge.c_str()) < 15)
run(low_battery_notify); // todo: use lib notify
} }
else else
new_stat += "🔌"; new_stat += "🔌";
@@ -305,6 +310,7 @@ extern "C"
size_t link_begin = link.find('-'); size_t link_begin = link.find('-');
if(link_begin != string::npos) if(link_begin != string::npos)
{ {
// Extract link
Cmd open_bookmark(BROWSER); Cmd open_bookmark(BROWSER);
link = link.substr(link_begin+1); link = link.substr(link_begin+1);
open_bookmark += link.c_str(); open_bookmark += link.c_str();