diff options
Diffstat (limited to '')
| -rw-r--r-- | config.def.h | 5 | ||||
| -rw-r--r-- | dwl.c | 43 | ||||
| -rw-r--r-- | patches/applied/movestack.patch | 87 | 
3 files changed, 134 insertions, 1 deletions
| diff --git a/config.def.h b/config.def.h index 8d1ee06..eec3800 100644 --- a/config.def.h +++ b/config.def.h @@ -128,6 +128,7 @@ static const enum libinput_config_tap_button_map button_map = LIBINPUT_CONFIG_TA  /* If you want to use the windows key for MODKEY, use WLR_MODIFIER_LOGO */  #define MODKEY WLR_MODIFIER_LOGO +#define METAKEY WLR_MODIFIER_ALT  #define TAGKEYS(KEY,SKEY,TAG) \  	{ MODKEY,                    KEY,            view,            {.ui = 1 << TAG} }, \ @@ -152,12 +153,14 @@ static const Key keys[] = {  	{ MODKEY,                    XKB_KEY_b,          togglebar,      {0} },  	{ MODKEY,                    XKB_KEY_j,          focusstack,     {.i = +1} },  	{ MODKEY,                    XKB_KEY_k,          focusstack,     {.i = -1} }, +	{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_J,          movestack,      {.i = +1} }, +	{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_K,          movestack,      {.i = -1} },  	{ MODKEY,                    XKB_KEY_i,          incnmaster,     {.i = +1} },  	{ MODKEY,                    XKB_KEY_d,          incnmaster,     {.i = -1} },  	{ MODKEY|WLR_MODIFIER_CTRL,  XKB_KEY_h,          setmfact,       {.f = -0.05f} },  	{ MODKEY|WLR_MODIFIER_CTRL,  XKB_KEY_l,          setmfact,       {.f = +0.05f} },  	{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Return,     zoom,           {0} }, -	{ MODKEY,                    XKB_KEY_Tab,        view,           {0} }, +	{ METAKEY,                   XKB_KEY_Escape,     view,           {0} },  	{ MODKEY,                    XKB_KEY_q,          killclient,     {0} },  	{ MODKEY,                    XKB_KEY_s,          setlayout,      {.v = &layouts[0]} },  	{ MODKEY,                    XKB_KEY_n,          setlayout,      {.v = &layouts[1]} }, @@ -340,6 +340,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); @@ -2057,6 +2058,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_ diff --git a/patches/applied/movestack.patch b/patches/applied/movestack.patch new file mode 100644 index 0000000..2543c66 --- /dev/null +++ b/patches/applied/movestack.patch @@ -0,0 +1,87 @@ +From 08230817bd3926e29d9897657eb1852cb27d461f Mon Sep 17 00:00:00 2001 +From: Nikita Ivanov <nikita.vyach.ivanov@gmail.com> +Date: Tue, 4 Feb 2025 23:21:19 +0100 +Subject: [PATCH] Allows you to move a window up and down the stack + +--- + config.def.h |  2 ++ + dwl.c        | 43 +++++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 45 insertions(+) + +diff --git a/config.def.h b/config.def.h +index 22d2171..2c129f2 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -129,6 +129,8 @@ static const Key keys[] = { + 	{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Return,     spawn,          {.v = termcmd} }, + 	{ MODKEY,                    XKB_KEY_j,          focusstack,     {.i = +1} }, + 	{ MODKEY,                    XKB_KEY_k,          focusstack,     {.i = -1} }, ++	{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_J,          movestack,      {.i = +1} }, ++	{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_K,          movestack,      {.i = -1} }, + 	{ MODKEY,                    XKB_KEY_i,          incnmaster,     {.i = +1} }, + 	{ MODKEY,                    XKB_KEY_d,          incnmaster,     {.i = -1} }, + 	{ MODKEY,                    XKB_KEY_h,          setmfact,       {.f = -0.05f} }, +diff --git a/dwl.c b/dwl.c +index def2562..045d6fa 100644 +--- a/dwl.c ++++ b/dwl.c +@@ -303,6 +303,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); +@@ -1786,6 +1787,48 @@ monocle(Monitor *m) + 		wlr_scene_node_raise_to_top(&c->scene->node); + } +  ++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) + { +--  +2.48.1 + | 
