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

Autostart app to given desktop

Tue Mar 14, 2017 8:31 am

From other forums:
To run at startup try putting the relevant command in ~/.config/lxsession/LXDE-pi/autostart
This works fine (@xastir), but just starts displayed on desktop 1. How can I get it to start on desktop 4 (or other)? Something like "@4xastir" ? Or let's say you name all your virtual-desktops (VDs). If you want several apps to start in a given named desktop, could it be something like:"@<VDname>.<app-cmd>"?
I'm reasonably experienced in Linux (Mandrake/Mandriva, Kubuntu), but this is beyond my 'paygrade' :)

ktb
Posts: 1447
Joined: Fri Dec 26, 2014 7:53 pm

Re: Autostart app to given desktop

Tue Mar 14, 2017 5:07 pm

Something like the following using xdotool might work for you.

Create a script such as /usr/local/bin/startxastir:

Code: Select all

#!/bin/sh
# Run Xastir, wait 5 seconds and then move it to desktop 4
/usr/bin/xastir &
sleep 5
xdotool search --desktop 0 --classname "Xastir" set_desktop_for_window 3
exit 0
Don't forget to make it executable^.

~/.config/lxsession/LXDE-pi/autostart:

Code: Select all

@lxpanel --profile LXDE-pi
@pcmanfm --desktop --profile LXDE-pi
@xscreensaver -no-splash
@point-rpi
@startxastir

Return to “Advanced users”