From 4ad49de0883c0e1d40d105dc629c01e89d910dba Mon Sep 17 00:00:00 2001 From: Venelin Dechkov Date: Fri, 20 Dec 2024 19:08:53 +0200 Subject: [PATCH] fix low battery --- vene.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/vene.cpp b/vene.cpp index 964668f..1005e02 100644 --- a/vene.cpp +++ b/vene.cpp @@ -29,6 +29,7 @@ namespace Proc child; Cmd amixer("amixer"); + Cmd low_battery_notify("notify-send", "--urgency=critical", "Battery Low"); } extern "C" @@ -176,6 +177,10 @@ extern "C" { new_stat += "🔋"; remaining = battery_remaining("BAT0"); + + // Low battery warning + if(remaining && atoi(charge.c_str()) < 15) + run(low_battery_notify); // todo: use lib notify } else new_stat += "🔌"; @@ -305,6 +310,7 @@ extern "C" size_t link_begin = link.find('-'); if(link_begin != string::npos) { + // Extract link Cmd open_bookmark(BROWSER); link = link.substr(link_begin+1); open_bookmark += link.c_str();