LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop
User Name
Password
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.

Notices

Reply
 
Search this Thread
Old 05-22-2007, 05:36 AM   #1
bobbrandt
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?

Thanks
Bob
 
Old 05-23-2007, 09:26 AM   #2
bobbrandt
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

Code:
CurrentWS=`wmctrl  -d | grep "*" | cut -f 1 -d " "`
Application="gedit"

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

Code:
Application="gedit"

Process=`pgrep -f "$Application"`
WindowID=`wmctrl -l -p | grep $Process | cut -f 1 -d " "`
WindowID=${WindowID#0x}

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

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

Rep: Reputation: 230Reputation: 230Reputation: 230
devilspie:
http://www.burtonini.com/blog/computers/devilspie
http://ubuntu-tutorials.com/2007/07/...ects-in-gnome/
http://www.linux.com/feature/122471?theme=print [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,
http://sweb.cz/tripie/utils/wmctrl/
is an excellent overview of wmctrl

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


Reply

Tags
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


All times are GMT -5. The time now is 10:38 AM.

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