PDA

View Full Version : [gnome] Way for script to learn which workspace is displayed?



tauchris
June 23rd, 2009, 09:41 PM
Is there any way that a script can determine which desktop workspace is currently being displayed? I want to have a launcher on my main panel that will open a terminal window in a different starting directory, depending one which workspace I'm viewing when I click the launcher. So far, I haven't found any way to do that. Does anyone have a suggestion? Chris

zhocchao
June 23rd, 2009, 09:46 PM
this gives you the number (0=1). Does not work in compiz (i think)

wmctrl -d |grep "*"|awk '{print $1}'

tauchris
June 23rd, 2009, 10:33 PM
What is "wmctl"? What package is that part of? It doesn't appear on my Ubuntu system, and it doesn't show up in Synaptic anywhere, either...

zhocchao
June 23rd, 2009, 10:38 PM
you can install it with sudo apt-get install wmctrl

tauchris
June 23rd, 2009, 11:07 PM
Yeah, so thanks for the pointer. Does not appear to work correctly on compiz. :-( Thanks anyway. Any other (more portable) suggestions?

zhocchao
June 23rd, 2009, 11:21 PM
with xmousepos(xmousepos |awk '{print $1}') (package xautomation) you can determine the position of your mouse. As you have one great desktop in compiz e.g. 4*1280x800 = 5120x800. x-Position 2000 would be workspace(or viewport?) 2.

tauchris
June 24th, 2009, 02:15 PM
Thanks!