From 268bee3cee239e5bd52cceed88a52bfc21143cc3 Mon Sep 17 00:00:00 2001 From: Nikita Ivanov Date: Fri, 14 Feb 2025 20:21:27 +0100 Subject: [PATCH] setrule: improve README.md --- patches/setrule/README.md | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/patches/setrule/README.md b/patches/setrule/README.md index d993890..072f256 100644 --- a/patches/setrule/README.md +++ b/patches/setrule/README.md @@ -3,12 +3,14 @@ This patch adds an ability to add or change client rules at runtime. The patch only adds one keybinding (`Alt+Shift+R`) to toggle `isfloating` -option, but this can be easily extended if you want to tweak other options as -well. You just need to define a new function similar to `setruleisfloating` and -add a new keybinding to `config.h`. +option. Upon pressing it, dwl will try to find a matching rule for the focused +client and change its `isfloating` setting. If there's no such a rule, a new +rule will be added. The new rule will inherit an appid of the focused client. -For example, this is a function I created for my build to toggle `noswallow` -option from the [swallow][swallow] patch: +It's very easy to add support for more rule options from other patches as well. +You just need to define a new function similar to `setruleisfloating` and add a +new keybinding to `config.h`. For example, this is a function I created for my +build to toggle `noswallow` option from the [swallow][swallow] patch: ```c void @@ -21,8 +23,12 @@ setrulenoswallow(const Arg *arg) } ``` +**NOTE**: This patch makes it impossible to have rules with `NULL` title *and* +appid (such a rule is used internally to mark the end of `rules` array). + **NOTE:** If you happen to apply patches that add new options to the rules, make -sure to update `rule_default` variable in `config.h` as well. +sure to update `rule_default` variable in `config.h` as well. This variable is +used for newly created rules. [swallow]: /dwl/dwl-patches/src/branch/main/patches/swallow