diff options
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; } |