Launching apps remotely


17 posts
by Newt_Othis » Tue Jun 19, 2012 12:41 pm
This is a fairly nooby question.

If I SSH into the RasPi (connected to the TV) from my laptop, can I launch a process so that it's visible on the TV?

For example, can I launch the excellent omxplayer to play a video on the TV, by issuing a command from the laptop via SSH?

BTW - I've been using Ubuntu on my laptop for ages, but am a complete novice at using Linux over a network.
User avatar
Posts: 20
Joined: Tue Dec 06, 2011 1:12 pm
by godFather89 » Tue Jun 19, 2012 12:43 pm
Yes you can. Actually everything you start that is not designed to run in the console will start on the real screen.
Posts: 150
Joined: Fri May 18, 2012 9:40 am
Location: Timisoara, RO
by grumpyoldgit » Tue Jun 19, 2012 12:47 pm
I have found that the easiest way to have a remote desktop is to install tight vnc server on the Pi.

Code: Select all
sudo apt-get install tightvncserver


So ....

You would sit at your laptop
ssh into your Pi
Run tightvncserver on your pi.

Then run VNC client on your laptop and attach to the Pi.

I'm actually sat here having just done that with the new Debian install.
User avatar
Posts: 1454
Joined: Thu Jan 05, 2012 12:20 pm
by rurwin » Tue Jun 19, 2012 12:57 pm
If you are just running SSH, ie a terminal session, then any graphical programs you run will be displayed on the TV. If you run an X server on your laptop, like Ximg, then starting graphical programs will make them come up on the laptop. You can change that by passing the --display flag to the command.

Code: Select all
$ xeyes --display :0
User avatar
Forum Moderator
Forum Moderator
Posts: 2904
Joined: Mon Jan 09, 2012 3:16 pm
by Newt_Othis » Tue Jun 19, 2012 1:01 pm
Thanks, as soon as I get the wireless working I'll try it out ;)
User avatar
Posts: 20
Joined: Tue Dec 06, 2011 1:12 pm
by jojopi » Tue Jun 19, 2012 2:25 pm
rurwin wrote:$ xeyes --display :0
It is actually "xeyes -display :0", or "DISPLAY=:0 xeyes". X predates the GNU double-minus option style.
User avatar
Posts: 2040
Joined: Tue Oct 11, 2011 8:38 pm
by TrevorAppleton » Thu Jun 21, 2012 7:50 am
I can VNC into my Raspberry Pi from my laptop. However the screen connected to the Raspberry Pi is not the same as on my laptop.My laptop is not controlling the screen connected to the Raspberry Pi but another instance of a desktop. Any ideas what I am doing wrong?
Check out my blog post for Raspberry Pi and Python tutorials.

http://trevorappleton.blogspot.co.uk/
Posts: 61
Joined: Wed May 30, 2012 7:26 pm
by Newt_Othis » Thu Jun 21, 2012 8:29 am
TrevorAppleton wrote:I can VNC into my Raspberry Pi from my laptop. However the screen connected to the Raspberry Pi is not the same as on my laptop.My laptop is not controlling the screen connected to the Raspberry Pi but another instance of a desktop. Any ideas what I am doing wrong?


I could be wrong, but I think that if you launch the VNC session from the CLI, it creates a virtual session of X that is different from the one running locally.

Again, I could be wrong, but I'd try launching VNC from the X session itself to share that screen.

I haven't quite got the wireless network running yet, so I can't test it.
User avatar
Posts: 20
Joined: Tue Dec 06, 2011 1:12 pm
by TrevorAppleton » Fri Jun 22, 2012 10:54 am
Thanks for the reply.

I currently start VNCserver from the terminal as I SSH into the raspberry PI. When you say I should start it from X session do you mean from the session running on the raspberry pi rather than from the terminal I ssh into? So to do this I would need to hook a keyboard up to the raspberry pi I guess? I cannot SSH in to sort this out? Would I then need to start the VNCserver from the raspberry pi each time, or can this be set up to start automatically?
Check out my blog post for Raspberry Pi and Python tutorials.

http://trevorappleton.blogspot.co.uk/
Posts: 61
Joined: Wed May 30, 2012 7:26 pm
by AndrewS » Fri Jun 22, 2012 11:03 am
I had a quick google, and it seems that http://www.karlrunge.com/x11vnc/ might be what you're looking for :?:
User avatar
Posts: 3590
Joined: Sun Apr 22, 2012 4:50 pm
Location: Cambridge, UK
by Newt_Othis » Fri Jun 22, 2012 11:11 am
AndrewS wrote:I had a quick google, and it seems that http://www.karlrunge.com/x11vnc/ might be what you're looking for :?:


That explains the behaviour of the 'regular' VNC nicely, thanks. ie VNC creates a 'virtual' instance of the GUI that is separate from what is seen locally.

I've only used VNC on Windows machines previously so the behaviour is subtly different.
User avatar
Posts: 20
Joined: Tue Dec 06, 2011 1:12 pm
by rurwin » Sat Jun 23, 2012 7:02 am
It would be better (for some meanings of "better") to run an X server on the other PC.

If you use VNC then the RaspPi has to run not only the X server but also the VNC server. Both of those are very hungry.

If you run an X server on your PC, then the RaspPi does not run either of them, just the application.
User avatar
Forum Moderator
Forum Moderator
Posts: 2904
Joined: Mon Jan 09, 2012 3:16 pm
by Newt_Othis » Sat Jun 23, 2012 9:01 am
@rurwin - I'm not really sure what you mean by running an X Server on the PC.

Google will be my friend on this one...

BTW - Have you seen today's Google Doodle? Simply brilliant.
User avatar
Posts: 20
Joined: Tue Dec 06, 2011 1:12 pm
by geep999 » Sat Jun 23, 2012 9:45 am
I used the instructions here:
http://www.caslab.queensu.ca/LabHelp/XServer/
and downloaded the referenced Xserver and Putty onto Vista (32bit).
VMware Player on Slackware host with Win Vista guest running an X server showing R-Pi running ARMedSlack forwarding X11 of xfce session:
Image

Cheers,
Peter
User avatar
Posts: 28
Joined: Fri May 18, 2012 10:20 pm
Location: East Herts, UK
by AndrewS » Sun Jun 24, 2012 11:17 am
geep999 wrote:VMware Player on Slackware host with Win Vista guest running an X server showing R-Pi running ARMedSlack forwarding X11 of xfce session:
Image

:shock: You do realise that Slackware also comes with an X-server, right?! So there's no need for VMware and Vista in the middle of that "stack".
Unless you're being deliberately obtuse, of course ;)
User avatar
Posts: 3590
Joined: Sun Apr 22, 2012 4:50 pm
Location: Cambridge, UK
by rurwin » Sun Jun 24, 2012 10:40 pm
Newt_Othis wrote:@rurwin - I'm not really sure what you mean by running an X Server on the PC.

X is a windowing system that runs in user-space. It is not tied to Linux. The server receives commands on a network connection. Most of the time we use it, the client program is on the same machine as the X server, but it doesn't have to be.

So if you run an X server on your windows PC, then the client program can be on the RaspPi. X does not have to run on the RaspPi and you do not need VNC, nor a Linux VM. Just an X server ported to Windows. Then any of the programs that run on the RaspPi will work perfectly with their display on the Windows PC.

All you need to do is to have an SSH terminal session and set up the DISPLAY environment variable to point to your Windows PC, but Xming linked to above has tools that do that automatically. You can have the RaspPi desktop in a Windows window, or have each RaspPi window open independently on the Windows desktop.

Just one Windows application to install; easy as Pi ;-)

geep999 has it right; Windows Vista acting as an X display for the RaspPi. It's just that Windows Vista happens to be a VM on a Linux box; those of us running Linux tend not have real Windows PCs handy. I've got an old Windows 2000 laptop around here, I'll see if I can set it up tomorrow and write a howto.

@AndrewS, geep999 is showing how it works with a Windows PC. Yes he could do it directly on Slackware, but that's not the point we are trying to demonstrate.
User avatar
Forum Moderator
Forum Moderator
Posts: 2904
Joined: Mon Jan 09, 2012 3:16 pm
by geep999 » Tue Jun 26, 2012 10:23 pm
AndrewS wrote:Unless you're being deliberately obtuse, of course ;)
I was just playing around to see what's possible, and thought it made a nice screenshot. :)
Cheers,
Peter
User avatar
Posts: 28
Joined: Fri May 18, 2012 10:20 pm
Location: East Herts, UK