-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvolnotify.c
More file actions
27 lines (23 loc) · 983 Bytes
/
volnotify.c
File metadata and controls
27 lines (23 loc) · 983 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include "volnotify.h"
void volnotify_init(){
notify_init("pulse-volumeicon");
volnotify_volume = notify_notification_new(NULL, NULL, NULL);
notify_notification_set_timeout(volnotify_volume, NOTIFY_EXPIRES_DEFAULT);
notify_notification_set_hint_string(volnotify_volume, "synchronous", "volume");
}
void volnotify_show(int volumeLevel, int volumeMuted){
if(volumeMuted || volumeLevel == 0)
notify_notification_update(volnotify_volume,
"pulse-volumeicon", NULL, "audio-volume-muted");
else if(volumeLevel <= 33)
notify_notification_update(volnotify_volume,
"pulse-volumeicon", NULL, "audio-volume-low");
else if(volumeLevel <= 66)
notify_notification_update(volnotify_volume,
"pulse-volumeicon", NULL, "audio-volume-medium");
else
notify_notification_update(volnotify_volume,
"pulse-volumeicon", NULL, "audio-volume-high");
notify_notification_set_hint_int32(volnotify_volume, "value", volumeLevel);
notify_notification_show(volnotify_volume, NULL);
}