Compare commits

...

6 Commits

Author SHA1 Message Date
Nikita Ivanov
9cce9a2ca5
setrule: fix function formatting in the example 2025-02-14 00:07:05 +01:00
Nikita Ivanov
5e6df4bdb2
setrule: add a note + fix style 2025-02-14 00:05:15 +01:00
Nikita Ivanov
97be2a869d
Add setrule patch 2025-02-14 00:01:07 +01:00
Nikita Ivanov
75ddb1b2c2
Fix author list links with my name 2025-02-13 23:45:14 +01:00
Nikita Ivanov
e4b2e9112c
Update naturalscrolltrackpad patch 2025-02-13 23:20:29 +01:00
julmajustus
2eda9f1f5f btrtile refactor: simplified codebase and added support for multi-tag view/toggle 2025-02-13 23:42:20 +02:00
11 changed files with 929 additions and 1149 deletions

View File

@ -51,10 +51,6 @@ When a new client appears:
# What It Doesnt Handle
- **Multi-Tag client Management**
btrtile intentionally reverts clients to a single tag if they span multiple tags. This prevents potential inconsistencies or duplicate entries in its per-tag client tree.
- If you attempt to place a single client on multiple tags while using the btrtile layout, btrtile will enforce a single-tag assignment to maintain stability.
- **Suckless philosophy**
- Yea, it's a bloat. I tried to hide the suck inside a single file as much I could. While this approach is not ideal, it's how it's at least for now.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -7,5 +7,5 @@ Always use the English keymap to get keycodes, so key bindings work even when us
### Authors
- [ForzCross](https://codeberg.org/ForzCross)
- [Nikita Ivanov](https://github.com/NikitaIvanovV)
- [Nikita Ivanov](https://codeberg.org/nikitaivanov) ([GitHub](https://github.com/NikitaIvanovV))
- [dimkr](https://codeberg.org/dimkr) (<dima@dimakrasner.com>)

View File

@ -22,7 +22,4 @@ gaps to be as big or bigger than "inner" gaps anyway.
### Authors
- Nikita Ivanov ([codeberg][codeberg]) ([GitHub][github])
[codeberg]: https://codeberg.org/nikitaivanov
[github]: https://github.com/NikitaIvanovV
- [Nikita Ivanov](https://codeberg.org/nikitaivanov) ([GitHub](https://github.com/NikitaIvanovV))

View File

@ -1,4 +1,5 @@
### Description
This patch adds per-client keyboard layout and ability to send current
keyboard layout information to a status bar.
@ -21,9 +22,11 @@ implementation happens to share some code. If you don't need
any of these features, just disable it in `config.h`.
### Download
- [git branch](https://codeberg.org/nikitaivanov/dwl/src/branch/kblayout)
- [0.7](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/kblayout/kblayout.patch)
### Authors
- [Nikita Ivanov](https://codeberg.org/nikitaivanov) ([GitHub](https://github.com/NikitaIvanovV))
- [ForzCross](https://codeberg.org/ForzCross)
- [Nikita Ivanov](https://github.com/NikitaIvanovV)

View File

@ -13,4 +13,4 @@ Edit `menus` array in `config.h` to add/change menus and use a different dmenu p
- [2024-07-13](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/menu/menu.patch)
### Authors
- [Nikita Ivanov](https://github.com/NikitaIvanovV)
- [Nikita Ivanov](https://codeberg.org/nikitaivanov) ([GitHub](https://github.com/NikitaIvanovV))

View File

@ -1,10 +1,14 @@
### Description
Set natural scrolling only for trackpads.
Set natural scrolling only for trackpads. Without this patch, setting
`natural_scrolling` to 1 in `config.h` results in a regular mouse wheel having
natural scrolling enabled as well.
### Download
- [git branch](https://codeberg.org/neuromagus/dwl/src/branch/naturalscrolltrackpad)
- [2024-01-06](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/naturalscrolltrackpad/naturalscrolltrackpad.patch)
- [0.7](/dwl/dwl-patches/raw/branch/main/patches/naturalscrolltrackpad/naturalscrolltrackpad.patch)
### Authors
- [Nikita Ivanov](https://codeberg.org/nikitaivanov) ([GitHub](https://github.com/NikitaIvanovV))
- [Neuromagus](https://codeberg.org/neuromagus)
- [Nikita Ivanov](https://github.com/NikitaIvanovV)

View File

@ -1,27 +1,30 @@
From 8b523453aefdc9d2920c8f9a52de009da251fbb0 Mon Sep 17 00:00:00 2001
From: neuromagus <neuromagus@mail.ru>
Date: Sun, 7 Jan 2024 05:11:24 +0300
Subject: [PATCH] apply patch naturalscrolltrackpad
From 63f38e7ccda8067a0558a6e81baad89ffbba9d6a Mon Sep 17 00:00:00 2001
From: Nikita Ivanov <nikita.vyach.ivanov@gmail.com>
Date: Sat, 8 Feb 2025 16:31:09 +0100
Subject: [PATCH] Set natural scrolling only for trackpads
---
dwl.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
dwl.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/dwl.c b/dwl.c
index 4d19357..26f394b 100644
index def2562..f6bb544 100644
--- a/dwl.c
+++ b/dwl.c
@@ -974,11 +974,10 @@ createpointer(struct wlr_pointer *pointer)
@@ -1085,10 +1085,10 @@ createpointer(struct wlr_pointer *pointer)
libinput_device_config_tap_set_drag_enabled(device, tap_and_drag);
libinput_device_config_tap_set_drag_lock_enabled(device, drag_lock);
libinput_device_config_tap_set_button_map(device, button_map);
+ if (libinput_device_config_scroll_has_natural_scroll(device))
+ libinput_device_config_scroll_set_natural_scroll_enabled(device, natural_scrolling);
}
- }
- if (libinput_device_config_scroll_has_natural_scroll(device))
- libinput_device_config_scroll_set_natural_scroll_enabled(device, natural_scrolling);
-
+ if (libinput_device_config_scroll_has_natural_scroll(device))
+ libinput_device_config_scroll_set_natural_scroll_enabled(device, natural_scrolling);
+ }
if (libinput_device_config_dwt_is_available(device))
libinput_device_config_dwt_set_enabled(device, disable_while_typing);
--
2.48.1

35
patches/setrule/README.md Normal file
View File

@ -0,0 +1,35 @@
### Description
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`.
For example, this is a function I created for my build to toggle `noswallow`
option from the [swallow][swallow] patch:
```c
void
setrulenoswallow(const Arg *arg)
{
Rule *r = getrule(focustop(selmon));
if (!r)
return;
r->noswallow = !r->noswallow;
}
```
**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.
[swallow]: /dwl/dwl-patches/src/branch/main/patches/swallow
### Download
- [0.7](/dwl/dwl-patches/raw/branch/main/patches/setrule/setrule.patch)
### Authors
- [Nikita Ivanov](https://codeberg.org/nikitaivanov) ([GitHub](https://github.com/NikitaIvanovV))

View File

@ -0,0 +1,143 @@
From 8ac024bd9aebfe73a44069aae5ddd4499e9e1713 Mon Sep 17 00:00:00 2001
From: Nikita Ivanov <nikita.vyach.ivanov@gmail.com>
Date: Sun, 9 Feb 2025 23:12:09 +0100
Subject: [PATCH] setrule: add/change rules at runtime
---
config.def.h | 9 ++++++++-
dwl.c | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 64 insertions(+), 2 deletions(-)
diff --git a/config.def.h b/config.def.h
index 22d2171..666a8c3 100644
--- a/config.def.h
+++ b/config.def.h
@@ -20,14 +20,20 @@ static const float fullscreen_bg[] = {0.1f, 0.1f, 0.1f, 1.0f}; /* You ca
/* logging */
static int log_level = WLR_ERROR;
+/* Max amount of rules */
+#define RULES_MAX 100
+
/* NOTE: ALWAYS keep a rule declared even if you don't use rules (e.g leave at least one example) */
-static const Rule rules[] = {
+static Rule rules[RULES_MAX] = {
/* app_id title tags mask isfloating monitor */
/* examples: */
{ "Gimp_EXAMPLE", NULL, 0, 1, -1 }, /* Start on currently visible tags floating, not tiled */
{ "firefox_EXAMPLE", NULL, 1 << 8, 0, -1 }, /* Start on ONLY tag "9" */
};
+static const Rule rule_default =
+ { NULL, NULL, 0, 0, -1 };
+
/* layout(s) */
static const Layout layouts[] = {
/* symbol arrange function */
@@ -142,6 +148,7 @@ static const Key keys[] = {
{ MODKEY, XKB_KEY_space, setlayout, {0} },
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_space, togglefloating, {0} },
{ MODKEY, XKB_KEY_e, togglefullscreen, {0} },
+ { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_R, setruleisfloating,{0} },
{ MODKEY, XKB_KEY_0, view, {.ui = ~0} },
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_parenright, tag, {.ui = ~0} },
{ MODKEY, XKB_KEY_comma, focusmon, {.i = WLR_DIRECTION_LEFT} },
diff --git a/dwl.c b/dwl.c
index def2562..82929ca 100644
--- a/dwl.c
+++ b/dwl.c
@@ -290,6 +290,7 @@ static void focusmon(const Arg *arg);
static void focusstack(const Arg *arg);
static Client *focustop(Monitor *m);
static void fullscreennotify(struct wl_listener *listener, void *data);
+static Rule *getrule(Client *c);
static void gpureset(struct wl_listener *listener, void *data);
static void handlesig(int signo);
static void incnmaster(const Arg *arg);
@@ -331,6 +332,7 @@ static void setlayout(const Arg *arg);
static void setmfact(const Arg *arg);
static void setmon(Client *c, Monitor *m, uint32_t newtags);
static void setpsel(struct wl_listener *listener, void *data);
+static void setruleisfloating(const Arg *arg);
static void setsel(struct wl_listener *listener, void *data);
static void setup(void);
static void spawn(const Arg *arg);
@@ -466,7 +468,7 @@ applyrules(Client *c)
if (!(title = client_get_title(c)))
title = broken;
- for (r = rules; r < END(rules); r++) {
+ for (r = rules; r->id || r->title; r++) {
if ((!r->title || strstr(title, r->title))
&& (!r->id || strstr(appid, r->id))) {
c->isfloating = r->isfloating;
@@ -1472,6 +1474,50 @@ fullscreennotify(struct wl_listener *listener, void *data)
setfullscreen(c, client_wants_fullscreen(c));
}
+Rule *
+getrule(Client *c)
+{
+ Rule *r, *e = NULL;
+ const char *appid, *title;
+
+ if (!c)
+ return NULL;
+
+ if (!(appid = client_get_appid(c)))
+ appid = broken;
+ if (!(title = client_get_title(c)))
+ title = broken;
+
+ /*
+ * Find first matching rule from the end. It seems intuitive to me
+ * that the the first matching rule from the end is going to be
+ * overriden. I also do not include the last element (hence -2)
+ * in the search because we always want to keep at least one empty
+ * slot for applyrules().
+ */
+ for (r = END(rules) - 2; r >= rules; r--) {
+ if (!r->title && !r->id) {
+ e = r;
+ } else {
+ if ((!r->title || strstr(title, r->title))
+ && (!r->id || strstr(appid, r->id))) {
+ break;
+ }
+ }
+ }
+ if (r < rules)
+ r = e;
+ if (!r) /* No free slots left */
+ return NULL;
+ if (r == e) { /* Fill the empty slot */
+ *r = rule_default;
+ /* r->title = strdup(title); */
+ r->id = strdup(appid);
+ }
+
+ return r;
+}
+
void
gpureset(struct wl_listener *listener, void *data)
{
@@ -2417,6 +2463,15 @@ setpsel(struct wl_listener *listener, void *data)
wlr_seat_set_primary_selection(seat, event->source, event->serial);
}
+void
+setruleisfloating(const Arg *arg)
+{
+ Rule *r = getrule(focustop(selmon));
+ if (!r)
+ return;
+ r->isfloating = !r->isfloating;
+}
+
void
setsel(struct wl_listener *listener, void *data)
{
--
2.48.1