Difference between revisions of "Dunst"

From ArchWiki
Jump to navigation Jump to search
m (Remove those curly boyz)
(Merge introductory section from dunstify)
Line 88: Line 88:
 
Once paused dunst will hold back all notifications.  
 
Once paused dunst will hold back all notifications.  
 
After enabling dunst again all held back notifications will be displayed.
 
After enabling dunst again all held back notifications will be displayed.
 +
 +
== Dunstify ==
 +
 +
Dunstify is an alternative to the [[Desktop notifications#Usage in programming|notify-send]] command
 +
which is completely compatible to notify-send and can be used alongside it, but offers some more features.
 +
Dunstify works only with the [[Dunst]] notification daemon.
 +
 +
Additionally to the options available in notify-send, dunstify offers some more features like IDs and actions.
  
 
== Troubleshooting ==
 
== Troubleshooting ==

Revision as of 19:46, 10 January 2019

Dunst is a lightweight replacement for the notification-daemons provided by most desktop environments.

Installation

Install the dunst package. There is no need to start or enable dunst; it is called by systemd when programs send notifications through dbus.

An example configuration file is included at /usr/share/dunst/dunstrc. Copy this file to ~/.config/dunst/dunstrc and edit it accordingly.

Appearance

Dunst allows for the use of html markup in notifications. Some examples are bold, italics, strikethrough and underline. For a complete reference see [1]. HTML can be stripped from notifications if markup is set to none.

The formatting of the notification can be specified. Options are as follows:

%a  appname
%s  summary
%b  body
%i  iconname (including its path)
%I  iconname (without its path)
%p  progress value if set ([  0%] to [100%]) or nothing

These can be used in conjunction with HTML markup. For example the format can be set to <b>%s</b>\n%b for a bolded notification summary, a newline and the body unformatted.

Icon Sets

Icons are set in the option icon_path. Status and devices icons are needed. By default, Dunst looks for the gnome-icon-theme icons. For example, to use adwaita-icon-theme (gnome-icon-theme's successor), instead:

icon_path = /usr/share/icons/Adwaita/16x16/status/:/usr/share/icons/Adwaita/16x16/devices/

Shortcuts

Idle thresholds can be set letting the notification stay onscreen if the user is idle longer than the threshold.

To close a notification before it times out use Control + space. If multiple notifications are onscreen Control + Shift + Space closes all of them.

Tip: The commands for closing and reopening notifications can be changed. If using a symbol rather than an alphabetical letter it must be spelled out, e.g. period.

A history list can be accessed by using Control + grave. A context menu can be opened using Control + Shift + period. The context menu uses dmenu to filter out URLs and open them in your browser. The default browser can be set in the config like so:

browser = /usr/bin/chromium 

Rules

You can create rules in your dunstrc file which match certain notifications and then perform an action on it such as executing a script.

Filtering

To create a new rule create a new section with a custom name in your config file. In that section you can now use the attributes appname, summary, body, icon, category, match_transient and msg_urgency to match the notification. Globbing is supported. See Scripting for an example. Start dunst with the -print option to find out useful information about a notification to write proper rules.

Modifying

When a notification is matched you can perform certain actions on it like modifying the format string, which is especially useful if you want tocompletely ignore certain notifications. In that case simply add the line format="" to your rule.

Another useful feature is if you want to keep certain notifications out of your history for example if you use dunst as a Volume indicator. To achieve this simply add history_ignore=yes to your rule.

Scripting

Dunst can be configured to run scripts based on certain notification content. Here is an example using Dunst to run a script when someone from pidgin signs on:

[signed_on]
   appname = Pidgin
   summary = "*signed on*"
   urgency = low
   script = do_something.sh

The specified script will be passed the following parameters in that order: appname, summary, body, icon, urgency.

Disable dunst temporarily

To disable dunst temporarily there are two options.

Send a special notification
Use notify-send "DUNST_COMMAND_PAUSE" to disable and notify-send "DUNST_COMMAND_RESUME" to reenable.
Use killall
Use killall -SIGUSR1 dunst to disable and killall -SIGUSR2 dunst to reenable

Once paused dunst will hold back all notifications. After enabling dunst again all held back notifications will be displayed.

Dunstify

Dunstify is an alternative to the notify-send command which is completely compatible to notify-send and can be used alongside it, but offers some more features. Dunstify works only with the Dunst notification daemon.

Additionally to the options available in notify-send, dunstify offers some more features like IDs and actions.

Troubleshooting

Dunst fails to start via systemd

When using dunst without a Display Manager, the DISPLAY environment variable might not be correctly set.[2]

To fix this, add the following to your .xinitrc:

systemctl --user import-environment DISPLAY