* 2026-03-05 20:41:00+0000, Darac Marjal wrote: > 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
Thank you! I knew that the systemd guys had all the basic pieces
together already. Now they only need to write the final pieces of the
new /usr/bin/wall-for-the-desktop-generation tool. I wrote my own in the
Fish shell:
#!/usr/bin/fish
set notify_program /usr/bin/fyi
set notify_args $argv
for session in (loginctl list-sessions --no-legend | cut -d' ' -f1)
set -l type (loginctl show-session $session -p Type --value)
if string match -qr '^(wayland|X11)$' $type
set -l user (loginctl show-session $session -p Name --value)
systemd-run --user -M $user@ -- $notify_program $notify_args
end
end
(Fish shell does not have sh-like word splitting so similar quoting is
not needed.)
--
/// Teemu Likonen - .-.. https://www.iki.fi/tlikonen/
// OpenPGP: DD3B8E8ABD28B98176E6A7CCCC9A5E615FCC1D93
/ old key: 6965F03973F0D4CA22B9410F0F2CAE0E07608462
signature.asc
Description: PGP signature

