Fester Bestertester
Posts: 39
Joined: Wed Sep 25, 2013 9:04 pm

Auto-Startup program(s) at boot - on # Virtual Desktop

Tue Feb 27, 2018 4:00 am

I use my Pi3 as a 24/7 beacon to the Amateur Radio APRS system (look that one up!), and would like to have it auto-start the program xastir on Virtual Desktop #4 at boot so I don't have to do a daily check. The command is in the Path (at /usr/bin) so I envisage a script such as:
xastir & :4
with the :4 denoting the destination desktop number. Is such possible? and if so, how/where to invoke it?

Cheers
FBt

klricks
Posts: 7154
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: Auto-Startup program(s) at boot - on # Virtual Desktop

Tue Feb 27, 2018 6:43 am

Fester Bestertester wrote:
Tue Feb 27, 2018 4:00 am
I use my Pi3 as a 24/7 beacon to the Amateur Radio APRS system (look that one up!), and would like to have it auto-start the program xastir on Virtual Desktop #4 at boot so I don't have to do a daily check. The command is in the Path (at /usr/bin) so I envisage a script such as:
xastir & :4
with the :4 denoting the destination desktop number. Is such possible? and if so, how/where to invoke it?

Cheers
FBt
As always do update before attempting to install anything:

Code: Select all

sudo apt update
If you haven't already then install openbox config then configure as many desktops as you need.

Code: Select all

sudo apt install obconf
Now install wmctrl

Code: Select all

sudo apt install wmctrl
Make a file like this:

Code: Select all

nano /home/pi/switcher

Code: Select all

sleep 1
wmctrl -s 3
sleep 1
pcmanfm 
sleep 1
wmctrl -s 0
The above example will start filemanager on desktop 3 then switch back to desktop 0
Note Desktops are numbered 0 1 2 3.....
You may need to adjust the sleep times if the programs starts on the wrong desktop.
You can run this from the comand line to test:

Code: Select all

bash /home/pi/switcher
Edit autostart

Code: Select all

nano /home/pi/.config/lxsession/LXDE-pi/autostart
Add this to the end of what's there:

Code: Select all

@bash /home/pi/switcher
I tested with logout and back in and it works as written above. As mentioned sleep timers may need to be adjusted if reboot or full power on does not work correctly.
Unless specified otherwise my response is based on the latest and fully updated RPiOS Buster w/ Desktop OS.

User avatar
scruss
Posts: 3218
Joined: Sat Jun 09, 2012 12:25 pm
Location: Toronto, ON
Contact: Website

Re: Auto-Startup program(s) at boot - on # Virtual Desktop

Sat Nov 16, 2019 11:57 pm

‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.
Pronouns: he/him

Return to “Advanced users”