Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I've defined the names of my KDE desktops to those of my workstation and the local compute servers. I want to find a way such that when I open a shell in the particular named desktop, it will open the shell in the corresponding machine.

Example, here is a list of my KDE desktop names:

  • MyWs
  • Cs1
  • Cs2

When I open a shell while I am in the "Cs1" window, I want it to open an SSH session on "Cs1" rather than the current machine I'm working from.

I figure I can do this if I can retrieve the name of the KDE desktop that I am opening a terminal from (konsole) and use that to call my remote login SSH script.

Through my Google search, I've discovered how to find the window number that I'm using (xprop -root | egrep '^_NET_CURRENT_DESKTOP'), but cannot find anything that tells me how to retrieve the name of the window. I have tried the "qdbus" and "qdop" (including the graphical kdcop) and still cannot find anything giving me the current desktop name.

Now, let me also preface this by saying we are using an ancient version of RH5 (RedHatEnterpriseClient 5.6) and not running the latest and greatest KDE (KDE 3.54.el5_4.1).


Edit: A comment asked what xprop -root | egrep '^_NET_DESKTOP_NAMES' shows. I tried that before I posted my question, but I get the following and I don't know what to do with that result:

_NET_DESKTOP_NAMES(UTF8_STRING) = 0x41, 0x55, 0x4c, 0x57, 0x53, 0x30, 0x38, 0x34, 0x0, 0x41, 0x55, 0x4c, 0x43, 0x53, 0x32, 0x31, 0x31, 0x0, 0x41, 0x55, 0x4c, 0x43, 0x53, 0x32, 0x31, 0x32, 0x0, 0x41, 0x55, 0x4c, 0x43, 0x53, 0x32, 0x31, 0x33, 0x0, 0x41, 0x55, 0x4c, 0x43, 0x53, 0x32, 0x31, 0x34, 0x0`

Running dcop kwin KWinInterface currentDesktop returns 1

Finally, right after submitting my question, I came across another post on this site and the use of wmctrl -d. I decided to give it a try. I found out that we did not have wmctrl installed in our system and so I downloaded and compiled wmctrl. wmctrl -d does return all the information I need, excepting the trouble to extract the information obtained from the wmctrl -d command.

Isn't there an easier way, using dcop or something?

share|improve this question
    
What does this command show for you? xprop -root | egrep '^_NET_DESKTOP_NAMES' –  slm Sep 14 '13 at 1:00
    
Given you're running an older version of KDE can you use this command? ` dcop kwin KWinInterface currentDesktop` –  slm Sep 14 '13 at 1:01
add comment

1 Answer

wmctrl

You can progammatically get the names of your workspaces/windows using this command:

$ wmctrl -d
0  * DG: 5760x900  VP: 0,0  WA: 0,25 1440x826  Workspace 1
1  - DG: 5760x900  VP: 0,0  WA: 0,25 1440x826  
2  - DG: 5760x900  VP: 0,0  WA: 0,25 1440x826  N/A
3  - DG: 5760x900  VP: 0,0  WA: 0,25 1440x826  N/A

You can also switch to another window using this command:

$ wmctrl -s <workspace_name>
share|improve this answer
add comment

Your Answer

 
discard

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.