commit c64bf1b
wf
·
2026-05-18 15:08:22 +0000 UTC
parent 3fb0475
Add unbind command
7 files changed,
+36,
-2
+1,
-0
1@@ -18,6 +18,7 @@ TODO
2 ----
3
4 * Improve code quality; remove some hacky stuff
5+ * Add `subscribe` command
6
7 Requirements
8 ------------
+8,
-1
1@@ -148,6 +148,13 @@ $ howlc bind mod+shift+g "example_command"
2 .br
3 $ howlc bind win+4 "howlc workspace 4"
4 .TP
5+\fBunbind\fR
6+Remove a previously registered key binding\.
7+.IP
8+Example:
9+.IP
10+$ howlc unbind mod+shift+g
11+.TP
12 \fBmodkey\fR
13 Configure the modifier key\. This can be then used as an alias in keybindings, like so: \fBmod+key\fR\. See the \fIBINDINGS\fR section for allowed values\.
14 .IP
15@@ -223,7 +230,7 @@ The accepted key strings are as specified in \fB<xkbcommon/xkbcommon\-keysyms\.h
16 .SH "BUGS"
17 The manual does not specify the names for modifiers on other platforms\.
18 .P
19-There is no way to unbind keys\. This is an swc problem, but still deserves to be mentioned here\.
20+Please report any other ones, which there are probably many of\.
21 .SH "COPYRIGHT"
22 \fBhowl\fR and \fBhowlc\fR are (C) wf 2026 \fIhttps://sr\.ht/~wf\fR\.
23 .SH "SEE ALSO"
+8,
-1
1@@ -148,6 +148,13 @@ Most of the following (can be deduced logically) can take an optional window ID
2 \# Bind Win+4 to switch to the 4th workspace<br>
3 $ howlc bind win+4 "howlc workspace 4"
4
5+ * `unbind`:
6+ Remove a previously registered key binding.
7+
8+ Example:
9+
10+ $ howlc unbind mod+shift+g
11+
12 * `modkey`:
13 Configure the modifier key. This can be then used as an alias in keybindings, like so: `mod+key`.
14 See the [BINDINGS][] section for allowed values.
15@@ -223,7 +230,7 @@ The accepted key strings are as specified in `<xkbcommon/xkbcommon-keysyms.h>`.
16
17 The manual does not specify the names for modifiers on other platforms.
18
19-There is no way to unbind keys. This is an swc problem, but still deserves to be mentioned here.
20+Please report any other ones, which there are probably many of.
21
22 ## COPYRIGHT
23
+1,
-0
1@@ -28,6 +28,7 @@ enum cmd {
2 cmd_get_workspace,
3 cmd_get_cursor_position,
4 cmd_bind,
5+ cmd_unbind,
6 cmd_modkey,
7 cmd_inner_focus_color,
8 cmd_inner_unfocus_color,
+1,
-0
1@@ -43,6 +43,7 @@ static const struct command commands[] = {
2 { "get_screen_geometry", cmd_get_screen_geometry, 0, false },
3 { "get_cursor_position", cmd_get_cursor_position, 0, false },
4 { "bind", cmd_bind, 2, false },
5+ { "unbind", cmd_unbind, 1, false },
6 { "modkey", cmd_modkey, 1, true },
7 { "inner_focus_color", cmd_inner_focus_color, 1, true },
8 { "inner_unfocus_color", cmd_inner_unfocus_color, 1, true },
+2,
-0
1@@ -51,6 +51,7 @@ extern status ipc_list_windows(char **);
2 extern status ipc_get_screen_geometry(char **);
3 extern status ipc_get_cursor_position(char **);
4 extern status ipc_bind(char **);
5+extern status ipc_unbind(char **);
6 extern status ipc_quit(char **);
7 extern status ipc_config(char **);
8
9@@ -102,6 +103,7 @@ static const cmd_handler_t cmd_handler [cmd_last] = {
10 [cmd_get_screen_geometry] = ipc_get_screen_geometry,
11 [cmd_get_cursor_position] = ipc_get_cursor_position,
12 [cmd_bind] = ipc_bind,
13+ [cmd_unbind] = ipc_unbind,
14 [cmd_quit] = ipc_quit,
15 [cmd_config] = ipc_config
16 };
+15,
-0
1@@ -510,6 +510,21 @@ ipc_bind(char **arg) {
2 return (status){ true, "" };
3 }
4
5+status
6+ipc_unbind(char **arg) {
7+ if (arg[1] == NULL)
8+ return (status){ false, "" };
9+
10+ struct bind tmp = fn_bind(arg[1]);
11+ swc_remove_binding(
12+ SWC_BINDING_KEY,
13+ tmp.mod,
14+ tmp.key
15+ );
16+
17+ return (status){ true, "" };
18+}
19+
20 status
21 ipc_config(char **arg) {
22 if (arg[1] == NULL || arg[2] == NULL)