addKeybinding for keydown and keyup posiblity
First of all, I'm not 100% sure if this is the right place for this question, so please if you do know where should I ask, please do say.
I'm trying to make an gnome extension for tiling. In concept it should be something like WindowTidy for MacOS.
The concept is next:
When the user start dragging the window, if he then presses the modifier key (e.g. alt), the UI is shown with custom presets on where the window can be dropped and then positioned and resized accordingly.
I'm currently exploring the possibilities and when I try to do this:
global.display.connect('grab-op-begin', (meta_display, meta_window, meta_grab_op, gpointer) => {
Main.wm.addKeybinding('dropzone-toggle', settings, flag, mode, () => {
if (!meta_window || !is_grab_operation_allowed(meta_grab_op)) {
return;
}
showUI();
});
});
It kinda works, but it saves the state that the keybinding is pressed and every time the user moves the window again it shows the UI.
Is it possible somehow to remove the binding with removeKeyBinding or something similar once the key is unpressed?
Also, in this exploration, I found that if using the alt modifier alone, for example, it doesn't work. I have to bind it to something like super+alt+x which is not very intuitive for this kind of purpose.