-
Notifications
You must be signed in to change notification settings - Fork 342
Guides
When you send a notification using notify-send
or dunstify
this information
is sent to dunst over D-Bus. This information can be really useful in debugging
dunst.
To have a look at what is send to dunst over D-Bus, take a look at the output of
the command
dbus-monitor path=/org/freedesktop/Notifications
This will tell you every time a notification is sent what the contents are of that notification and when it is closed again. The D-Bus is really easy to integrate with your program, so you could create an application that does something every time a dunst notification is closed.
With PR 775 merged, dunst has the ability to draw a progress bar under the notification. This is very useful for brightness or volume notifications. This guide will explain how to use and customize that progress bar.
First check if your dunst version is recent enough. The current git master or everything after 1.6.0 should be good.
To test if you can see a progress bar, use this command:
dunstify "Progress: " -h int:value:60
This should look something like this
You can change the 60 for any value you like. To make useful volume notifications you need a bit more, though. Firstly , the value should be changing with the volume. Secondly, if you change your volume a few times in a row, you don't want to have multiple notifications. They should replace each other.
To address the first thing, you can simply replace the progress value with a command.
dunstify "Progress: " -h int:value:"`ponymix get-volume`"
You can replace ponymix with any volume command that outputs a single value.
Replacing notifications is also very easy. Think of a name for you group of notifications, like "audio", and use the following command
dunstify -h string:x-canonical-private-synchronous:audio "Volume: " -h int:value:"`ponymix get-volume`"
This passes a string named x-cannonical-private-synchronous
with the value audio
to dunst. You can name the string x-dunst-stack-tag
as well if you find it easier.
After making such nice use of the progress bar, you might want to change how it looks.
The settings you want to look at are highlight
, progress_bar
, progress_bar_height
, progress_bar_min_width
, progress_bar_max_width
and progress_bar_frame_width
.
Most of these settings are self-explanatory, but I'll explain a few of them.
The highlight
setting changes the colour of the progress bar (and in the future maybe
other similar things). It can be specified per urgency or per notification, not in the
[global] section.
The progress_bar
setting determines if a progress bar is drawn. Make sure it's set to
true if you want to use it (this is the default).
If you've configured it, it might look something like this
A progress bar is drawn for every urgency
If you like it, the config for this can be found here.
The above command is very useful, and you could change your window manager config to run this command every time you hit a hotkey to change your volume. A similar thing could be done for brightness changes.
You might run into some trouble, however when the change in volume or brightness is not yet available to the brightness command. To look at a completely working example you could use, look at the progress-notify.sh script from the contrib directory.