diff options
Diffstat (limited to 'docs')
-rw-r--r-- | docs/guide/typescript/faq.md | 30 | ||||
-rw-r--r-- | docs/package.json | 2 |
2 files changed, 31 insertions, 1 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() + } + }} +/> +``` +::: diff --git a/docs/package.json b/docs/package.json index ad76c9a..e01b189 100644 --- a/docs/package.json +++ b/docs/package.json @@ -12,7 +12,7 @@ "vue": "^3.4.38" }, "scripts": { - "dev": "vitepress dev", + "dev": "vitepress dev --open", "build": "vitepress build", "preview": "vitepress preview", "vitepress": "vitepress", |