Startup Script

Questions about applications and software
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
elmer624
Level 1
Level 1
Posts: 1
Joined: Tue Aug 16, 2022 8:36 pm

Startup Script

Post by elmer624 »

So, I usually do the same thing on startup:
1. Load email in workspace 1
2. Start Browser in workspace 2
3. Start an alternate browser in workspace 3
Is this something that can be automated with a script? I think it's a bit beyond the capabilities of "launcher."
Thanks.
Last edited by LockBot on Thu Feb 16, 2023 11:00 pm, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
mikeflan
Level 17
Level 17
Posts: 7155
Joined: Sun Apr 26, 2020 9:28 am
Location: Houston, TX

Re: Startup Script

Post by mikeflan »

Hi and welcome to the forum.
I think it's a bit beyond the capabilities of "launcher."
Probably not. Start with this and tell us where it goes wrong:
https://unix.stackexchange.com/question ... -workspace

Forget about devils pie for the moment and try wmctrl.
vanadium
Level 4
Level 4
Posts: 324
Joined: Sun Dec 27, 2015 1:07 pm

Re: Startup Script

Post by vanadium »

For single-time autostart on a specific workspace, use wmctrl indeed to first switch to the desktop where you want the application to appear (e.g. wmctrl -s 1 to switch to the second desktop (counting starts at 0), then launch the application. Launchers only support a single command. You can, however, use the construct "sh -c" to combine multiple commands in a launcher if you do not want to work with a separate script. The "Exec=" line thus could read something like

Code: Select all

Exec=sh -c "wmctrl -s 1 && firefox %u"
to start your browser on Workspace 2.

This will happen automatically after login if your launcher is located in ~/.config/autostart.

If you have multiple programs starting this way, it will be advised to load them all sequentially using a single script instead. That avoids that one launcher moves to workspace 1, while another one a split second later moves to workspace 2.

If you want this to happen anytime you launch the application, copy the systemwide launcher of the application to ~/.local/share/applications and edit the copy the same way. Then, each time you launch Firefox from the menu, it will automatically be placed in Workspace 2.

devilspie or devilspie2 comes in more handy when you want a certain type of window to be placed in a certain way anytime it is created.
mikeflan
Level 17
Level 17
Posts: 7155
Joined: Sun Apr 26, 2020 9:28 am
Location: Houston, TX

Re: Startup Script

Post by mikeflan »

Launchers only support a single command
But that single command can be a shell script, a Perl script, a python script, etc.
Locked

Return to “Software & Applications”