Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question
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

1 Answer 1

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'
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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