Application starts in the wrong Xwindow session


4 posts
by ajgiampa » Mon Jul 08, 2013 2:15 am
I setup the raspberry pi to automatically load the GUI after bootup. I did this by adding "startx" to the /etc/rc.local file. I then created an autostart file in ~/.config/autostart to run a slideshow script. Everything works great, except the slideshow doesn't appear on the monitor I have hooked up to the Raspberry Pi. I only see it when I log into the Pi via TightVNCViewer on display :1. Why is it defaulting to this display instance and not the monitor, which I assume is display :0?

Thanks...
Posts: 4
Joined: Fri Jun 07, 2013 2:32 pm
by Davespice » Mon Jul 08, 2013 10:48 am
I was just wondering, do you also automatically start a vnc server on this Pi at boot time?
If so you might find it’ll work as expected if you don’t start the vnc server until after you’ve started your slide show process.
User avatar
Raspberry Pi Foundation Employee & Forum Moderator
Raspberry Pi Foundation Employee & Forum Moderator
Posts: 1458
Joined: Fri Oct 14, 2011 8:06 pm
Location: London, United Kingdom
by topguy » Mon Jul 08, 2013 11:04 am
The script that starts your slideshow should explicitly set the DISPLAY variable to the correct screen before starting the slideshow.

Code: Select all
export DISPLAY=:0.0
User avatar
Posts: 693
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway
by jojopi » Mon Jul 08, 2013 11:12 am
ajgiampa wrote:I did this by adding "startx" to the /etc/rc.local file.
That is running startx as root, which is already a bad idea, and it is no surprise that it ignores /home/pi/.config. Putting long-running jobs in rc.local also delays the boot sequence, which may prevent text-mode logins (getty) from starting.

The correct way to start a GUI at boot time is to enable a display manager. In the Foundation's Raspbian images, raspi-config has an option to do this.
User avatar
Posts: 2122
Joined: Tue Oct 11, 2011 8:38 pm