You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/wiki/Configuration:-Key-Bindings.md
+23-5Lines changed: 23 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -81,26 +81,44 @@ binds {
81
81
82
82
This is mostly useful for the scroll bindings.
83
83
84
-
### Release bindings
84
+
### Press and Release bindings
85
85
86
86
<sup>Since: next release</sup>
87
87
88
-
Binds can be set to trigger on release instead of on the initial key press. This is mostly useful when you want to bind a modifier key to an action, as it avoids unwanted triggering when you're trying to use other binds involving that modifier.
88
+
Binds can be set to trigger on key press, on key release, or both. By default, binds trigger on key press. You can specify the timing using `press {}` and `release {}` blocks:
89
89
90
90
```kdl
91
91
binds {
92
-
Mod release=true { toggle-overview; }
92
+
// Trigger on press (default behavior)
93
+
Mod+T { spawn "alacritty"; }
94
+
95
+
// Trigger on release
96
+
Mod { release { toggle-overview; } }
97
+
98
+
// Trigger on both press and release with different actions
99
+
Mod+Shift+Q repeat=false {
100
+
press { spawn "notify-send" "Pressed"; }
101
+
release { spawn "notify-send" "Released"; }
102
+
}
93
103
}
94
104
```
95
105
96
-
These will normally only trigger if no other keys were released and no keys or mouse buttons were pressed after the bound key was pressed. If you want one to always trigger you should also set `allow-invalidation=false`.
106
+
Release bindings are mostly useful when you want to bind a modifier key to an action, as it avoids unwanted triggering when you're trying to use other binds involving that modifier.
107
+
108
+
Release binds will normally only trigger if no other keys were released and no keys or mouse buttons were pressed after the bound key was pressed. If you want a release bind to always trigger regardless, set `allow-invalidation=false`:
109
+
110
+
```kdl
111
+
binds {
112
+
Mod allow-invalidation=false { release { toggle-overview; } }
113
+
}
114
+
```
97
115
98
116
Note that the modifier state is updated before binds are evaluated, so if you want to configure a modifier key as both a normal bind and a release bind the entries are slightly different.
0 commit comments