I was looking for this and found a ques开发者_JS百科tion and answer for KDE3; I figured more people will be interested in the answer for KDE4 as time passes (posting here just so I can also post the answer...)
qdbus org.kde.kwin /KWin org.kde.KWin.currentDesktop
prints the number of the current virtual desktop.
精彩评论