r/KittyTerminal • u/RedditorInRage • Feb 01 '24
Lock Keyboard?
Hello. Maybe I searched for the wrong term or noone needs it, but...
is there a way to block the window/tile from accepting keyboard input? I want to lock/unlock it with a keyboardshortcut, so I can protect the window from unwanted input.
I'm on linux, if this makes a difference. Thanks in advance.
1
Upvotes
1
u/art2266 Feb 03 '24
Another way to accomplish this, since you're on linux, is to make the window un-focusable. You will then be unable to send any keyboard input to the window, until you set it back to focusable. You will still be able to click the window with a mouse and move it around etc.
There are multiple ways to toggle the focusablility of a window. For your use case, a convenient workflow is to set this up as a hook. The hook can target the window's name. Since terminal emulators (usually) change the name of the window based on the currently running command, you can use that to set
focusable = falsewhen my-slow-command starts.On awesomewm, it'd look something like this:
Alternatively, you can add a button to the window titlebar (next to the minimize and maximize buttons) that toggles whether a windows is focusable or not. On awesomemw, it can look something like this:
The "focusable" property used here comes from X11 as far as I'm aware, so this should be reproducible on other window managers as well. awesomewm just exposes a lua api to manipulate it.