I use a laptop for a jukebox with wireless speakers on my patio.
I use two desktops. My desktops are simply named ‘one’ and ‘two’. I have Strawberry Music player set to start up when I boot up. The OS (Ubuntu Mate 24.04) always boot so desktop ‘one’, and so does Strawberry.
Is there a way to get Strawberry to start on Desktop ‘two’ on startup instead of desktop ‘one’?
No, that wouldn't work. The script can only be started after the user logged in, X has started and following that, the windowmanager.
So it can only be called from a .desktop file in $HOME/.config/autostart/
The mate-control-center -> Startup Applications GUI will create this file automagically for you
Please excuse my ignorance on this but here is what I did:
I installed sudo apt install wmctrl sucessfully.
then I used pluma to make a config file named <wmctrl -s1.config> and saved it in home>jim> .config
the files contains this:
#!/bin/bash
wmctrl -s1
strawberry &
wmctrl -s0
Strawberry did not start at all so I then went to system>preferences>personal>startup applications and made an entry for Strawberry and gave it a one second delay. It now starts but still on desktop one.
I am sure I am either missing something or don’t understand the instructions.
Tricky name. Best practice is to avoid dashes and spaces, otherwise you have to be constantly alert to quote the name accurately.
A descriptive name would probably better, also to avoid mistakes and such.
You better rename it to strawberry_2nd_workspace.sh or something like that.
Also, a better place to store the script (conforming to convention) is in /home/jim/.local/bin
This has also the benefit of not needing the complete path to call it.
The autostart entry should be then strawberry_2nd_workspace.sh
That is to be expected. You need to call the script, not strawberry directly.
The script is not a configfile. It is an executable program, albeit very short
By the way, you can test the script from terminal: strawberry_2nd_workspace.sh
jim@g-laptop:~$ mv /home/jim/.config/'wmctrl -s1.config' /home/jim/.local/bin/strawberry_2nd_workspace.sh
mv: cannot stat '/home/jim/.config/wmctrl -s1.config': No such file or directory
I am confused one command says:
chmod a+x /home/jim/.local/bin/strawberry_2nd_workspace.sh and directs to .bin
the other command says:
mv /home/jim/.config/'wmctrl -s1.config' /home/jim/.local/bin/strawberry_2nd_workspace.sh and directs it to .config before directing it to .bin
I did the following in my um24.04. My username is user
sudo apt install wmctrl strawberry
create a file, straw, in .local with contents wmctrl -s1; strawberry &
make that file exec, chmod +x /home/user/.local/straw
Went to Control Panel, Startup Apps, added "straw second window"
No , just undo everything and follow the instructions of @pavlos_kairis.
That will work too.
(what went wrong is that you mixed up the order of the instructions...long story.
Anyway, if all else fails, i can write an automatic install for that, if you like)
I made a file named straw and saved it to .local. It contained < wmctrl -s1; strawberry > I checked make executable and issued the command hmod +x /home/jim/.local/straw
On reboot, Strawberry did start on desktop two(2), but the OS also booted into desktop two (2)!
I was hoping the desktop would boot in to desktop one (1) and Strawberry into desktop two (2).
So I am back to where I started.
Maybe this just isn’t possible? If that is the case I am okay with it, as it will start and play when I boot up, I just have to click on the one (1) desktop which is still easier.
Thanks tkn and Pavlos for all the help. I learned some things, but doubt I will ever be writing scripts myself.
That got be back to both opening on desktop one. I put it back to both opening on desktop two and just hitting the panel to get back to desktop one. That works for me so I will mark it solved.
OS opened on desktop one (1) but strawberry failed to open. I named my desktops one and two and the OS shows one a 1 and two as 2 so I a guessing 0 is default for the OS to open (or my desktop one).
I tried putting the part of the command:
strawberry & ; wmctrl -s0
to strawberry & ; wmctrl -s2 but that made no difference either strawberry didn't
Sorry Eric but that put it back to opening on desktop two and strawberry not opening. I will just stick with Pavlos’ command. As long as strawberry opens on desktop two I am okay with going back to one for my main desktop. It might sound stupid but that is how I run all my other computers and to be different would be confusing at times.