Desktop notifications mechanism allows background asynchronous processed to interrupt your work flow and take your attention away to some event that just has happened.
You would want notifications is some environments where you are expected to be available to interruptions and handle some external events in timely fashion.
I don't use notifications in my personal computing environments. On the other hand in professional setting handling random events thrown at me is part of my job description.
I like building things from first principles. My Linux desktop is built with Void Linux. It allows me to build my own desktop experience and tailor it to particular use case.
My desktop is based on sway. Sway is a Wayland compositor and does not offer desktop notifications functionality alone. It needs additional software to implement that functionality.
From Dunst home page:
Dunst is a lightweight replacement for the notification daemons provided by most desktop environments.
After installation it can be configured globally with
you can use per-user configuration
It produces minimalistic notification pop-ups that are rectangular with solid color fill and optional border. The text can be formatted using Pango markup.
It runs as a UNIX daemon, listening on a socket. It comes with
notify-send command that is
standardised and can be used to produce notifications from scripts. Major browsers and
most desktop software should just work with it correctly.
There is also more specialized command that unlocks some dunst specific notification features
If you run one of them for the first time an ad-hock dunst daemon will be spawned by them for you.
I have set up dunst as per-user runit service.
Dunst has many advanced features, see:
In default configuration sway show a bar at the top of the screen. It shows buttons to navigate active desktops and some real-time system information.
By default dunst will produce a rectangular box in the right-top corner of the screen. It will overlay on top of desktop content, including full-screen applications (e.g. video).
I have decided that I would like it to only obscure the bar part of the screen, so I can continue working uninterrupted and wrap up my work to a consistent state before changing focus.
To achieve this I have tweaked the following default settings:
width = 960- makes the notification rectangle about half of the screen in width,
height = 23- makes it exactly the height of the sway bar,
offset = 0x-23- move the notifications to cover the bar,
notification_limit = 1- only show one notification rectangle; otherwise multiple notifications would cover my work; you can still click through all of the notifications,
progress_bar = false- progress bars won't be visible in such small space; we will configure message format to include numerical value for progress,
separator_height = 0and
frame_width = 0- don't show frames,
padding = 4and
font = Monospace 10and
vertical_alignment = top- vertically align the text,
alignment = right- horizontally align the text to right side of the screen,
format = "%b %p<b>%s</b> <i>%a</i>"- show message body, progress bar value, subject and application name,
ignore_newline = true- collect multi-line messages in one line,
icon_position = right- show icon on the right,
min_icon_size = 16and
max_icon_size = 16- reduce icon size to fit.
Additionally I set up dunst daemon to show notification on startup with
--startup_notification ture flag
so that I know it is working.
Also I have tweaked timeout options:
timeout = 0- this will make the notifications to queue up until dismissed,
timeout = 4- only show dunst startup message briefly.
I have also configured sway to allow me to interact with notification using keyboard shortcuts:
bindsym $mod+period exec dunstctl history-pop- penguing + dot will pop up notification from history,
bindsym $mod+BackSpace exec dunstctl close- panguin + backspace will dismiss last notification.