ssokolow / quicktile

Adds window-tiling hotkeys to any X11 desktop. (An analogue to WinSplit Revolution for people who don't want to use Compiz Grid)
https://ssokolow.com/quicktile/
GNU General Public License v2.0
861 stars 78 forks source link

Listen for keybindings containing more than one non-modifier key? #74

Open peteruithoven opened 7 years ago

peteruithoven commented 7 years ago

Is there any way for Quicktile to respond to multiple keys, beside the modifier keys? Like tiling a window to top-left when modifier keys + up + left keys are pressed?

ssokolow commented 7 years ago

Probably not currently. I don't think the underlying XGrabKeyAPI allows claiming combinations containing more than one non-modifier key.

However, it IS theoretically possible. You'd want to:

  1. XGrabKey both modifier keys + up and modifier keys + left when QuickTile starts.
  2. When either is pressed, call XGrabKeyboard like a screen-locker would.
  3. If the last key in the chord is pressed, make a note of it so it can be acted on.
  4. No matter what happens, call XUngrabKeyboard as soon as a single key press/release event has occurred.

...or, if you want to support Emacs-style non-chorded sequences like xbindkey does, only call XUngrabKeyboard for key press events, so releasing the first chord doesn't release the grab.