Open applications in different workspaces in Gnome

fbiville picture fbiville · Jul 28, 2010 · Viewed 9.3k times · Source

Given I'm a lazy bastard, I tried to write a Bash script that opens at once some daily apps in different desktops. This script should work in Gnome. I've written that so far:

#!/bin/bash
firefox &
thunderbird &
/usr/bin/netbeans --locale en &
amsn &
gnome-terminal &
sleep 2
wmctrl -r firefox -t 0 && wmctrl -r netbeans -t 1 && wmctrl -r gnome-terminal -t 2 && wmctrl -r amsn -t 6 && wmctrl -r thunderbird -t 7

But, it doesn't work. My apps open, but they won't be assigned to the desktops I specify :(.

EDIT: I changed the value of sleep to 15... only firefox & netbeans are assigned correctly, the rest opens in the workspace where I execute the script from...

Answer

fbiville picture fbiville · Aug 31, 2015

Thanks to Akira comment, I finally succeeded at making it work (the script runs at startup like a charm) Here is the new code:

#!/bin/bash
wmctrl -n 8

firefox &
thunderbird &
/usr/bin/netbeans --locale en &
amsn &
gnome-terminal &
sleep 15

wmctrl -r firefox -t 0
wmctrl -r netbeans -t 1 
wmctrl -r terminal -t 2 
wmctrl -r amsn -t 6 
wmctrl -r thunderbird -t 7

#focus on terminal
wmctrl -a terminal