The ArchWiki (https://wiki.archlinux.org/title/Desktop_notifications#Send_notifications_to_all_graphical_users) offers this snippet:

  # for id in $(loginctl list-sessions -j | jq -r '.[] | .session') ; do
      if [[ $(loginctl show-session $id --property=Type) =~ (wayland|x11) ]] ; 
then
          systemd-run --machine=$(loginctl show-session $id --property=Name 
--value)@.host --user \
          notify-send 'Hello world!' 'This is an example notification.'
      fi
  done

On 02/03/2026 07:46, Teemu Likonen wrote:
I have a systemd timer and service that runs my backup script daily. The
script runs on root privileges.

If the backup script notices an error I would like to report the error
as a notification in normal user's desktop. In the past this worked with
"wall" command in the backup script:

     wall "The backup failed. See the journal for more info."

KDE Plasma desktop has a background service which delivers "wall"
messages as desktop notifications. This doesn't work anymore. "wall"
messages doesn't show in desktop even though the background service is
running.

I don't know when it stopped working but my first guess is that some of
those features have not been ported to Wayland yet. I switched from X11
to Wayland a couple of months ago (and it's great; I'm not going back).
I also upgraded from Debian 12 to 13 last summer.

So, the general question is: how could a background root script give a
desktop notification for the current / all users?

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

Reply via email to