-
Notifications
You must be signed in to change notification settings - Fork 342
Guides
Since not too long, 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.
This feature has not yet been released, but it's available on the master branch.
First check your dunst version is recent enough. The current git version 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).
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.