diff options
| author | Chris Sobczak <chris@sobczak.family> | 2026-06-26 21:03:33 -0700 |
|---|---|---|
| committer | Chris Sobczak <chris@sobczak.family> | 2026-06-26 21:03:33 -0700 |
| commit | 463317c1e513d309fabafccb7c638a903baf0451 (patch) | |
| tree | 88473f46c1efda4a1f7503acff621e0282bda2fd /dwl.c | |
| parent | 6dcdee9bda242a6f9ee8b67b94d358280fd5c202 (diff) | |
| parent | ca89cdad32e44cbd07ff2125ff668118c23dec70 (diff) | |
Merge branch 'movestack' into csobczak
Add movestack to csobczak
Diffstat (limited to 'dwl.c')
| -rw-r--r-- | dwl.c | 43 |
1 files changed, 43 insertions, 0 deletions
@@ -300,6 +300,7 @@ static void locksession(struct wl_listener *listener, void *data); static void mapnotify(struct wl_listener *listener, void *data); static void maximizenotify(struct wl_listener *listener, void *data); static void monocle(Monitor *m); +static void movestack(const Arg *arg); static void motionabsolute(struct wl_listener *listener, void *data); static void motionnotify(uint32_t time, struct wlr_input_device *device, double sx, double sy, double sx_unaccel, double sy_unaccel); @@ -1839,6 +1840,48 @@ monocle(Monitor *m) } void +movestack(const Arg *arg) +{ + Client *c, *sel = focustop(selmon); + + if (!sel) { + return; + } + + if (wl_list_length(&clients) <= 1) { + return; + } + + if (arg->i > 0) { + wl_list_for_each(c, &sel->link, link) { + if (&c->link == &clients) { + c = wl_container_of(&clients, c, link); + break; /* wrap past the sentinel node */ + } + if (VISIBLEON(c, selmon) || &c->link == &clients) { + break; /* found it */ + } + } + } else { + wl_list_for_each_reverse(c, &sel->link, link) { + if (&c->link == &clients) { + c = wl_container_of(&clients, c, link); + break; /* wrap past the sentinel node */ + } + if (VISIBLEON(c, selmon) || &c->link == &clients) { + break; /* found it */ + } + } + /* backup one client */ + c = wl_container_of(c->link.prev, c, link); + } + + wl_list_remove(&sel->link); + wl_list_insert(&c->link, &sel->link); + arrange(selmon); +} + +void motionabsolute(struct wl_listener *listener, void *data) { /* This event is forwarded by the cursor when a pointer emits an _absolute_ |
