xpra icon
Bug tracker and wiki

Opened 13 months ago

Closed 12 months ago

Last modified 7 months ago

#1195 closed enhancement (fixed)

keyboard grabs - conflicting shortcuts and modifier grabbing

Reported by: psycho_zs Owned by: psycho_zs
Priority: minor Milestone: 1.0
Component: client Version: 0.17.x
Keywords: shortcuts Cc:

Description

I'm experiencing two problems with client shortcuts:

Current Alt+Shift+something shortcuts are in conflict with common keyboard layout switching shortcut Alt+Shift. Perhaps, some unused prefix could be found.

There is no way to enable grabbing and passing through of modifier keys, like Super. This is especially needed in shadow and full-desktop (like with Xephyr) sessions. To pass Super+something to the server host.

The answer to both problems could be Host Key concept. It is used by such software as VirtualBox? or Remmina:
Define a Host key (R_Control by default) which would have special meaning for Xpra client.
Host+something would do some stuff.
Single Host key tap would switch unconditional grabbing of keyboard, including modifier keys, as long as any xpra window has focus.
Single (of doubles) key, like R_Control would not interfere with any of common shortcuts like Alt+Shift, and leave L_Control to act as Control itself.

Change History (11)

comment:1 Changed 12 months ago by Antoine Martin

Owner: changed from Antoine Martin to psycho_zs

All the shortcuts are configurable, if your DE intercepts them then you can change your DE shortcuts or change xpra's.

As for passing the super key to the server, that seemed easy enough to implement (but in the end.. it wasn't), so that's done in r12645.

This is done by adding a new key shortcut "Control_R" which toggles grabbing the keyboard. Whilst the keyboard is grabbed, all keys will be sent to the server, including the super key.
We release the grab when we lose focus. That part was hard to implement on X11 with GTK because it seems to swallow focus events when we hold the grab..

We already had similar functionality on win32 (which was disabled by default until now), see #1152.

Please close if this works for you.

comment:2 Changed 12 months ago by psycho_zs

Big thanks! I'll test it in a few days.
When Control_R is bound to toggle_keyboard_grab, can it still be bound to other actions as a part of combination?

comment:3 Changed 12 months ago by Antoine Martin

When Control_R is bound to toggle_keyboard_grab, can it still be bound to other actions as a part of combination?


Theoretically yes, but each shortcut will then also toggle the keyboard grab. Probably not a good idea.

comment:4 in reply to:  3 Changed 12 months ago by psycho_zs

Key grab seems to work, at least with simple rootless xpra session. I will have more testing cases tomorrow, including shadow sessions.

btw, I've replaced all 'Meta+Shift' with 'Shift_R' and none of xpra shortcuts seem to work this way.

Theoretically yes, but each shortcut will then also toggle the keyboard grab. Probably not a good idea.

If action would be triggered on exact match keys release, it would be possible to partially replicate host key behavior.
For full host key feature it would also be needed to add option 'host-key' to the config file and allow 'key-shortcut' option to parse 'Host_key' value as a key set by 'host-key' option.

comment:5 Changed 12 months ago by Antoine Martin

Resolution: fixed
Status: newclosed

btw, I've replaced all 'Meta+Shift' with 'Shift_R' and none of xpra shortcuts seem to work this way.


Modifier keys have no concept of right or left once they are pressed in X11.
Theoretically, it might be possible to keep track of which key triggered which modifier to be enabled (ie: Shift_R for shift), but I am not crazy enough to attempt writing such horrible code.


I also don't have time to implement the host-key feature, feel free to create a new ticket for that.
I'm closing as fixed because all keys can now be forwarded and trying to find shortcuts that don't conflict with any DE is futile.

comment:6 Changed 10 months ago by Antoine Martin

Summary: conflicting shortcuts and modifier grabbingkeyboard grabs - conflicting shortcuts and modifier grabbing

comment:7 Changed 10 months ago by Antoine Martin

Mouse grabs in #1229 done the same way.

comment:8 Changed 10 months ago by Antoine Martin

Milestone: 1.0

comment:9 Changed 10 months ago by Antoine Martin

Important: the shortcuts have just been changed, see r13169

Some GTK API links:

Last edited 7 months ago by Antoine Martin (previous) (diff)

comment:10 Changed 10 months ago by psycho_zs

So, ctrl+menu grabs keyboard, shift+menu grabs mouse?
Sounds good.

comment:11 Changed 7 months ago by Antoine Martin

r14359 also intercepts Alt-Tab on win32 (only when we have the keyboard grab obviously).

Note: See TracTickets for help on using tickets.