Add the sticky patch 😋
This commit is contained in:
		
							parent
							
								
									ebef7612c5
								
							
						
					
					
						commit
						b0a61cefb5
					
				
					 4 changed files with 119 additions and 47 deletions
				
			
		
							
								
								
									
										90
									
								
								README.md
									
										
									
									
									
								
							
							
						
						
									
										90
									
								
								README.md
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -13,52 +13,54 @@
 | 
			
		|||
- [movestack](https://dwm.suckless.org/patches/movestack)
 | 
			
		||||
- [pertag](https://dwm.suckless.org/patches/pertag)
 | 
			
		||||
- [systray](https://dwm.suckless.org/patches/systray)
 | 
			
		||||
- [sticky](https://dwm.suckless.org/patches/sticky)
 | 
			
		||||
 | 
			
		||||
### Keys
 | 
			
		||||
| Keys                           | Function                                           |
 | 
			
		||||
|--------------------------------|----------------------------------------------------|
 | 
			
		||||
| modkey + shift + d             | Open dmenu (launcher)                              |
 | 
			
		||||
| modkey + shift + ctrl          | Open rofi launcher (small size)                    |
 | 
			
		||||
| modkey + enter                 | Launche the main terminal (alacritty by default)      |
 | 
			
		||||
| modkey + t -> 1                | Launche the main terminal with tmux                   |
 | 
			
		||||
| modkey + shift + f -> g        | Launche the GUI file manger (dolphin by default)      |
 | 
			
		||||
| modkey + shift + f -> r        | Launche rofi file file browser (small size)           |
 | 
			
		||||
| modkey + w -> g                | Launche google chrome browser                         |
 | 
			
		||||
| modkey + w -> t                | Launche tor browser                                   |
 | 
			
		||||
| modkey + c -> d                | Launche discord                                      |
 | 
			
		||||
| modkey + a -> j                | Launche jetbrains-toolbox                            |
 | 
			
		||||
| modkey + a -> n                | Launche NeoVim in the main terminal                  |
 | 
			
		||||
| modkey + a -> v                | Launche Vim in the main terminal                     |
 | 
			
		||||
| modkey + e                     | Launche rofi emoji selector                          |
 | 
			
		||||
| modkey + f                     | Toggle full screen mode                              |
 | 
			
		||||
| modkey + b                     | Toggle the status bar (hide/show)                    |
 | 
			
		||||
| modkey + j                     | Change the focus to privus window in the stack       |
 | 
			
		||||
| modkey + k                     | Change the focus to the next window in the stack     |
 | 
			
		||||
| modkey + i                     | Change the stack layout to virtecal                  |
 | 
			
		||||
| modkey + d                     | Change the stack layout to horizontal                |
 | 
			
		||||
| modkey + h                     | Decrease the focus window size                       |
 | 
			
		||||
| modkey + l                     | Increase the focus window size                       |
 | 
			
		||||
| modkey + Tab                   | Toggle between the curent tag and the privus tag     |
 | 
			
		||||
| modkey + shift + j             | Move the focus window down in the stack              |
 | 
			
		||||
| modkey + shift + k             | Move the focus window up in the stack                |
 | 
			
		||||
| modkey + q -> q                | Quit from the focus window (kill it)                 |
 | 
			
		||||
| modkey + s -> t                | Use the tile layout                                  |
 | 
			
		||||
| modkey + s -> f                | Use the float layout                                  |
 | 
			
		||||
| modkey + s -> m                | Use the monocle layout                                  |
 | 
			
		||||
| modkey + s -> g                | Use the grid layout                                  |
 | 
			
		||||
| modkey + s -> space            | Toggle between current layout and tile layout        |
 | 
			
		||||
| modkey + alt + f               | Toggle floating window                               |
 | 
			
		||||
| modkey + 0                     | View all tags                                         |
 | 
			
		||||
| modkey + shift + 0             | Mirror the current tag in all tags                   |
 | 
			
		||||
| modkey + comma (,)             | -                                                    |
 | 
			
		||||
| modkey + period (.)            | -                                                    |
 | 
			
		||||
| modkey + shift + comma (,)     | -                                                    |
 | 
			
		||||
| modkey + shift + period (.)    | -                                                    |
 | 
			
		||||
| modkey + (1..9)                | Navigate between tags                                |
 | 
			
		||||
| PrtSc                          | Take a screenshot using default screenshot tool (spectacle) |
 | 
			
		||||
| modkey + shift + x             | Lock the screen (using betterlockscreen)             |
 | 
			
		||||
| modkey + shift + ctrl + x      | Plasma screen server                                 |
 | 
			
		||||
| modkey + shift + alt + q       | Kill dwm                                             |
 | 
			
		||||
| Keys                           | Function                                                              |
 | 
			
		||||
|--------------------------------|-----------------------------------------------------------------------|
 | 
			
		||||
| modkey + shift + d             | Open dmenu (launcher)                                                 |
 | 
			
		||||
| modkey + shift + ctrl          | Open rofi launcher (small size)                                       |
 | 
			
		||||
| modkey + enter                 | Launche the main terminal (alacritty by default)                      |
 | 
			
		||||
| modkey + t -> 1                | Launche the main terminal with tmux                                   |
 | 
			
		||||
| modkey + shift + f -> g        | Launche the GUI file manger (dolphin by default)                      |
 | 
			
		||||
| modkey + shift + f -> r        | Launche rofi file file browser (small size)                           |
 | 
			
		||||
| modkey + w -> g                | Launche google chrome browser                                         |
 | 
			
		||||
| modkey + w -> t                | Launche tor browser                                                   |
 | 
			
		||||
| modkey + c -> d                | Launche discord                                                       |
 | 
			
		||||
| modkey + a -> j                | Launche jetbrains-toolbox                                             |
 | 
			
		||||
| modkey + a -> n                | Launche NeoVim in the main terminal                                   |
 | 
			
		||||
| modkey + a -> v                | Launche Vim in the main terminal                                      |
 | 
			
		||||
| modkey + e                     | Launche rofi emoji selector                                           |
 | 
			
		||||
| modkey + f                     | Toggle full screen mode                                               |
 | 
			
		||||
| modkey + b                     | Toggle the status bar (hide/show)                                     |
 | 
			
		||||
| modkey + j                     | Change the focus to privus window in the stack                        |
 | 
			
		||||
| modkey + k                     | Change the focus to the next window in the stack                      |
 | 
			
		||||
| modkey + i                     | Change the stack layout to virtecal                                   |
 | 
			
		||||
| modkey + d                     | Change the stack layout to horizontal                                 |
 | 
			
		||||
| modkey + h                     | Decrease the focus window size                                        |
 | 
			
		||||
| modkey + l                     | Increase the focus window size                                        |
 | 
			
		||||
| modkey + Tab                   | Toggle between the curent tag and the privus tag                      |
 | 
			
		||||
| modkey + shift + j             | Move the focus window down in the stack                               |
 | 
			
		||||
| modkey + shift + k             | Move the focus window up in the stack                                 |
 | 
			
		||||
| modkey + q -> q                | Quit from the focus window (kill it)                                  |
 | 
			
		||||
| modkey + s -> t                | Use the tile layout                                                   |
 | 
			
		||||
| modkey + s -> f                | Use the float layout                                                  |
 | 
			
		||||
| modkey + s -> m                | Use the monocle layout                                                |
 | 
			
		||||
| modkey + s -> g                | Use the grid layout                                                   |
 | 
			
		||||
| modkey + s -> space            | Toggle between current layout and tile layout                         |
 | 
			
		||||
| modkey + shift + s             | Toggle sticky mode                                                    |
 | 
			
		||||
| modkey + alt + f               | Toggle floating window                                                |
 | 
			
		||||
| modkey + 0                     | View all tags                                                         |
 | 
			
		||||
| modkey + shift + 0             | Mirror the current tag in all tags                                    |
 | 
			
		||||
| modkey + comma (,)             | -                                                                     |
 | 
			
		||||
| modkey + period (.)            | -                                                                     |
 | 
			
		||||
| modkey + shift + comma (,)     | -                                                                     |
 | 
			
		||||
| modkey + shift + period (.)    | -                                                                     |
 | 
			
		||||
| modkey + (1..9)                | Navigate between tags                                                 |
 | 
			
		||||
| PrtSc                          | Take a screenshot using default screenshot tool (spectacle)           |
 | 
			
		||||
| modkey + shift + x             | Lock the screen (using betterlockscreen)                              |
 | 
			
		||||
| modkey + shift + ctrl + x      | Plasma screen server                                                  |
 | 
			
		||||
| modkey + shift + alt + q       | Kill dwm                                                              |
 | 
			
		||||
 | 
			
		||||
> modkey = win key or super key
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										4
									
								
								config.h
									
										
									
									
									
								
							
							
						
						
									
										4
									
								
								config.h
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -140,7 +140,9 @@ static Keychord keychords[] = {
 | 
			
		|||
	{1, {{MODKEY,                   XK_Tab}},    view,           {0} },
 | 
			
		||||
 | 
			
		||||
	{1, {{MODKEY|ShiftMask,         XK_j}},      movestack,      {.i = +1 } }, 
 | 
			
		||||
	{1, {{MODKEY|ShiftMask,          XK_k}},      movestack,      {.i = -1 } }, 
 | 
			
		||||
	{1, {{MODKEY|ShiftMask,          XK_k}},     movestack,      {.i = -1 } }, 
 | 
			
		||||
        // Toogle styky mode
 | 
			
		||||
        {1, {{MODKEY|ShiftMask,          XK_s}},     togglesticky,    {0} },
 | 
			
		||||
    
 | 
			
		||||
	// Quit from the foucsed window (kill)
 | 
			
		||||
	{2, {{MODKEY, XK_q},            {0, XK_q}},      killclient,     {0} },
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										14
									
								
								dwm.c
									
										
									
									
									
								
							
							
						
						
									
										14
									
								
								dwm.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -49,7 +49,7 @@
 | 
			
		|||
#define CLEANMASK(mask)         (mask & ~(numlockmask|LockMask) & (ShiftMask|ControlMask|Mod1Mask|Mod2Mask|Mod3Mask|Mod4Mask|Mod5Mask))
 | 
			
		||||
#define INTERSECT(x,y,w,h,m)    (MAX(0, MIN((x)+(w),(m)->wx+(m)->ww) - MAX((x),(m)->wx)) \
 | 
			
		||||
                               * MAX(0, MIN((y)+(h),(m)->wy+(m)->wh) - MAX((y),(m)->wy)))
 | 
			
		||||
#define ISVISIBLE(C)            ((C->tags & C->mon->tagset[C->mon->seltags]))
 | 
			
		||||
#define ISVISIBLE(C)            ((C->tags & C->mon->tagset[C->mon->seltags]) || C->issticky)
 | 
			
		||||
#define LENGTH(X)               (sizeof X / sizeof X[0])
 | 
			
		||||
#define MOUSEMASK               (BUTTONMASK|PointerMotionMask)
 | 
			
		||||
#define WIDTH(X)                ((X)->w + 2 * (X)->bw)
 | 
			
		||||
| 
						 | 
				
			
			@ -107,7 +107,7 @@ struct Client {
 | 
			
		|||
	int basew, baseh, incw, inch, maxw, maxh, minw, minh, hintsvalid;
 | 
			
		||||
	int bw, oldbw;
 | 
			
		||||
	unsigned int tags;
 | 
			
		||||
	int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen;
 | 
			
		||||
	int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen, issticky;
 | 
			
		||||
	Client *next;
 | 
			
		||||
	Client *snext;
 | 
			
		||||
	Monitor *mon;
 | 
			
		||||
| 
						 | 
				
			
			@ -246,6 +246,7 @@ static void tagmon(const Arg *arg);
 | 
			
		|||
static void tile(Monitor *);
 | 
			
		||||
static void togglebar(const Arg *arg);
 | 
			
		||||
static void togglefloating(const Arg *arg);
 | 
			
		||||
static void togglesticky(const Arg *arg);
 | 
			
		||||
static void toggletag(const Arg *arg);
 | 
			
		||||
static void toggleview(const Arg *arg);
 | 
			
		||||
static void unfocus(Client *c, int setfocus);
 | 
			
		||||
| 
						 | 
				
			
			@ -2063,6 +2064,15 @@ togglefloating(const Arg *arg)
 | 
			
		|||
	arrange(selmon);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
togglesticky(const Arg *arg)
 | 
			
		||||
{
 | 
			
		||||
	if (!selmon->sel)
 | 
			
		||||
		return;
 | 
			
		||||
	selmon->sel->issticky = !selmon->sel->issticky;
 | 
			
		||||
	arrange(selmon);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
toggletag(const Arg *arg)
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										58
									
								
								patches/dwm-sticky-6.1.diff
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										58
									
								
								patches/dwm-sticky-6.1.diff
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,58 @@
 | 
			
		|||
diff --git a/config.def.h b/config.def.h
 | 
			
		||||
index 7054c06..9b5d5b8 100644
 | 
			
		||||
--- a/config.def.h
 | 
			
		||||
+++ b/config.def.h
 | 
			
		||||
@@ -76,6 +76,7 @@ static Key keys[] = {
 | 
			
		||||
 	{ MODKEY,                       XK_m,      setlayout,      {.v = &layouts[2]} },
 | 
			
		||||
 	{ MODKEY,                       XK_space,  setlayout,      {0} },
 | 
			
		||||
 	{ MODKEY|ShiftMask,             XK_space,  togglefloating, {0} },
 | 
			
		||||
+	{ MODKEY,                       XK_s,      togglesticky,   {0} },
 | 
			
		||||
 	{ MODKEY,                       XK_0,      view,           {.ui = ~0 } },
 | 
			
		||||
 	{ MODKEY|ShiftMask,             XK_0,      tag,            {.ui = ~0 } },
 | 
			
		||||
 	{ MODKEY,                       XK_comma,  focusmon,       {.i = -1 } },
 | 
			
		||||
diff --git a/dwm.c b/dwm.c
 | 
			
		||||
index 0362114..0ef5c7f 100644
 | 
			
		||||
--- a/dwm.c
 | 
			
		||||
+++ b/dwm.c
 | 
			
		||||
@@ -49,7 +49,7 @@
 | 
			
		||||
 #define CLEANMASK(mask)         (mask & ~(numlockmask|LockMask) & (ShiftMask|ControlMask|Mod1Mask|Mod2Mask|Mod3Mask|Mod4Mask|Mod5Mask))
 | 
			
		||||
 #define INTERSECT(x,y,w,h,m)    (MAX(0, MIN((x)+(w),(m)->wx+(m)->ww) - MAX((x),(m)->wx)) \
 | 
			
		||||
                                * MAX(0, MIN((y)+(h),(m)->wy+(m)->wh) - MAX((y),(m)->wy)))
 | 
			
		||||
-#define ISVISIBLE(C)            ((C->tags & C->mon->tagset[C->mon->seltags]))
 | 
			
		||||
+#define ISVISIBLE(C)            ((C->tags & C->mon->tagset[C->mon->seltags]) || C->issticky)
 | 
			
		||||
 #define LENGTH(X)               (sizeof X / sizeof X[0])
 | 
			
		||||
 #define MOUSEMASK               (BUTTONMASK|PointerMotionMask)
 | 
			
		||||
 #define WIDTH(X)                ((X)->w + 2 * (X)->bw)
 | 
			
		||||
@@ -92,7 +92,7 @@ struct Client {
 | 
			
		||||
 	int basew, baseh, incw, inch, maxw, maxh, minw, minh;
 | 
			
		||||
 	int bw, oldbw;
 | 
			
		||||
 	unsigned int tags;
 | 
			
		||||
-	int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen;
 | 
			
		||||
+	int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen, issticky;
 | 
			
		||||
 	Client *next;
 | 
			
		||||
 	Client *snext;
 | 
			
		||||
 	Monitor *mon;
 | 
			
		||||
@@ -211,6 +211,7 @@ static void tagmon(const Arg *arg);
 | 
			
		||||
 static void tile(Monitor *);
 | 
			
		||||
 static void togglebar(const Arg *arg);
 | 
			
		||||
 static void togglefloating(const Arg *arg);
 | 
			
		||||
+static void togglesticky(const Arg *arg);
 | 
			
		||||
 static void toggletag(const Arg *arg);
 | 
			
		||||
 static void toggleview(const Arg *arg);
 | 
			
		||||
 static void unfocus(Client *c, int setfocus);
 | 
			
		||||
@@ -1713,6 +1714,15 @@ togglefloating(const Arg *arg)
 | 
			
		||||
 }
 | 
			
		||||
 
 | 
			
		||||
 void
 | 
			
		||||
+togglesticky(const Arg *arg)
 | 
			
		||||
+{
 | 
			
		||||
+	if (!selmon->sel)
 | 
			
		||||
+		return;
 | 
			
		||||
+	selmon->sel->issticky = !selmon->sel->issticky;
 | 
			
		||||
+	arrange(selmon);
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
+void
 | 
			
		||||
 toggletag(const Arg *arg)
 | 
			
		||||
 {
 | 
			
		||||
 	unsigned int newtags;
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue