Torsdag 21 oktober 2004 14:19 kvad Ti Kan:
Johnny Ernst Nielsen writes:
How do I get a GUI program (kdialog) to show on the X screen by a script in /etc/ppp/ip-up.d? It has to happen on the screen of whatever user is logged into KDE. ...
It is the kdialog command that will not work.
Both $USER and $DISPLAY are empty when the script is running, but all, except the call to kdialog, works as it is supposed to.
kdialog fails with this message: "kdialog: cannot connect to X server"
What you're trying to do is not quite right. The stuff that gets run in /etc/ppp/* (or for that matter, any of the rc or network startup/shutdown scripts) can happen without anyone even being logged in. A system may not even be running X at all... Their output can only be directed to the console which is the only "terminal" device that is guaranteed to be there, with or without a user actually logged in.
Are you saying that it is absolutely, totally, technically impossible to run a GUI application from the script the way I am trying to -- even if X IS up? On this computer, connection to the internet should not happen unless I specifically clicked the kinternet icon to make my modem dial out. As far as I understand, scripts in /etc/ppp/ip-up.d is run only when the IP comes up on a ppp connection being established, i.e. when the line is ready to transfer user information. Have I misunderstood that? If not, could you give an example of when the script in /etc/ppp/ ip-up.d would be run WITHOUT me first clicking the kinternet icon?
If you want to be informed of certain events in the system while you're logged in under KDE, the proper way to do it is to write a script or program to monitor for such an event in the background, which you start up during or after you log in. It will then have the proper output context (login name, terminal, $DISPLAY environment, permissions, etc) on which to produce output.
Event driven action was somewhat what I tried, through the use of / etc/ppp/ip.up.d. And it works, except for X. Do you have any other suggestions as to how I can make kdialog appear on the logged in user's screen when the ppp internet line is ready? Thank you for your effort. :o) Best regards Johnny :o)