How to start an application on a different workspace?

Check out Devil's Pie (although i am not sure it would work with Gnome3), and you can find more useful information on stackoverflow bash.

Basically you should do the following:

#!/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 

(i have just copy & pase the above code from the StackOverFlow link above, since i think it is self explanatory).

UPDATE:

See here for an easier solution at the best site for Gnome 3 extensions, you should install the Auto Move Windows extension for Gnome 3. In case it isn't working for you (as you can see at the link there are some distros that the automation of the installation isn't working right, get a more detailed exploitations here on how to get it work.


Original post was regarding using a script to make an application appear on a particular workspace, such that another script might be used in Start Up script to allow a user to continue working while a very slow starting application loaded on another workspace. My script works great as front-end for the rather cumbersome wmctrl syntax, to launch any one application on any given workspace, from any command prompt. Thus a further script that simply lists something like, lh 1 thunderbird; lh 2 firefox; lh 3 calculator...., or whatever, is now easy. There are however some difficulties with timing, thus the sleep in my script. The below is the updated version, which I will not be maintaining or post again. Use AS IS, no guarantee of fitfulness for any particular use. Modify as you please. I suggest saving as /usr/local/bin/lh, simply because lh is not any other known program name, at least not on Mint 18. As for variables—I quoted variables I deemed necessary to be quoted.

#!/bin/sh
## Author: B.A. Computer Services www.ba-computer.com
## Purpose: Frontend to launch anything on a specific desktop/workspace.
##  lh is short for LaunchHere

USAGE="USAGE: $(basename $0) [-r] workspace(1,2,..) command\
    LaunchHere launches COMMAND on specific workspace.\
    -r option returns to current workspace"
[ -z "$1" ] && echo $USAGE && exit 0
ISRETURN=$(false); [ "$1" = "-r" ] && ISRETURN=true && shift;  
WRKSPC=$1;[ -z "$WRKSPC" ] && echo $USAGE && exit 0
WSN=$(expr $WRKSPC - 1)  ## wmctrl starts with 0 as first wrkspc
shift; CMD="$*"; [ -z "$CMD" ] && echo $USAGE && exit 0

WM=$(which wmctrl);[ -z "$WM" ] && echo MISSING wmctrl && exit 1
CURRENT=$(wmctrl -d | grep '*' | cut -c1)


# Switch to desired workspace
$WM -s $WSN
$CMD &
PID=$!
echo Executed $CMD on workspace $WRKSPC,  PID=$PID
sleep 3

# Return to CURRENT workspace ?
# [ $ISRETURN ] && echo TRUE || echo FALSE
[ $ISRETURN ] && $WM -s $CURRENT

Tags:

Workspaces