1
I need to show notification messages to different users as root on a Debian system running KDE with a bash or python script. What I tried so far are:
export DISPLAY=:X (X symbolizes the remote host data)
export XAUTHORITY=~$USERNAME/.Xauthority
zenity --warning --title $TITLE --text " $TEXT
These commands do what I want, but just through terminal. When I try to use them in a Python script (using os.system() or subprocess.call()) or try to run through a shell script; it fails (Usually showing notification to the user that I logged in, not to the target user. Also sometimes leads to the errors:
Could not open X display
No protocol specified
Gtk-WARNING **: cannot open display: :X.
XDG_RUNTIME_DIR not set in the environment.
But also, it rarely shows the notification to the correct user. Therefore I could not understand the way it behaves.)
I also read that zenity is not good for KDE, rather kdialog is preferred.
kdialog --title "some title" --passivepopup "some text" 5 & (number for the time-out)
Using the above command with gksu and su, there is no success again. I also tried with pynotify. I guess the problem is not about the way I create the notification message but showing to the user, more directly, connecting to the X Server or transfering user specific X Server settings.
I need help at this point; any suggestion is appreciated.