Exclude certain key combinations from being passed via rdesktop

desktopkey mappingrdesktop

When connected via rdesktop to a remote machine, normally all keys pressed inside the active rdesktop window are transferred to the remote machine.

Is it possible to define key strokes, which are excluded? By that I mean, when pressed while the rdesktop window is active, these keystrokes will act locally.

A concrete example is the key kombination CTRL+ALT+LEFT and CTRL+ALT+RIGHT which I use on my local machine to switch between virtual desktops. The remote machine does not have any virtual desktops, and this key combination has no effect there. But the key strokes are "eaten" by the rdesktop window nevertheless.

I am not sure on what level this should be done. My guess is, that the keystrokes would have to be intercepted before they are passed to rdesktop.

Is there any way to achieve this?

My local machine is Debian Wheezy with LXDE.

Best Answer

I think part of your solution starts with using the -K switch to rdesktop.

-K     Do not override window manager key bindings.  By default rdesktop 
       attempts to grab all keyboard input when it is in focus.

patch

Also I found this thread titled: Thread: rdesktop - ignore certain key combinationswhere one of the posters mentioned that he made a patch to rdesktop which did the following things:

  • Double press Ctrl+Alt+Left or Ctrl+Alt+Right to switch local active workspaces.
  • Double press Ctrl+Alt+Tab to switch local active window.
  • Other hot keys are sent directly to remote machine.
  • If rdesktop is running in fullscreen mode (-f), Ctrl+Alt+Left/Right/Tab will toggle it to window mode first. After switching back, it can NOT toggle to fullscreen automatically. Press Ctrl+Alt+Enter to do that. (I know this is boring. But it is the best I can do. Rdesktop use override_redirect to implement fullscreen which makes it always the top-most window no matter which workspace/window you have switched to).

But the link to the patch is apparently now broken from that thread. Thanksfully the author submitted the patch to the rdesktop project. The patch is available here, titled: #178 Send some hotkeys to local windows manager instead of remote.

rdesktop keymapping

I also found this document in the rdesktop documentation titled: keymapping.txt. This document would seem to cover what you're looking for.

Related Question