Add movestack patch

This commit is contained in:
Sravan Balaji
2024-10-06 08:33:01 -04:00
parent 339440ac43
commit 3d182ed166
6 changed files with 141 additions and 0 deletions

39
dwl.c
View File

@@ -388,6 +388,9 @@ 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);
#if MOVESTACK_PATCH
static void movestack(const Arg *arg);
#endif // MOVESTACK_PATCH
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);
@@ -2572,6 +2575,42 @@ monocle(Monitor *m)
wlr_scene_node_raise_to_top(&c->scene->node);
}
#if MOVESTACK_PATCH
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 (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);
}
#endif // MOVESTACK_PATCH
void
motionabsolute(struct wl_listener *listener, void *data)
{