Discussion:
Displaying to a remote X session..
Nevyn
2010-10-10 15:02:45 UTC
Permalink
Hi,

I'm wondering if there's a way to run an application from a terminal
(or cron/at job) and have it able to throw up graphical prompts in the
X session. Has anyone done this?

Regards,
Nevyn.

_______________________________________________
NZLUG mailing list ***@linux.net.nz
http://www.linux.net.nz/cgi-bin/mailman/listinfo/nzlug
Nevyn
2010-10-10 15:09:55 UTC
Permalink
Post by Nevyn
Hi,
I'm wondering if there's a way to run an application from a terminal
(or cron/at job) and have it able to throw up graphical prompts in the
X session. Has anyone done this?
Regards,
Nevyn.
*grumble* Figured it out. A mere 6 minutes later :/

_______________________________________________
NZLUG mailing list ***@linux.net.nz
http://www.linux.net.nz/cgi-bin/mailman/listinfo/nzlug
Robin Sheat
2010-10-10 19:46:20 UTC
Permalink
Post by Nevyn
I'm wondering if there's a way to run an application from a terminal
(or cron/at job) and have it able to throw up graphical prompts in the
X session. Has anyone done this?
Well, you didn't say what your solution was, so for anyone else:

This is how things work if your terminal is inside X by default, and it does
this through the DISPLAY variable. Using this, X applications know what X
server to talk to. Typically, the DISPLAY variable is set to ':0' which makes
it talk to the default X server on localhost.

So, from a virtual terminal (i.e. the Alt-Ctrl-Fx ones), you can do:
$ DISPLAY=:0 gedit
and gedit will appear within the X session. This is useful to know if your
window manager crashes and won't come back for some reason, and you're stuck
without a terminal in the session.

With some magic (which is required for security reasons) you can also do
things like DISPLAY=otherhost:0. If you want that, read 'man xhost' first.

Robin.
Peter Lambrechtsen
2010-10-10 20:13:46 UTC
Permalink
Post by Robin Sheat
Post by Nevyn
I'm wondering if there's a way to run an application from a terminal
(or cron/at job) and have it able to throw up graphical prompts in the
X session. Has anyone done this?
This is how things work if your terminal is inside X by default, and it does
this through the DISPLAY variable. Using this, X applications know what X
server to talk to. Typically, the DISPLAY variable is set to ':0' which makes
it talk to the default X server on localhost.
$ DISPLAY=:0 gedit
and gedit will appear within the X session. This is useful to know if your
window manager crashes and won't come back for some reason, and you're stuck
without a terminal in the session.
With some magic (which is required for security reasons) you can also do
things like DISPLAY=otherhost:0. If you want that, read 'man xhost' first.
NoMachine / FreeNX, since you can run virtual terminals with GUI's in a
disconnected mode is brilliant for this sort of thing.
_______________________________________________
NZLUG mailing list ***@linux.net.nz
http://www.linux.net.nz/cgi-bin/mailman/listinfo/nzlug
Steve Holdoway
2010-10-10 20:48:59 UTC
Permalink
On Mon, 2010-10-11 at 09:13 +1300, Peter Lambrechtsen wrote:
[snip]

You need a minimum of xauth installed on the remote server, too.

Steve
--
Steve Holdoway BSc(Hons) MNZCS <***@greengecko.co.nz>
http://www.greengecko.co.nz
MSN: ***@greengecko.co.nz
Skype: sholdowa
Cliff Pratt
2010-10-12 09:54:23 UTC
Permalink
Post by Robin Sheat
$ DISPLAY=:0 gedit
and gedit will appear within the X session. This is useful to know if your
window manager crashes and won't come back for some reason, and you're stuck
without a terminal in the session.
Obviously 'gedit' stands in for any GUI tool, but what advantage is
there in a GUI tool if the WM crashes? Can't you restart the WM from the
console command line? (All this X stuff is still a mystery to me, I must
admit. I have a number of 'recipes' that I use, but deeper understanding
eludes me).

Cheers,

Cliff

_______________________________________________
NZLUG mailing list ***@linux.net.nz
http://www.linux.net.nz/cgi-bin/mailman/listinfo/nzlug
Robin Sheat
2010-10-12 10:28:40 UTC
Permalink
Post by Cliff Pratt
Obviously 'gedit' stands in for any GUI tool, but what advantage is
there in a GUI tool if the WM crashes? Can't you restart the WM from the
console command line?
You can restart the WM, yes. That was my point :) e.g.
$ DISPLAY=:0 metacity
and get X back to where you can fix whatever it was you were doing.

Robin.
Nevyn
2010-10-12 12:03:57 UTC
Permalink
Post by Robin Sheat
Post by Cliff Pratt
Obviously 'gedit' stands in for any GUI tool, but what advantage is
there in a GUI tool if the WM crashes? Can't you restart the WM from the
console command line?
You can restart the WM, yes. That was my point :) e.g.
$ DISPLAY=:0 metacity
and get X back to where you can fix whatever it was you were doing.
Robin.
My use case is a simple notification from a cron job. Kind of cool
being able to have something happen in the background and having it
tell you when it's done or ready for the next step. Zenity has become
my friend.

_______________________________________________
NZLUG mailing list ***@linux.net.nz
http://www.linux.net.nz/cgi-bin/mailman/listinfo/nzlug

Continue reading on narkive:
Loading...