mirror of
				https://codeberg.org/dwl/dwl-patches.git
				synced 2025-10-31 03:54:19 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			57 lines
		
	
	
		
			1.9 KiB
		
	
	
	
		
			Diff
		
	
	
	
	
	
			
		
		
	
	
			57 lines
		
	
	
		
			1.9 KiB
		
	
	
	
		
			Diff
		
	
	
	
	
	
| diff --git a/config.def.h b/config.def.h
 | |
| index 22d2171..6029666 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,          rotate_clients, {.i = +1} },
 | |
| +    { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_K,          rotate_clients, {.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 a2711f6..6dfd87d 100644
 | |
| --- a/dwl.c
 | |
| +++ b/dwl.c
 | |
| @@ -355,6 +355,7 @@ static Monitor *xytomon(double x, double y);
 | |
|  static void xytonode(double x, double y, struct wlr_surface **psurface,
 | |
|  		Client **pc, LayerSurface **pl, double *nx, double *ny);
 | |
|  static void zoom(const Arg *arg);
 | |
| +static void rotate_clients(const Arg *arg);
 | |
|  
 | |
|  /* variables */
 | |
|  static const char broken[] = "broken";
 | |
| @@ -3054,6 +3055,30 @@ zoom(const Arg *arg)
 | |
|  	arrange(selmon);
 | |
|  }
 | |
|  
 | |
| +static void rotate_clients(const Arg *arg) {
 | |
| +	Monitor* m = selmon;
 | |
| +	Client *c;
 | |
| +	Client *first = NULL;
 | |
| +	Client *last = NULL;
 | |
| +
 | |
| +	if (arg->i == 0)
 | |
| +		return;
 | |
| +
 | |
| +	wl_list_for_each(c, &clients, link) {
 | |
| +		if (VISIBLEON(c, m) && !c->isfloating && !c->isfullscreen) {
 | |
| +			if (first == NULL) first = c;
 | |
| +			last = c;
 | |
| +		}
 | |
| +	}
 | |
| +	if (first != last) {
 | |
| +		struct wl_list *append_to = (arg->i > 0) ? &last->link : first->link.prev;
 | |
| +		struct wl_list *elem = (arg->i > 0) ? &first->link : &last->link;
 | |
| +		wl_list_remove(elem);
 | |
| +		wl_list_insert(append_to, elem);
 | |
| +		arrange(selmon);
 | |
| +	} 
 | |
| +}
 | |
| +
 | |
|  #ifdef XWAYLAND
 | |
|  void
 | |
|  activatex11(struct wl_listener *listener, void *data)
 | 
