diff options
author | Timmy Keller <tjk@tjkeller.xyz> | 2024-09-09 21:08:07 -0500 |
---|---|---|
committer | Timmy Keller <tjk@tjkeller.xyz> | 2024-09-09 21:08:07 -0500 |
commit | 40c551385f20cc95a1b6571c4b1946cbed226f85 (patch) | |
tree | bd561084f82a817346bab048a403dd6304a925cf /lowbat.c | |
parent | 8e929bd44420ed9a3bc0b6a030cebbdfcafebf4d (diff) | |
download | lowbat-40c551385f20cc95a1b6571c4b1946cbed226f85.tar.xz lowbat-40c551385f20cc95a1b6571c4b1946cbed226f85.zip |
update makefile to build & install, include manpage, make notification persistent and change urgency
Diffstat (limited to 'lowbat.c')
-rw-r--r-- | lowbat.c | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -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; } |