Finally I solved problem myself.
I will leave instructions what I did.
The problem consists of two parts:
- Dbus cannot be accessed from within windows manager
- Notification daemon cannot get messages from dbus
1st problem solution:
Real problem was, that my windows manager was run from lxdm, which for some reason does not merges config files from /etc/X11/xinit/xinitrc.d
except for lxde session (in LXDE dbus works, in awesome wm doesn't). In this folder exists file named 30-dbus
with following content:
#!/bin/bash
# launches a session dbus instance
if [ -z "$DBUS_SESSION_BUS_ADDRESS" ] && type dbus-launch >/dev/null; then
eval $(dbus-launch --sh-syntax --exit-with-session)
fi
This part of the code defines $DBUS_SESSION_BUS_ADDRESS
variable which defines a dbus port to use for various applications. echo $DBUS_SESSION_BUS_ADDRESS
can be used as simple sanity check to see if dbus session exists (it should return dbus session file).
Config files from this folder can be merged with simple shell script on session start(code taken from .xinitrc
):
#!/bin/bash
if [ -d /etc/X11/xinit/xinitrc.d ]; then
for f in /etc/X11/xinit/xinitrc.d/*; do
[ -x "$f" ] && . "$f"
done
unset f
fi
2nd problem solution:
While dbus running and is available to other programs it still needs more access for notifications to work properly, so I needed to run polkit agent, because Awesome WM does not have one. I had chosen lxpolkit
, because I already had almost full lxde environment. In my case, just added to my ~/.config/awesome/rc.lua
file:
awful.util.spawn_with_shell("dex /etc/xdg/autostart/lxpolkit.desktop")
, for some reason without this line it refused to start by default with lxdm.
I think gnome polkit agent should work fine too.
Best Answer
You can send a message to all consoles with the command wall.
For sending notifications under X there is notify-send which sends a notification to the current user on the current display. (From your question, I guess you already know this one.) You can build upon this with some bash scripting. Basically you have to find out which users are on which X-Displays. Once you got this info you can use notify-send like this:
Where fschmitt is the user at display 0. You can parse the output of the "who" command to find all users and their displays. The output looks like this
You see, there are two users running X sessions, markmerk3 at display 0 and seamonkey at display 1. I think you need to grep for tty[0-9]* then assure that at the end of the line there is (:[0-9.]*) to get rid of console logins and extract the display id from the string between the parentheses.