Skip to content
fwSmit edited this page Dec 16, 2020 · 11 revisions

Guides

Using the progress bar for volume notifications

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

progress bar

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.

Using the volume as progress value

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

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.

Conclusion

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.