Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Desktop
User Name
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.


  Search this Thread
Old 05-22-2007, 05:36 AM   #1
LQ Newbie
Registered: Sep 2006
Posts: 23

Rep: Reputation: 0
How to Specify a Gnome Workpace an Application will Launch in

I know there is a similar thread in the Newbie section, but it is a year old and was never answered fully.

Basically I want to create a Desktop with two Workspaces for general office users. The main workspace will be the default one, but the second will be used for VMWare Player running a Windows VM or perhaps a RDP session to a terminal server (for all those apps which haven't quite made it to Linux yet.)

Getting the processes to run on startup is easy, the problem is I am unable to figure out how to force the apps to launch in the second workspace.

Any ideas?

Old 05-23-2007, 09:26 AM   #2
LQ Newbie
Registered: Sep 2006
Posts: 23

Original Poster
Rep: Reputation: 0
I did find a workaround.

I found that the wmctrl application will allow me to change workspaces from the CLI, but there is a time lag. If the target application (I'll use gedit as an example) is not running I need to:
  1. Change the to the target Workspace
  2. Launch the target application
  3. Wait for that application to actually launch
  4. Switch back to the original Workspace

CurrentWS=`wmctrl  -d | grep "*" | cut -f 1 -d " "`

wmctrl  -s 1 
$Application  &
# Wait up to ten seconds for the Application to load
for i in `seq 1 10`
	sleep 1s
	Process=`pgrep -f "$Application"`
	WindowID=`wmctrl -l -p | grep $Process | cut -f 1 -d " "`
	if  [[ "$WindowID" != "" ]]
wmctrl -s $CurrentWS
However if the Application is already running, you can use wmctrl to move that app to the desired Workspace.


Process=`pgrep -f "$Application"`
WindowID=`wmctrl -l -p | grep $Process | cut -f 1 -d " "`

wmctrl  -r $WindowID -t 1
However this is just a hack, does anyone know of a better way to do this?

Old 12-24-2007, 01:36 PM   #3
Senior Member
Registered: Oct 2004
Location: Houston, TX (usa)
Distribution: MEPIS, Debian, Knoppix,
Posts: 4,727
Blog Entries: 15

Rep: Reputation: 233Reputation: 233Reputation: 233
devilspie: [Added]
is definitely able to do this & it specifically targets windows being opened.

Unfortunately "the documentation is sparse" is an understatement.

If you find any evidence that devilspie can "see"/use PID's, please post back.

Edit: In case you aren't aware of it,
is an excellent overview of wmctrl

Last edited by archtoad6; 12-24-2007 at 02:10 PM. Reason: Add add'l links


gnome, workspace

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Launch Application at log on Bkangatsi Linux - Desktop 3 05-21-2007 03:08 AM
Application Launch Failure - several distros gastroman Linux - Desktop 9 01-18-2007 01:48 AM
Application launch times Johng Mandriva 1 08-09-2005 11:31 AM
Launch an application in firefox - How? TSynergy Linux - Newbie 5 02-27-2005 11:02 AM
gnome: launch application associated to a document type from command line cweiske Linux - Software 1 09-28-2004 06:47 PM > Forums > Linux Forums > Linux - Desktop

All times are GMT -5. The time now is 02:18 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration