Torsdag 21 oktober 2004 15:50 kvad Anders Johansson:
On Thursday, 21 October 2004 15.44, Johnny Ernst Nielsen wrote:
Quite right -- it does not work for this situation, since it is not the las logged in user that runs the script.
It should work (if you put 'export' in front of DISPLAY and XAUTHORITY), I just tried it. It doesn't grab "the last logged in user", it grabs the last logged in user on :0
Try this
#!/bin/bash
USER=`/usr/bin/last :0|grep still|/usr/bin/awk '{print $1}'` export DISPLAY=:0.0 export XAUTHORITY=/home/$USER/.Xauthority
/opt/kde3/bin/kdialog --msgbox "this is a test"
I tried it and it works
It does not work here precisely the way you suggest. It says $HOME not set. However it works if construct and export a $HOME variable like this: export HOME=/home/$USER And then the kdialog pops up on the screen. :o)))) Thank you for your help Anders. :o) Best regards Johnny :o)