[wplug] Creating an xmessage box from a hotplug script

Jonathan Billings billings at negate.org
Fri Feb 24 16:37:59 EST 2006


On Feb 24, 2006, at 2:04 PM, Brandon Kuczenski wrote:

> I have a script that runs upon detecting certain hotplug events.  
> Naturally, it runs as root.  I would like this script to generate a  
> user-input window using xmessage on the "currently active" X  
> display, if such a thing is possible.  I sense, however, that a  
> solution to this problem would be fraught with difficulty.
>
> I know that if I "su -", then root cannot talk to my display, but  
> if I simply "su", then it can.  I guess this has something to do  
> with the environment variables that the X user has defined.  But  
> how could a process like this determine which user is even logged  
> in and active, much less gain access to his/her environment variables?

It's not an issue of what user you are, but what the $DISPLAY  
variable is set to. (Although you can often override that with a - 
display flag.)  You might also need to import the Xauth from whatever  
user is running X.

This might be simpler done by having some client/daemon talk to each  
other, maybe through a UNIX socket or even as simple as a log file.

--
Jonathan Billings <billings at negate.org>




More information about the wplug mailing list