Install and configure Dunst for desktop notifications.
Dunst is only distributed as source, so it can be built on any current distribution.
A working Linux install with root privileges.
- # – requires given linux commands to be executed with root privileges either directly as a root user or by use of
- $ – requires given linux commands to be executed as a regular non-privileged user
No one wants to spend hours configuring and customizing their tiling window manager only for an ugly, poorly rendered notification window from GNOME to keep popping up and ruining the overall feel of their desktop.
If you’re looking for a more minimal and configurable notification daemon, look no further than Dunst. It provides a basic notification daemon that you can style and configure to match any tiling window manager setup. Plus, it’s super light weight, so there’s no need to worry about it hogging resources.
Compile And Install
Install The Dependencies
Very few distributions package Dunst. Gentoo and Arch do. Just about everyone else needs to compile it. Thankfully, the developers have provided dependency lists for several distributions. Install those first.
$ sudo apt install libdbus-1-dev libx11-dev libxinerama-dev libxrandr-dev libxss-dev libglib2.0-dev libpango1.0-dev libgtk2.0-dev libxdg-basedir-dev
# apt install libdbus-1-dev libx11-dev libxinerama-dev libxrandr-dev libxss-dev libglib2.0-dev libpango1.0-dev libgtk2.0-dev libxdg-basedir-dev
# dnf install dbus-devel libX11-devel libXrandr-devel glib2-devel pango-devel gtk2-devel libxdg-basedir-devel libXScrnSaver-devel
Now, you can grab the Dunst source code to compile and install. Go to a directory where you want to build it.
$ cd ~/Downloads $ git clone https://github.com/dunst-project/dunst.git $ cd dunst $ make -j5 $ sudo make install
That’s it! Dunst is installed.
Switch The Dbus Service
If you have installed another desktop environment on your computer, you might have a different notification daemon installed. You’re going to need to either uninstall it or switch to Dunst.
That’s actually easier said than done. There’s no easy mechanism or configuration file to tell Dbus to use one notification service or another.
You’ll find the Dbus services at
/usr/share/dbus-1/services/. The easiest way to force Dbus to execute Dunst is to find the current notification service and edit the line that begins with
Exec to point to Dunst instead. You can also try removing the existing service, but that might break something, so be careful.
Generate Your Configuration
Dunst comes with a default configuration file. It’s located at
/usr/share/dunst/dunstrc. You need to copy it to your local configuration.
$ mkdir ~/.config/dunst $ sudo cp /usr/share/dunst/dunstrc /home/user/.config/dunst/dunstrc $ sudo chown user:user /home/user/.config/dunst/dunstrc
There’s a lot in the Dunst configuration, so it’s not possible to cover it all. The file is very well documented, so you can read up on anything that’s not covered here but still may interest you.
Monitor and Follow
The first two options to make note of are
follow. They both determine where your notifications will appear. The
monitor option will determine which monitor(counting from 0) the notifications will pop up on.
follow option will override
monitor and place the notifications on whichever screen has focus from either the mouse or keyboard. If you prefer the notifications to be fixed to one monitor, set this option to
You can choose the size of the notification window that Dunst displays. The configuration is a little strange. Take a look at the default, and break it down.
geometry = "300x5-30+20"
There are two basic parts here. The first one handles the overall dimensions. The second adjusts their position.
300x5 is the raw dimensions. They aren’t exactly what you think, though. It’s 300 pixels by 5 notifications. That means that the notifications will be a maximum of 300 pixels wide, and Dunst will stack up to 5 of them.
The next two values,
-30+20 refer to the placement of the notification pop-up. The first value is the
x and the second is the
y. If the
x value is positive, it will appear on the left side of the screen, and the value will determine how far from the left it will be. A negative value, like the one in the example, will appear on the right side of the screen, and the value will determine how far from the right it will appear.
y value works the same way as the
x but with the top and bottom of the screen. Since, this value is positive, it will be 20 pixels from the top.
There are a few options for setting up the default styling for your notification windows. Below are the defaults as they appear in the configuration. Feel free to change and experiment with them.
# Window Transparency transparency = 0 # Height of separator between notifications separator_height = 2 # Vertical padding padding = 8 # Horizontal padding horizontal_padding = 8 # Border width. Set to 0 to disable frame_width = 3 # Border color frame_color = "#aaaaaa" # Border color between notifications frame = same as above separator_color = frame
If you’re wondering about the background and text color, that’s lower down.
There are a lot of text options. The most important ones control the font and formatting of your notification message.
First, tale a look at the font option. It’s straightforward. Specify your font and the size.
font = Monospace 8
In formatting the actual output, Dunst uses a markup syntax from Pango. It’s essentially HTML style text formatting blended with specific variables. The options are listed in the comments of the config file.
format = "<b>%s</b>\n%b"
In this instance, Dunst will display a summary of notification, denoted by the
%s variable in bold. Then, on a new line(
\n), it will show the body of the notification message. The full listing of variables appears right above this line in the default configuration.
Styling By Urgency
Lower down in the configuration, you’ll find a series of blocks labelled for the urgency of the notification, like
[urgency_low]. These let you style your notifications by urgency. This section fills in the gaps from the previous defaults.
Each block looks like this:
[urgency_critical] background = "#000000" foreground = "#c61616" frame_color = "#c61616" timeout = 0
You can set the background of the window and the text color, in the form of the foreground. You can also overwrite the frame color to match. The
timeout value refers to how long the notification stays on the screen. The value of
0 means that it’ll stay until it’s dismissed.
Sure, there’s more you can do with Dunst, but you now have enough guidance to get started on your own and make some great looking and unique notifications for your desktop.
When you’re ready, explore. Let the comments guide you. Dunst easily has one of the most well documented configuration files you’ll come across.