Start applications after login, specific order

The standard session manager used by LXDE - http://wiki.lxde.org/en/LXSession
Locked
zateno
Posts: 5
Joined: Fri Feb 17, 2017 9:42 am

Start applications after login, specific order

Post by zateno »

/home/user/panelapps.desktop

Code: Select all

[Desktop Entry]
Name=After boot minimized panel apps
Exec=panelapps.sh
Terminal=false
Type=Application
/usr/local/bin/panelapps.sh

Code: Select all

#!/bin/bash

# for double ampersands (or double semicolons)
# process starts after the one from behind stopped 
firefox &
sleep 8 &&
xterm -iconic -e "su root localrc; bash" &
sleep 13 &&
xterm -iconic -e "cd /usr/share/man; bash" &
sleep 17 &&
xdotool key Super_L+d
After boot and log in I want Firefox, XTerm localrc and XTerm /usr/share/man to be minimized in the LXPanel in this speficific order, from left to the right. If I start the computer they appear but not in this order. But if I simply restart LXSession using terminal ("lxsession" command) after the LXDM, boooom, they appear in the wanted order.

This could be a bug or my script needs some adjusting? I think it can be done using autostart specifications desktop files but I'm stubborn and I want use this particular method.
seppalta
Posts: 449
Joined: Tue Sep 20, 2011 6:09 am
Location: USA
Contact:

Re: Start applications after login, specific order

Post by seppalta »

I would just add the following to the openbox autostart file (or the similar items to the lxde autostart file if you are using the full lxde desktop):

Code: Select all

firefox &
(sleep 8 && xterm -iconic -e "su root localrc; bash") &
(sleep 13 && xterm -iconic -e "cd /usr/share/man; bash") &
zateno
Posts: 5
Joined: Fri Feb 17, 2017 9:42 am

Re: Start applications after login, specific order

Post by zateno »

I replaced the /usr/local/bin/panelapps.sh content with yours and now the order actually is XTerm localrc, Firefox and XTerm /usr/share/man.
I use all the LXDE components (except LXMusic and LXTerminal).
seppalta
Posts: 449
Joined: Tue Sep 20, 2011 6:09 am
Location: USA
Contact:

Re: Start applications after login, specific order

Post by seppalta »

Firefox is relatively heavy and slow, especially on old hardware. My guess is it takes longer than 8 seconds to load ( but less than 13), and so it is placing second in your ordering. Try your script with sleep 14 and sleep 19.

Why do you complicate the set-up with the shell script when you should be able to achieve the same end by just entering the same commands in your relevant autostart file, which I would guess is in /etc/xdg/lxsession/LXDE/autostart, and it is a text file, not a desktop folder file? I say "guess" here because I am relying upon memory. I do not use a complete LXDE desktop anymore, because it is so much simpler and easier to just configure the complete desktop around Openbox, Pcmanfm and Fbpanels. For example, in the latter case there are only 2 relevant autostart files: User: ~/.config/openbox/autostart and Global: /etc/xdg/openbox/autostart, both text files and easy to edit. With lxsession installed, I recall that there can be as many as 5, and the 2 openbox autostarts are irrelevant.
zateno
Posts: 5
Joined: Fri Feb 17, 2017 9:42 am

Re: Start applications after login, specific order

Post by zateno »

You were right, actually Firefox hangs out a lot before it shows...
So what would be the commands format to achieve the same end by just using the autostart file and no additional script?

This doesn't work! Firefox actually starts with an opened "http://www.&.com/" tab and that's all.
/home/user/.config/lxsession/LXDE/autostart

Code: Select all

@lxpanel --profile LXDE
@pcmanfm --desktop --profile LXDE
@xscreensaver -no-splash
cbatticon
xbindkeys
firefox &
(sleep 14 && xterm -iconic -e "su root localrc; bash") &
(sleep 19 && xterm -iconic -e "cd /usr/share/man; bash") &
(sleep 22 && xterm -e "xdotool key Super_L+d")
This doesn't work either! Nothing shows.
/home/user/.config/lxsession/LXDE/autostart

Code: Select all

@lxpanel --profile LXDE
@pcmanfm --desktop --profile LXDE
@xscreensaver -no-splash
cbatticon
xbindkeys
(firefox &
(sleep 14 && xterm -iconic -e "su root localrc; bash") &
(sleep 19 && xterm -iconic -e "cd /usr/share/man; bash") &
(sleep 22 && xterm -e "xdotool key Super_L+d"))
Yep, the long-way script method actually works...
/home/user/.config/LXDE/autostart

Code: Select all

@lxpanel --profile LXDE
@pcmanfm --desktop --profile LXDE
@xscreensaver -no-splash
cbatticon
xbindkeys
panelapps.sh
/usr/local/bin/panelapps.sh

Code: Select all

#!/bin/bash

# for double ampersands (or double semicolons)
# process starts after the one from behind stopped 
firefox &
(sleep 14 && xterm -iconic -e "su root localrc; bash") &
(sleep 19 && xterm -iconic -e "cd /usr/share/man; bash") &
(sleep 22 && xterm -e "xdotool key Super_L+d")
seppalta
Posts: 449
Joined: Tue Sep 20, 2011 6:09 am
Location: USA
Contact:

Re: Start applications after login, specific order

Post by seppalta »

For one thing, you have errors in your autostart files. Each entry should be preceded by @ and no & at the end. The following is correct:

Code: Select all

@cbatticon
@xbindkeys
@firefox
@(sleep 14 && xterm -iconic -e "su root localrc; bash") 
@(sleep 19 && xterm -iconic -e "cd /usr/share/man; bash")
@(sleep 22 && xterm -e "xdotool key Super_L+d")
Also, "@firefox" says to launch firefox, nothing about it being iconic.
zateno
Posts: 5
Joined: Fri Feb 17, 2017 9:42 am

Re: Start applications after login, specific order

Post by zateno »

The code you provided actually starts just Firefox and not the XTerms too.
Reading furthermore on the wikis...

Code: Select all

Notice that lines are split on space characters, but no form of escaping or quoting is supported, nor are multi-line commands. So if you need, e.g., a command with a space in one of its arguments, put it in a shell script and invoke the shell script from the autostart file.
Still wondering, this actually can be done whithout the shell script?
seppalta
Posts: 449
Joined: Tue Sep 20, 2011 6:09 am
Location: USA
Contact:

Re: Start applications after login, specific order

Post by seppalta »

At this time I have no laptop with lxde desktop - everything is built directly from openbox (no lxsession installed). Therefore, I can only test your autostart items in the openbox autostart files, which are the relevant ones in my set-up. These are ~/.config/openbox/autostart and /etc/xdg/openbox/autostart, which are also in every lxde desktop, but not used. Your items are launched in the stated order when the following is put into either openbox autostart:

Code: Select all

(sleep 2 && xterm -iconic -e "su root localrc; bash") &
(sleep 4 && xterm -iconic -e "cd /usr/share/man; bash") &
(sleep 6 && xterm -e "xdotool key Super+t") &
I used "Super+t" because "Super_L+ d" is not bound in my systems.

I do not know why they are not launched correctly when you put them into the LXDE autostart, unless you are not using the correct format, which is different from the openbox format above.
zateno
Posts: 5
Joined: Fri Feb 17, 2017 9:42 am

Re: Start applications after login, specific order

Post by zateno »

I think it can be done moving the autostart LXDE file content to Openbox's autostart file to keep them both but hell no, I'm keeping me steady and stormless until the permanent port to QT (then heavyhearted I'll drop completely the LXDE).
So until then I'll run it gangsta using the fruitless script shell method... :D
Thank you for your answers!
seppalta
Posts: 449
Joined: Tue Sep 20, 2011 6:09 am
Location: USA
Contact:

Re: Start applications after login, specific order

Post by seppalta »

I'm keeping me steady and stormless until the permanent port to QT (then heavyhearted I'll drop completely the LXDE).
LXDE is built from a few key components. Why not keep those you like and build on them. That is what I do. Install a basic openbox distro, configure and add applications. A simple excellent Ubuntu-based one (a light Lubuntu) is Icebox (https://unit193.net/icebox/ and http://lxlinux.com/icebox.html). A great Debian-based one is SparkyLinux MinimalGUI - No Codecs (https://sparkylinux.org/download/ and http://lxlinux.com/).
Locked