dbus hangups (notifications timeout with Slackware and dwm)

Page created: 2023-07-18

Back to my Slackware pages. Perhaps you’ve experienced this:

Perhaps you’re waiting for your applications to send notifications.

For me, the solution was to have my .xinitrc run xfce4-notifyd on X11 start. See "Solution" below.

Test the problem

Thankfully, there’s a command line utility called notify-send that simply sends notifications.

$ time notify-send 'test'

real	0m50.058s
user	0m0.005s
sys	0m0.003s

It takes a full 50 seconds to timeout and I don’t see a notification.

dbus-launch

A utility called dbus-launch is supposed to setup an environment for applications wanting to use dbus. I’ll try that:

$ time dbus-launch notify-send 'test'

real	0m50.063s
user	0m0.004s
sys	0m0.007s

But that didn’t help either.

Furthermore, changing my ~/.xinitrc so that it launched my window manager, dwm, via dbus-launch didn’t help:

#exec /usr/bin/dwm
exec dbus-launch --exit-with-session /usr/bin/dwm

Solution: Run a notification service!

Then I found this: Network Manager ignores mouse clicks (2021) (linuxquestions.org).

Turns out, you need a notification daemon to receive these messages. Slackware comes with Xfce, and Xfce provides xfce4-notifyd:

Sure enough, this worked right away and I saw the "test" text in a notification in the upper right corner of my screen immediately:

$ /usr/lib64/xfce4/notifyd/xfce4-notifyd &
$ time notify-send 'test'

So the solution was to add the daemon line to ~/.xinitrc:

/usr/lib64/xfce4/notifyd/xfce4-notifyd &
exec /usr/bin/dwm

Sure enough, Ksnip started up immediately and Thunderbird no longer hangs when the first new message comes in and the notification displays.

The only thing I’m left wondering is why and how messages eventually would show up from Thunderbird and other applications after the long delay. There must have been some fallback method?