aboutsummaryrefslogtreecommitdiff
path: root/lowbat.c
diff options
context:
space:
mode:
Diffstat (limited to 'lowbat.c')
-rw-r--r--lowbat.c8
1 files changed, 5 insertions, 3 deletions
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;
}