From 40c551385f20cc95a1b6571c4b1946cbed226f85 Mon Sep 17 00:00:00 2001 From: Timmy Keller Date: Mon, 9 Sep 2024 21:08:07 -0500 Subject: update makefile to build & install, include manpage, make notification persistent and change urgency --- lowbat.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'lowbat.c') diff --git a/lowbat.c b/lowbat.c index 14f10a2..f3855bc 100644 --- a/lowbat.c +++ b/lowbat.c @@ -64,11 +64,13 @@ void load_installed_batteries() { closedir(dir); } -void notifysend(char *title, char *content) { +void notifysend(char *title, char *content, NotifyUrgency urgency) { NotifyNotification *notif; notify_init("lowbat"); notif = notify_notification_new(title, content, NULL); + notify_notification_set_timeout(notif, NOTIFY_EXPIRES_NEVER); + notify_notification_set_urgency(notif, urgency); notify_notification_show(notif, NULL); } @@ -133,12 +135,12 @@ int main() { if (discharging) { if (capacity <= 5 && !w_lowbat_crit) { sprintf(msg, "%d%% remains", capacity); // TODO snprintf me plz - notifysend("Critical Low Battery Warning", msg); + notifysend("Critical Low Battery Warning", msg, NOTIFY_URGENCY_CRITICAL); w_lowbat_crit = w_lowbat = 1; } else if (capacity <= 20 && !w_lowbat) { sprintf(msg, "%d%% remains", capacity); - notifysend("Low Battery Warning", msg); + notifysend("Low Battery Warning", msg, NOTIFY_URGENCY_NORMAL); w_lowbat = 1; } -- cgit v1.2.3