In KDE's Konsole, I can do the following from the terminal:

dcop kwin KWinInterface currentDesktop

And it will tell me which desktop my terminal is connected to

( per http://stackoverflow.com/questions/738059/in-kde-how-can-i-automatically-tell-which-desktop-a-konsole-terminal-is-in/745250#745250 )

How can I determine what desktop number the current gnome terminal in a gnome session is connected to?

link|improve this question

78% accept rate
are you particularly looking for a commandline interface? – quack quixote Apr 29 '10 at 18:24
Preferably. Otherwise I can compile some code and have that return a number on the command line. The problem with compiling code is external dependencies. We have an old Linux environment and people always post code that depends on new APIs. – Ross Rogers Apr 30 '10 at 22:56
feedback

1 Answer

up vote 0 down vote accepted

Per hints on this page and the XLib variable _NET_CURRENT_DESKTOP from this answer, I determined that the following would work:

% xprop -root | egrep '^_NET_CURRENT_DESKTOP'
_NET_CURRENT_DESKTOP(CARDINAL) = 0
link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.