Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Open applications in different workspaces in Gnome

Given my laziness, 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 :(.

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

like image 523
fbiville Avatar asked Jul 28 '10 08:07

fbiville


People also ask

How do you change workspaces in Gnome 40?

The new shortcut to switch workspace will be Super+Alt+←/→. Moving windows between workspaces will be Super+Alt+Shift+←/→. Super+Alt+↑ will also open the overview and then app grid, and Super+Alt+↓ will close them.

How do I add more workspaces in gnome?

To add workspaces to your desktop environment, right-click on Workspace Switcher , then choose Preferences. The Workspace Switcher Preferences dialog is displayed. Use the Number of workspaces spin box to specify the number of workspaces you require.

How do I move a window to a different workspace in Ubuntu?

Press Super + Shift + Page Up to move the window to a workspace left of the current workspace on the workspace selector. Press Super + Shift + Page Down to move the window to a workspace right of the current workspace on the workspace selector.


1 Answers

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 
like image 191
fbiville Avatar answered Oct 11 '22 14:10

fbiville