Applied the movestack patch

This commit is contained in:
Micah Gorrell 2023-05-12 16:59:40 -06:00
parent c8eaadfab3
commit 7fee7bac29
3 changed files with 105 additions and 0 deletions

31
dwl.c
View file

@ -293,6 +293,7 @@ static void maplayersurfacenotify(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);
static void motionrelative(struct wl_listener *listener, void *data);
@ -1832,6 +1833,36 @@ monocle(Monitor *m)
wlr_scene_node_raise_to_top(&c->scene->node);
}
void
movestack(const Arg *arg)
{
Client *c, *sel = focustop(selmon);
if (wl_list_length(&clients) <= 1) {
return;
}
if (arg->i > 0) {
wl_list_for_each(c, &sel->link, link) {
if (VISIBLEON(c, selmon) || &c->link == &clients) {
break; /* found it */
}
}
} else {
wl_list_for_each_reverse(c, &sel->link, link) {
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)
{