mcollard
Posts: 3
Joined: Mon Jun 25, 2012 3:51 pm

How to launch programs on LXDE startup

Sun Jul 15, 2012 1:25 pm

Hello! I have a PI I'm using as a keyosk on my wall. I just want it to display a webpage.

How do I launch programs on LXDE startup?

I've tried the wiki page ( http://wiki.lxde.org/en/Autostart / https://wiki.archlinux.org/index.php/LX ... t_Programs ) without success.

I want it to launch midori.

I'm currently7 using the example, an autostart file in the auto start folder:

Code: Select all

[Desktop Entry]
Type=Application
Exec=wicd-client -n
Can anyone post a suggestion?

chris_c
Posts: 147
Joined: Sun May 06, 2012 10:23 am

Re: How to launch programs on LXDE startup

Mon Jul 16, 2012 12:44 pm

that exec line *might* need quotes I think it ignores everything after the first space if not quoted (I could be mixing this up with something else), but .desktop files *are* the way to go as multiple freedesktop compliant managers use this mechanism

oh and try the full path of the exe as shown by whereis

spottypaws
Posts: 3
Joined: Wed Jul 18, 2012 9:50 am

Re: How to launch programs on LXDE startup

Wed Jul 18, 2012 9:51 am

I would also really like to do this, and to set the browser automatically to fullscreen mode as it loads - is that possible please?

User avatar
AndrewS
Posts: 3625
Joined: Sun Apr 22, 2012 4:50 pm
Location: Cambridge, UK
Contact: Website

Re: How to launch programs on LXDE startup

Wed Jul 18, 2012 12:07 pm

spottypaws wrote:I would also really like to do this, and to set the browser automatically to fullscreen mode as it loads - is that possible please?
You'll need to experiment with the command-line options https://midori.jottit.com/terminal_options

Benonymous
Posts: 9
Joined: Wed Aug 22, 2012 5:48 am

Re: How to launch programs on LXDE startup

Wed Aug 22, 2012 6:31 am

Here's what worked for me. After much research and fiddling about.
Start up leafpad from a command window with

Code: Select all

sudo leafpad
Go to "File" "Open" and click on "File System" on the left hand pane.
Now in the right hand pane, navigate to: etc/xdg/lxsession/lxde and open the autostart file.

In the autostart file you'll find about four entries all preceded by the @ symbol. If you want to autostart Midori just add @midori on a new line. Save the file and exit out of leafpad. Restart your Pi and after the desktop appears, be patient, and Midori will start up on the last page visited or the homepage depending on your settings.
I used this to autostart the clock in gDesklets and Midori on a weather service page.

TfromNYC
Posts: 4
Joined: Mon Oct 29, 2012 2:12 am

Re: How to launch programs on LXDE startup

Tue Jan 15, 2013 3:38 pm

Worked for me! Thanks!
minor correction, the /LXDE/ should be caps.

I'm running a python script automatically upon start up with the line:

Code: Select all

@python mypython.py

pee
Posts: 4
Joined: Sun Jan 13, 2013 8:38 pm

Re: How to launch programs on LXDE startup

Tue Jan 15, 2013 4:37 pm

Hey, thanks TfromNYC and Benonymous! I'm a Pi newbie. I was so proud of myself after "discovering"
~/.config/autostart
that I posted about it, not realizing that most people looking to autostart something don't even want
the desktop. But a newbie like me is still very happy to have the desktop, and this
/etc/xdg/lxsession/LXDE/autostart
approach seems much handier than making launchers.

bleeper4
Posts: 8
Joined: Mon Dec 03, 2012 12:32 am

Re: How to launch programs on LXDE startup

Sat Jan 19, 2013 8:56 pm

I tried this and discovered that for some programs, it will start TWO instances of the program at startup. The reason I found out is because I'm autostarting qemu (which uses 100% CPU), and when I closed qemu, my Pi was still using 100% CPU. Let the user beware!

Can anyone suggest a workaround?

pee
Posts: 4
Joined: Sun Jan 13, 2013 8:38 pm

Re: How to launch programs on LXDE startup

Sat Jan 19, 2013 11:11 pm

Hi Bleeper. Any chance it's done once for root and then again for pi? If so, have you tried the other approach, ie. a launcher in /home/pi/.config/autostart? Presumably that would only be done for pi.

KenT
Posts: 758
Joined: Tue Jan 24, 2012 9:30 am
Location: Hertfordshire, UK
Contact: Website

Re: How to launch programs on LXDE startup

Sun Jan 20, 2013 12:14 am

This is what I do for a Python progrma; no need to edit a system file:

• Create the folder home/pi/.config/lxsession/LXDE

• In this folder put a file named autostart containing one line specifying the full path of the file to be executed:

e.g. python /home/pi/pipresents/pipresents.py <options>

• Make the autostart file executable by using the properties menu in the File Manager to alter the permissions on the file.
Pi Presents - A toolkit to produce multi-media interactive display applications for museums, visitor centres, and more
Download from http://pipresents.wordpress.com

windy54
Posts: 75
Joined: Sat Dec 29, 2012 3:37 pm

Re: How to launch programs on LXDE startup

Fri Jun 28, 2013 4:09 pm

This post is just what I am looking for.

I have got a program which works when I run it from a LXterminal window using the command
python wii_remote.py

I have followed the instructions, autostart is executable, nothing happens.

Normally the program will output some text to the window, do I need to do something else to open a window and then run the program?

As you can see from the title of the program I am trying to connect to a wii remote. The idea being to use a model A to control a robot from a wii remote . The model A does not detect my blue tooth adapter when fitted to a USB hub, I have just found out that my model B only detects the Bluetooth adapter when fitted to the USB on the PI , so I am wondering if this is my problem on the model A. Hence I need a python program to auto run because I will only be able to have the Bluetooth adapter fitted to the model A.

zx5000
Posts: 5
Joined: Sun Jul 28, 2013 1:24 pm

Re: How to launch programs on LXDE startup

Sun Jul 28, 2013 1:29 pm

placing a .desktop in the ~/.config/autostart folder does work. Here's what I did to make it work.

1. Create the autostart folder ( mkdir .config/autostart)
2. Create the desktop as above
3. Make it executable (chmod 755 .config/autostart/my_command.desktop

Reboot and be happy.

I used this to broadcast the PI's IP address multicast so I can find it when I DHCP on a different network.

budi
Posts: 19
Joined: Sat Nov 09, 2013 3:36 am

Re: How to launch programs on LXDE startup

Sat Nov 09, 2013 3:55 am

i have try it, but not work,i want run c++ program automatic
.please give me a tutorial for dummie, please :cry:

KenT
Posts: 758
Joined: Tue Jan 24, 2012 9:30 am
Location: Hertfordshire, UK
Contact: Website

Re: How to launch programs on LXDE startup

Sat Nov 09, 2013 8:38 am

When using my autostart method or using sudo I had trouble with file references. Make sure you use full path references if you are accessing files in the program. What is worse there is no lxterminal window to report the errors.

Please refer to the method I described a few messages above

If you do . autostart from a lxterminal open in its directory you can see any debug messages that python produces.
Pi Presents - A toolkit to produce multi-media interactive display applications for museums, visitor centres, and more
Download from http://pipresents.wordpress.com

Lgmaia
Posts: 1
Joined: Wed Jun 04, 2014 3:43 pm

Re: How to launch programs on LXDE startup

Wed Jun 04, 2014 3:51 pm

Hi,

The way that I found to run a python script during the LXDE startup is editing the autostart file in the LXDE directory.

~/etc/xdg/lxsession/LXDE

In the autostart file you will find four lines starting with @, add a new line and type @python "full path for the python script" ( don't use the quotes).

I hope that it help.

mob-i-l
Posts: 210
Joined: Sat Dec 29, 2012 2:45 am
Location: Lund, Skåne/Scania, Sweden
Contact: Website Facebook Google+ Twitter YouTube

Re: How to launch programs on LXDE startup

Wed Feb 18, 2015 9:28 am

TfromNYC wrote:Worked for me! Thanks!
minor correction, the /LXDE/ should be caps.
In the latest Raspbian it should be /LXDE-pi/.
Raspberry Pi0&1A&1B2&1B+&2B&3B w/ Raspbian. Started w/ BASIC on ABC80&ZX81 then Forth, Z80… https://scratch.mit.edu/users/mobluse/ https://github.com/mobluse/ https://twitter.com/mobluse/ https://YouTube.com/MOBiL4u/

DeZ
Posts: 1
Joined: Wed Dec 16, 2015 4:18 pm

Re: How to launch programs on LXDE startup

Wed Dec 16, 2015 4:40 pm

Hello

I want to launch Citrix Receiver with ica file configuration but it doesn't work

I use PI2 RASPBIAN Jessie with autologin in desktop with pi user

I create shell file to launch my citrix program and write the command into autostart , see beelow that i do :

Code: Select all

[email protected]:~ $ pwd
/home/pi

[email protected]:~ $ cat ica.sh
/opt/Citrix/ICAClient/wfica.sh /home/pi/Downloads/SCWNCIT013.ica

[email protected]:~ $ cat /etc/xdg/lxsession/LXDE-pi/autostart
@lxpanel --profile LXDE-pi
@pcmanfm --desktop --profile LXDE-pi
@lxterminal -e /home/pi/ica.sh
@xscreensaver -no-splash
@xset s off
@xset -dpms
@xset s noblank

Nick_Bot4853
Posts: 1
Joined: Fri Dec 23, 2016 3:38 pm
Location: UK
Contact: Website

Re: How to launch programs on LXDE startup

Fri Dec 23, 2016 3:43 pm

I would like to know how to run a script on shutdown of the Pi. I have the wake up script working because of this post now I want to run a goodbye script because I am using my Pi as a twitter bot and I would like to notify my followers of shutdown automatically instead of manually. If you could help that would be fantastic.

https://twitter.com/Ninja_Bot4853


Return to “Beginners”

Who is online

Users browsing this forum: Baidu [Spider] and 18 guests