mirror of
https://codeberg.org/dwl/dwl-patches.git
synced 2025-10-27 02:04:16 +00:00
update riverctl patch to make the func syntax better and cleanup readme
This commit is contained in:
parent
1ec0cbae78
commit
a23d17409d
@ -1,33 +0,0 @@
|
||||
This patch adds river-control-unstable-v1 support to dwl, allowing changing dwl settings on the fly via dwlctl.
|
||||
dwlctl is a small wayland program included with this patch that connects to dwl and is able to change some dwl settings at runtime,
|
||||
such as rules and keybinds.
|
||||
|
||||
build for dwl-git commit 15bfffd8
|
||||
|
||||
currently only the following is supported:
|
||||
clearing binds,
|
||||
clearing rules,
|
||||
adding rules,
|
||||
adding binds,
|
||||
running random functions,
|
||||
|
||||
example commands for using dwlctl with dwl:
|
||||
|
||||
dwlctl clear-binds
|
||||
|
||||
dwlctl bind super,shift Return spawn kitty tmux
|
||||
|
||||
dwlctl bind supershift q killclient
|
||||
|
||||
dwlctl clear-rules
|
||||
|
||||
dwlctl rule-add -appid steam -title steam float tags $((1 << 2))
|
||||
|
||||
dwlctl rule-add -appid kitty float
|
||||
|
||||
dwlctl rule-add -title firefox float
|
||||
|
||||
dwlctl func spawn kitty tmux
|
||||
|
||||
dwlctl func setlayout 2
|
||||
|
||||
40
patches/riverctl/readme.md
Normal file
40
patches/riverctl/readme.md
Normal file
@ -0,0 +1,40 @@
|
||||
build for dwl-git commit 15bfffd8
|
||||
|
||||
This patch adds river-control-unstable-v1 support to dwl, allowing changing dwl settings on the fly via dwlctl.
|
||||
dwlctl is a small wayland program included with this patch that can sends arguments to dwl which then passes those to functions allowing the user to run any function they define in the horrably named `Func_str_type_pair_list` array.
|
||||
|
||||
This patch also changes binds and rules to use a linked list internally and adds functionality for dwlctl to create new binds and rules at runtime and clear all rules/binds that were added at runtime. (syntax examples bellow)
|
||||
|
||||
I use this dynamic bind/rule functionality to have almost all of my keybinds and rules defined in a shell script run at dwl's startup that calls dwlctl a bunch.
|
||||
|
||||
I recommend that if you do the same to have `dwlctl clear-binds` and `dwlctl clear-rules` at the start of your script since binds with the same mod and key don't fully replace each other, although rules with the EXACT same appid and title will by defualt.
|
||||
|
||||
Also Note that for keybinds only keys listed in `Keysym_str_pair_list` are supported so if a setting a keybind via dwlctl isn't worked check if the key is in there, if not add it.
|
||||
|
||||
|
||||
|
||||
example commands for using dwlctl with dwl:
|
||||
|
||||
Remember that support for any function can be added by just adding that function to the `Func_str_type_pair_list` array.
|
||||
|
||||
```
|
||||
dwlctl clear-binds
|
||||
|
||||
dwlctl bind super,shift Return spawn kitty tmux
|
||||
|
||||
dwlctl bind supershift q killclient
|
||||
|
||||
dwlctl clear-rules
|
||||
|
||||
dwlctl rule-add -appid steam -title steam float tags $((1 << 2))
|
||||
|
||||
dwlctl rule-add -appid kitty float
|
||||
|
||||
dwlctl rule-add -title firefox float
|
||||
|
||||
dwlctl spawn kitty tmux
|
||||
|
||||
dwlctl setlayout 2
|
||||
|
||||
dwlctl togglefullscreen
|
||||
```
|
||||
@ -1,8 +1,9 @@
|
||||
From 49240ee7200281d28fcf0c64b32b81b489ad7ca5 Mon Sep 17 00:00:00 2001
|
||||
From b00dde5efc0c13a9cc0637bcb8ccca91a78c747a Mon Sep 17 00:00:00 2001
|
||||
From: Zuki Air <zukirust@gmail.com>
|
||||
Date: Sun, 27 Jul 2025 11:30:32 +0100
|
||||
Subject: [PATCH] river-ctl patch
|
||||
|
||||
remove func argument and use the root argument instead
|
||||
---
|
||||
.gitignore | 1 +
|
||||
Makefile | 22 +-
|
||||
@ -436,7 +437,7 @@ index 0000000..aa5fc4d
|
||||
+</protocol>
|
||||
diff --git a/river-control.h b/river-control.h
|
||||
new file mode 100644
|
||||
index 0000000..7d54cdf
|
||||
index 0000000..a2ec549
|
||||
--- /dev/null
|
||||
+++ b/river-control.h
|
||||
@@ -0,0 +1,717 @@
|
||||
@ -858,18 +859,26 @@ index 0000000..7d54cdf
|
||||
+ clear_binds();
|
||||
+ } else if (strcmp("clear-rules",argument) == 0 ) {
|
||||
+ clear_rules();
|
||||
+ } else if (strcmp("func",argument) == 0) {
|
||||
+ args->type = ZRIVER_ARG_TYPE_FUNC;
|
||||
+ args->p.fa = calloc(1,sizeof(struct zriver_func_arg_pair));
|
||||
+ if (args->p.fa == NULL) {
|
||||
+ args->error = true;
|
||||
+ args->error_msg = zriver_error_alloc;
|
||||
+ } else {
|
||||
+ args->str_link = add_arg_str_store(argument);
|
||||
+ }
|
||||
+ } else {
|
||||
+ args->error = true;
|
||||
+ args->error_msg = zriver_error_no_matching_argument;
|
||||
+ for (fst = Func_str_type_pair_list; fst < END(Func_str_type_pair_list); fst++) {
|
||||
+ if (strcmp(argument,fst->func_str) == 0) {
|
||||
+ args->type = ZRIVER_ARG_TYPE_FUNC;
|
||||
+ args->p.fa = calloc(1,sizeof(struct zriver_func_arg_pair));
|
||||
+ if (args->p.fa == NULL) {
|
||||
+ args->error = true;
|
||||
+ args->error_msg = zriver_error_alloc;
|
||||
+ } else {
|
||||
+ args->str_link = add_arg_str_store(argument);
|
||||
+ args->p.fa->func = fst->func;
|
||||
+ args->key_arg_type = fst->arg_type;
|
||||
+ }
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ if (args->error != true && args->type != ZRIVER_ARG_TYPE_FUNC) {
|
||||
+ args->error = true;
|
||||
+ args->error_msg = zriver_error_no_matching_argument;
|
||||
+ }
|
||||
+ }
|
||||
+ } else if (args->type == ZRIVER_ARG_TYPE_RULE && args->str_link != NULL) {
|
||||
+ switch (args->rule_match_type) {
|
||||
@ -944,17 +953,9 @@ index 0000000..7d54cdf
|
||||
+
|
||||
+ } else if (args->type == ZRIVER_ARG_TYPE_FUNC) {
|
||||
+ if (args->argc == 1) {
|
||||
+ for (fst = Func_str_type_pair_list; fst < END(Func_str_type_pair_list); fst++) {
|
||||
+ if (strcmp(argument,fst->func_str) == 0) {
|
||||
+ args->p.fa->func = fst->func;
|
||||
+ args->key_arg_type = fst->arg_type;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ } else if (args->argc == 2) {
|
||||
+ arg_filter = true;
|
||||
+ arg = &args->p.fa->arg;
|
||||
+ } else if (args->argc > 2 && args->argc < STR_LINK_ARRAY_SIZE && args->key_arg_type == FUNC_STR_ARG_TYPE_STRING_ARRAY && args->p.kl->key->arg.v != NULL) {
|
||||
+ } else if (args->argc > 1 && args->argc < STR_LINK_ARRAY_SIZE && args->key_arg_type == FUNC_STR_ARG_TYPE_STRING_ARRAY && args->p.kl->key->arg.v != NULL) {
|
||||
+ append_str_store((char**)args->p.fa->arg.v,argument,args->argc-2);
|
||||
+ }
|
||||
+ } else if (args->type == ZRIVER_ARG_TYPE_KEY) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user