diff options
author | Aylur <[email protected]> | 2025-01-01 19:48:13 +0100 |
---|---|---|
committer | Aylur <[email protected]> | 2025-01-01 19:48:13 +0100 |
commit | d6c3c9c179eba0c9536a1beaaeb0525a63e752f3 (patch) | |
tree | 2aab87da07f6b52b48e38b0f44c615c0953a9fd2 /docs/guide | |
parent | f2244c20f4a6018bdb7a5ff605cdf7047af4aa18 (diff) |
docs(faq): how to register keybindings
close #223
Diffstat (limited to 'docs/guide')
-rw-r--r-- | docs/guide/typescript/faq.md | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/docs/guide/typescript/faq.md b/docs/guide/typescript/faq.md index 1d08824..132900a 100644 --- a/docs/guide/typescript/faq.md +++ b/docs/guide/typescript/faq.md @@ -269,3 +269,33 @@ class MyWidget extends Widget.Box { } } ``` + +## How do I register keybindings? + +If you want global keybindings use your compositor. +Only **focused** windows can capture events. To make a window +focusable set its keymode. + +::: code-group +```tsx [gtk3] +<window + keymode={Astal.Keymode.ON_DEMAND} + onKeyPressEvent={(self, event: Gdk.Event) => { + if (event.get_keyval()[1] === Gdk.KEY_Escape) { + self.hide() + } + }} +/> +``` + +```tsx [gtk4] +<window + keymode={Astal.Keymode.ON_DEMAND} + onKeyPressed={(self, keyval) => { + if (keyval === Gdk.KEY_Escape) { + self.hide() + } + }} +/> +``` +::: |