1. Home
  2. Linux

How to set up better system notifications on Linux with Dunst

If you want a robust, highly customizable notification system to take the place of your system’s boring built-in one, you need to check out Dunst. It’s a complete notification system replacement that is very configurable and has much more features than what comes by default. Here’s how to get it working.

Note: don’t try to use Dunst on KDE Plasma 5, Gnome Shell or desktops built on Plasma or Gnome. These desktops have good systems already, and it’s not worth using Dunst with them.

Disable current notification system

Dunst will not work correctly, or even launch if you do not already have the notification system on your desktop environment already shut off. So, open up a terminal window by pressing Ctrl + Alt + T or Ctrl + Shift + T on the keyboard. Then, from there, follow the instructions that correspond with your Linux desktop environment.

Note: tiling window managers typically do not have a built-in notification system. Skip this section if you are using i3, Dwm, or something similar that doesn’t have a notification system.

XFCE4

The XFCE4 desktop environment doesn’t have a feature that allows users to turn off the notification system with a quick tweak. Instead, users need to completely purge the Notifyd service and kill it before working with Dunst. To do this, follow the uninstallation instructions below.

Ubuntu

sudo apt remove xfce4-notifyd

Debian

sudo apt-get remove xfce4-notifyd

Arch Linux

sudo pacman -R xfce4-notifyd

Fedora

sudo dnf remove xfce4-notifyd

OpenSUSE

sudo zypper remove  xfce4-notifyd

With the package uninstalled from your XFCE4 desktop, use the pidof command to determine the name of the notification service, as it’s still running in RAM.

pidof xfce4-notifyd

Take the number that pidof outputs and plug it into the kill command below to disable Xfce4-notifyd entirely.

sudo kill -9 process-id-number

You may need to run pidof xfce4-notifyd after using the kill command to ensure that the process is dead. If it is, pidof will return no process ID the second time.

Mate

With Mate, the Dunst app should be able to overtake the built-in notification system without any need to disable anything. That said if you’d like to disable it, open up a terminal window and enter the command below.

sudo mv /usr/share/dbus-1/services/org.freedesktop.mate.Notifications.service /usr/share/dbus-1/services/org.freedesktop.mate.Notifications.service.disabled

Others

Aside from Mate and XFCE4, a lot of other lightweight desktop environments may need to have their notification systems disabled before continuing. Due to how many desktops there are, consult with the manual of your desktop environment. Or, consider installing XFCE4 or Mate to use Dunst with, if need be.

Installing Dunst

Installing Dunst on Linux is easy on most Linux distributions due to the detailed documentation the developers provide. To get it working on your Linux PC, open up a terminal window and follow the instructions that correspond with the OS you currently use.

Ubuntu

Using Dunst on Ubuntu requires the “Ubuntu Universe” software repository. To enable the Ubuntu Universe software repository, enter the command below.

sudo add-apt-repository universe

With Universe enabled, install Dunst on the system usingĀ apt install.

sudo apt install dunst

Debian

sudo apt-get install dunst

Arch Linux

sudo pacman -S dunst

Fedora

sudo dnf install dunst

OpenSUSE

sudo dnf install dunst

Source Code

To install Dunst from source, start by reading the GitHub page to learn what dependencies must be installed so that the software will build on your Linux PC. Then, enter the commands below to get it compiled and installed.

git clone https://github.com/dunst-project/dunst.git
cd dunst
make -j($nproc)
sudo make install

Configure Dunst

Dunst must be configured before it will work as your default notification system. The first thing that must be done is that you must generate a new configuration file. The easiest way to do this is to download the default one from the internet.

Using the wget download tool, download “dunstrc” to your Linux PC.

cd ~/Downloads
wget https://raw.githubusercontent.com/dunst-project/dunst/master/dunstrc

With the “dunstrc” file done downloading, use the mkdir command to create a folder for it in your home directory (~/).

mkdir -p ~/.config/dunst/

Next, move the configuration file into the new folder.

mv ~/Downloads/dunstrc  ~/.config/dunst/

From here, open up the dunstrc file in the Nano text editor.

nano ~/.config/dunst/dunstrc

Use the Down Arrow key in Nano to scroll down the configuration file. Feel free to customize any aspect to the notification system you choose.

Note: Dunst works fine without editing the configuration file, so there’s no pressure to modify it if you don’t know how!

When done editing the configuration file, press Ctrl + O to save the edits. Close Nano with Ctrl + X.

Start Dunst

The software is installed, and the dunstrc configuration file is in place. Now it’s time to start up the Dunst systemd service. To do this, open up a terminal window and follow the commands below specific to your OS.

Ubuntu/Debian

The Apt package manager, during installation, should automatically enable and configure the systemd services necessary to use Dunst. However, it doesn’t place a default configuration file in place, so the systemd service must be restarted. To do this, use the systemctl restart command below.

systemctl restart --user dunst.servicee

Arch Linux/Fedora/OpenSUSE and Source Code

Many Linux distributions that use systemd do not take Ubuntu and Debian’s lead by enabling services during the installation process. Instead, these things must be set up manually.

First, use systemctl enable to set up the service to run at boot.

systemctl enable --user dunst.service

Next, start up the service using systemctl start.

systemctl start --user dunst.service

Assuming the services start up successfully, you’ll be using the Dunst notification system!

Leave a comment