Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent grabbing of certain key combinations #22

Open
samodadela opened this issue Dec 17, 2015 · 10 comments · May be fixed by #289
Open

Prevent grabbing of certain key combinations #22

samodadela opened this issue Dec 17, 2015 · 10 comments · May be fixed by #289

Comments

@samodadela
Copy link

samodadela commented Dec 17, 2015

I'd like to prevent certain key combinations to be sent to the server. Problem is that rdesktop grabs ctrl-alt-arrow keys so I'm unable to navigate workspaces on my linux machine - as soon as I switch to a workspace with rdesktop I get stuck and have to use the mouse.

I've searched the net for an answer but can't find any. The best I found is a patch http://www.artificialworlds.net/blog/2011/07/ - but this requires ctrl-alt-arrow to be pressed twice to work.

Would it be possible (or is it already possible? how?) to extend the keymap file to indicate that certain key cominations should not be passed to the server? Using -K is not an option since then you loose alt-tab, alt-F4...

I've also tried xfreerdp and remmina and both lack this functionality - or it works poorly.

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/29201659-prevent-grabbing-of-certain-key-combinations?utm_campaign=plugin&utm_content=tracker%2F19353203&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F19353203&utm_medium=issues&utm_source=github).
@samodadela
Copy link
Author

Found this pull request about the same issue: #20
Two problmes:

  • need to press ctrl-alt-L/R twice to change workspace
  • up/down cursor keys don't work anymore

@xornand
Copy link

xornand commented Jan 9, 2016

If you post a reasonable bounty, I'll do it for half of what I normally bill. The easier/cheaper work around is to dig into the Xorg/X11 files, and design an alternate keyboard schema as a work around. It's doc'd here: http://www.x.org/archive/X11R7.5/doc/man/man5/xorg.conf.5.html#sect7.

Or even easier, https://github.com/rdesktop/rdesktop/blob/master/keymaps/en-us go there and make it so it so that key combination isn't hooked by the app.

Generally, if you're a homerow user, The C-a-<L,R> movement makes you get off your wrists and it ruins the whole flow. If you're a vimmer, hjkl will be second nature - map Windows-key + h,l or jk to navigate left/right through your workspaces.

@samodadela
Copy link
Author

How much is 'reasonable'? :)

I want to try with keymaps/en-us... but what's the keyword to prevent grabbing?
Thanks for the homerow hint... it's probably better - I'll try it.

@samodadela
Copy link
Author

Correction to my comment about pull request #20 (the patch in http://www.artificialworlds.net/blog/2011/07/). It works - you have to press ctrl-alt-arrow twice. The first time it ungrabs the keyboard, the next one is sent to the window manager and results in a change of desktop.

The problem was that I was copying the rdeskop binary to /usr/local/bin without doing a make install - this way rdesktop was not able to find the keymap files so the cursor keys (among other things) were not working. I was wrongly attributing the problem to #20 - sorry for that.

As regards a real fix. I must agree with what's written in the blog above - that there is no way to resend the keys back to X... maybe it could be possible to resend the key events to the window manager with XSendEvent() after ungrab - though from reading it seems that most applications ignore such events.

xornand: I found no way to inhibit ctrl-alt-arrow using keymaps.

@hean01-cendio
Copy link
Contributor

hean01-cendio commented Oct 24, 2016

I would want to solve this issue on a another level, where a user can get out of the keyboard grab but also handle hotkeys in the rdesktop application such as toggle full screen mode.

One way to do this which is pretty nice is the approach vmware is doing this:

  • A hotkey MOD is selected by the user, any combination of (SHIFT, CTRL, ALT, WINKEY), default is CTRL + ALT.
  • If MOD is press and release, ungrab the keyboard and let all keys go to local desktop, grab is given back to rdesktop by clicking in the window.
  • MOD + KEY is grabbed as a rdesktop hotkey such as CTRL+ALT+ENTER, consume it and do proper action or just throw if unbound. This does not change the grab / ungrab state of window.

The modifier should be configurable on command line to override a decent default such as CTRL+ALT. This would not change CTRL+ALT+ENTER which is handled today. for example.

Here follows a few usage examples where selected modifier is CTRL+ALT:

  • Switch to full screen (rdesktop hotkey), CTRL + ALT + ENTER
  • Switch to next local desktop, CTRL + ALT, CTRL + ALT + DOWN
  • Tab through local desktop applications, CTRL + ALT, ALT + TAB

@claxclinton
Copy link

Sounds perfect to me.

@claxclinton
Copy link

Double-typing Control+Alt doesn't allow me access to the window manager with the keyboard.
I have rdesktop 1.8.3 and have not specified -K.
Do I have the wrong version, or is there any documentation or SHA where I can read more about
how to make this work?

@uglym8
Copy link
Member

uglym8 commented Nov 7, 2017

Hi!
AFAIK this feature is not implemented yet.
Sorry, but you have to wait a little bit longer:)

@claxclinton
Copy link

Hi! I missread it. Ok, holding my thumbs for the fix. Thanks.

@veloek
Copy link

veloek commented Aug 12, 2021

Hi! I see the PR is still open. Any chance this will be completed soon? Really looking forward to this feature 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants