mirror of
				https://github.com/tiyn/dwm.git
				synced 2025-11-04 13:11:15 +01:00 
			
		
		
		
	Compare commits
	
		
			2 Commits
		
	
	
		
			81d1901820
			...
			systray
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| b1d3af1db6 | |||
| 8198474d56 | 
							
								
								
									
										71
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										71
									
								
								README.md
									
									
									
									
									
								
							@@ -1,71 +0,0 @@
 | 
				
			|||||||
# dwm
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
This is my patched version of dwm. The base version is directly from
 | 
					 | 
				
			||||||
suckless.org.
 | 
					 | 
				
			||||||
This belongs to my larbs installation script and depends heavily on its scripts
 | 
					 | 
				
			||||||
and programs.
 | 
					 | 
				
			||||||
It is supposed to work in the environment after the larbs-base-installation.
 | 
					 | 
				
			||||||
This is my patched version of dwm. The base version is directly from suckless.org.
 | 
					 | 
				
			||||||
This repository is set up according to the
 | 
					 | 
				
			||||||
[suckless entry of my wiki](https://github.com/tiyn/wiki/blob/master/wiki/linux/suckless.md).
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
## Patches
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
The list below shows the currently applied patches to the master branch.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
- dwm-activetagindicatorbar-6.2.diff (show bar as window indicator)
 | 
					 | 
				
			||||||
- dwm-actualfullscreen-20191112-cb3f58a.diff (enables true fullscreen)
 | 
					 | 
				
			||||||
- dwm-alpha-20180613-b69c870.diff (adds transparency)
 | 
					 | 
				
			||||||
- dwm-bottomstack-20160719-56a31dc.diff (adds bottomstack and bottomstackhorizontal layout)
 | 
					 | 
				
			||||||
- dwm-center-6.1.diff (adds ability to center floating windows at launch)
 | 
					 | 
				
			||||||
- dwm-cyclelayouts-20180524-6.2.diff (adds ability to cycle through layouts)
 | 
					 | 
				
			||||||
- dwm-deck-6.0.diff (adds deck layout)
 | 
					 | 
				
			||||||
- dwm-noborder-6.2.diff (removes border if there is only one window)
 | 
					 | 
				
			||||||
- dwm-notitle-6.2.diff (removes window title in the middle of the bar)
 | 
					 | 
				
			||||||
- dwm-pertag-20170513-ceac8c9.diff (allows having a layout/mwfact/barpos/nmaster per tag)
 | 
					 | 
				
			||||||
- dwm-status2d-6.2.diff (adds colors and ability to draw rectangles)
 | 
					 | 
				
			||||||
- dwm-statusallmons-6.2.diff (display statusbar on every monitors)
 | 
					 | 
				
			||||||
- dwm-statuscmd-6.2.diff (enables dwmblocks compatibility)
 | 
					 | 
				
			||||||
- dwm-systray-6.2.diff (adds a systray to statusbar)
 | 
					 | 
				
			||||||
- dwm-zeroastag-22032023-0aea805.diff (adds a tenth tag on 0)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
## Hotkeys
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
There are various shortcuts and hotkeys used in this version. Included in my
 | 
					 | 
				
			||||||
build are the following.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
| ModKey | Shift | Key | Function |
 | 
					 | 
				
			||||||
| ------ | ----- | --- | -------- |
 | 
					 | 
				
			||||||
| Super | | h | (Tiling/Deck) Focus window higher in stack than current |
 | 
					 | 
				
			||||||
| Super | | j | (Tiling/Deck) Focus window lower in stack than current |
 | 
					 | 
				
			||||||
| Super | | k | (Tiling/Deck) Focus window higher in stack than current |
 | 
					 | 
				
			||||||
| Super | | l | (Tiling/Deck) Focus window lower in stack than current |
 | 
					 | 
				
			||||||
| Super | | 1/2/.../9/0 | Show tag 1/2/.../9/0 |
 | 
					 | 
				
			||||||
| Super | | . | Show monitor lower in stack |
 | 
					 | 
				
			||||||
| Super | | , | Show monitor higher in stack |
 | 
					 | 
				
			||||||
| Super | Shift | Escape | Quit dwm |
 | 
					 | 
				
			||||||
| Super | Shift | b | Toggle dwmbar |
 | 
					 | 
				
			||||||
| Super | Shift | c | Enable deck(/card) layout |
 | 
					 | 
				
			||||||
| Super | Shift | d | Toggle floating/tiled for selected window |
 | 
					 | 
				
			||||||
| Super | Shift | f | Toggle fullscreen |
 | 
					 | 
				
			||||||
| Super | Shift | h | (Tiling/Deck) Make current window the master window |
 | 
					 | 
				
			||||||
| Super | Shift | j | (Tiling/Deck) Make current window the master window |
 | 
					 | 
				
			||||||
| Super | Shift | k | (Tiling/Deck) Make current window the master window |
 | 
					 | 
				
			||||||
| Super | Shift | m | Enable monocle layout |
 | 
					 | 
				
			||||||
| Super | Shift | o | (Tiling/Deck) Increase master window size |
 | 
					 | 
				
			||||||
| Super | Shift | q | Close current window |
 | 
					 | 
				
			||||||
| Super | Shift | t | Enable tiling layout |
 | 
					 | 
				
			||||||
| Super | Shift | u | Enable bottomstack layout |
 | 
					 | 
				
			||||||
| Super | Shift | v | Enable bottomstackhorizontal layout |
 | 
					 | 
				
			||||||
| Super | Shift | z | (Tiling/Deck) Decrease master window size |
 | 
					 | 
				
			||||||
| Super | Shift | 1/2/.../9/0 | Add current window to tag 1/2/.../9/0 |
 | 
					 | 
				
			||||||
| Super | Shift | . | Add to monitor lower in stack |
 | 
					 | 
				
			||||||
| Super | Shift | , | Add to monitor higher in stack |
 | 
					 | 
				
			||||||
| Alt   | | Tab | (Tiling/Deck) Focus window lower in stack than current  |
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
## Installation
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
The most basic way is to clone the repository and then invoke make.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
- `git clone https://github.com/tiyn/dwm`
 | 
					 | 
				
			||||||
- `make clean install`
 | 
					 | 
				
			||||||
							
								
								
									
										174
									
								
								config.def.h
									
									
									
									
									
								
							
							
						
						
									
										174
									
								
								config.def.h
									
									
									
									
									
								
							@@ -1,139 +1,119 @@
 | 
				
			|||||||
/* See LICENSE file for copyright and license details. */
 | 
					/* See LICENSE file for copyright and license details. */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* for media keys */
 | 
					 | 
				
			||||||
#include <X11/XF86keysym.h>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* appearance */
 | 
					/* appearance */
 | 
				
			||||||
static const unsigned int borderpx       = 1;        /* border pixel of windows */
 | 
					static const unsigned int borderpx  = 1;        /* border pixel of windows */
 | 
				
			||||||
static const unsigned int snap           = 32;       /* snap pixel */
 | 
					static const unsigned int snap      = 32;       /* snap pixel */
 | 
				
			||||||
static const unsigned int systraypinning = 0;   /* 0: sloppy systray follows selected monitor, >0: pin systray to monitor X */
 | 
					static const unsigned int systraypinning = 0;   /* 0: sloppy systray follows selected monitor, >0: pin systray to monitor X */
 | 
				
			||||||
static const unsigned int systrayspacing = 2;   /* systray spacing */
 | 
					static const unsigned int systrayspacing = 2;   /* systray spacing */
 | 
				
			||||||
static const int systraypinningfailfirst = 1;   /* 1: if pinning fails, display systray on the first monitor, False: display systray on the last monitor*/
 | 
					static const int systraypinningfailfirst = 1;   /* 1: if pinning fails, display systray on the first monitor, False: display systray on the last monitor*/
 | 
				
			||||||
static const int showsystray             = 1;     /* 0 means no systray */
 | 
					static const int showsystray        = 1;     /* 0 means no systray */
 | 
				
			||||||
static const int showbar                 = 1;        /* 0 means no bar */
 | 
					static const int showbar            = 1;        /* 0 means no bar */
 | 
				
			||||||
static const int topbar                  = 1;        /* 0 means bottom bar */
 | 
					static const int topbar             = 1;        /* 0 means bottom bar */
 | 
				
			||||||
static const char *fonts[]               = { "monospace:size=10" };
 | 
					static const char *fonts[]          = { "monospace:size=10" };
 | 
				
			||||||
static const char dmenufont[]            = "monospace:size=10";
 | 
					static const char dmenufont[]       = "monospace:size=10";
 | 
				
			||||||
static const char normbgcolor[]          = "#0e0f14";
 | 
					static const char col_gray1[]       = "#222222";
 | 
				
			||||||
static const char normbordercolor[]      = "#363b47";
 | 
					static const char col_gray2[]       = "#444444";
 | 
				
			||||||
static const char normfgcolor[]          = "#dfdfdf";
 | 
					static const char col_gray3[]       = "#bbbbbb";
 | 
				
			||||||
static const char selfgcolor[]           = "#eeeeee";
 | 
					static const char col_gray4[]       = "#eeeeee";
 | 
				
			||||||
static const char selbordercolor[]       = "#555a63";
 | 
					static const char col_cyan[]        = "#005577";
 | 
				
			||||||
static const char selbgcolor[]           = "#282828";
 | 
					 | 
				
			||||||
static const unsigned int baralpha       = 0xff;
 | 
					 | 
				
			||||||
static const unsigned int borderalpha    = OPAQUE;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
static const char *colors[][3]      = {
 | 
					static const char *colors[][3]      = {
 | 
				
			||||||
	/*               fg         bg         border   */
 | 
						/*               fg         bg         border   */
 | 
				
			||||||
	[SchemeNorm] = { normfgcolor, normbgcolor, normbordercolor },
 | 
						[SchemeNorm] = { col_gray3, col_gray1, col_gray2 },
 | 
				
			||||||
	[SchemeSel]  = { selfgcolor,  selbgcolor,  selbordercolor },
 | 
						[SchemeSel]  = { col_gray4, col_cyan,  col_cyan  },
 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
static const unsigned int alphas[][3]      = {
 | 
					 | 
				
			||||||
	/*               fg      bg        border     */
 | 
					 | 
				
			||||||
	[SchemeNorm] = { OPAQUE, baralpha, borderalpha },
 | 
					 | 
				
			||||||
	[SchemeSel]  = { OPAQUE, baralpha, borderalpha },
 | 
					 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* tagging */
 | 
					/* tagging */
 | 
				
			||||||
static const char *tags[] = { "", "", "", "", "", "", "", "", "", "" };
 | 
					static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static const Rule rules[] = {
 | 
					static const Rule rules[] = {
 | 
				
			||||||
	/* xprop(1):
 | 
						/* xprop(1):
 | 
				
			||||||
	 *	WM_CLASS(STRING) = instance, class
 | 
						 *	WM_CLASS(STRING) = instance, class
 | 
				
			||||||
	 *	WM_NAME(STRING) = title
 | 
						 *	WM_NAME(STRING) = title
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	/* class    instance      title tags mask iscentered    isfloating   monitor */
 | 
						/* class      instance    title       tags mask     isfloating   monitor */
 | 
				
			||||||
	{ NULL,	    "origin.exe", NULL, 0,        0,	        1,           -1 },
 | 
						{ "Gimp",     NULL,       NULL,       0,            1,           -1 },
 | 
				
			||||||
 | 
						{ "Firefox",  NULL,       NULL,       1 << 8,       0,           -1 },
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* layout(s) */
 | 
					/* layout(s) */
 | 
				
			||||||
static const float mfact     = 0.5; /* factor of master area size [0.05..0.95] */
 | 
					static const float mfact     = 0.55; /* factor of master area size [0.05..0.95] */
 | 
				
			||||||
static const int nmaster     = 1;    /* number of clients in master area */
 | 
					static const int nmaster     = 1;    /* number of clients in master area */
 | 
				
			||||||
static const int resizehints = 1;    /* 1 means respect size hints in tiled resizals */
 | 
					static const int resizehints = 1;    /* 1 means respect size hints in tiled resizals */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static const Layout layouts[] = {
 | 
					static const Layout layouts[] = {
 | 
				
			||||||
	/* symbol     arrange function */
 | 
						/* symbol     arrange function */
 | 
				
			||||||
	{ "M",      monocle },
 | 
						{ "[]=",      tile },    /* first entry is default */
 | 
				
			||||||
	{ "T",      tile },    /* first entry is default */
 | 
						{ "><>",      NULL },    /* no layout function means floating behavior */
 | 
				
			||||||
	{ "D",      deck },
 | 
						{ "[M]",      monocle },
 | 
				
			||||||
	{ "B",      bstack },
 | 
					 | 
				
			||||||
	{ "B",      bstackhoriz },
 | 
					 | 
				
			||||||
	{ "F",      NULL },    /* no layout function means floating behavior */
 | 
					 | 
				
			||||||
	{ NULL,       NULL },
 | 
					 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* key definitions */
 | 
					/* key definitions */
 | 
				
			||||||
#define MODKEY Mod4Mask
 | 
					#define MODKEY Mod1Mask
 | 
				
			||||||
#define TAGKEYS(KEY,TAG) \
 | 
					#define TAGKEYS(KEY,TAG) \
 | 
				
			||||||
	{ MODKEY,                       KEY,  view,       {.ui = 1 << TAG} }, \
 | 
						{ MODKEY,                       KEY,      view,           {.ui = 1 << TAG} }, \
 | 
				
			||||||
	{ MODKEY|ControlMask,           KEY,  toggleview, {.ui = 1 << TAG} }, \
 | 
						{ MODKEY|ControlMask,           KEY,      toggleview,     {.ui = 1 << TAG} }, \
 | 
				
			||||||
	{ MODKEY|ShiftMask,             KEY,  tag,        {.ui = 1 << TAG} }, \
 | 
						{ MODKEY|ShiftMask,             KEY,      tag,            {.ui = 1 << TAG} }, \
 | 
				
			||||||
	{ MODKEY|ControlMask|ShiftMask, KEY,  toggletag,  {.ui = 1 << TAG} },
 | 
						{ MODKEY|ControlMask|ShiftMask, KEY,      toggletag,      {.ui = 1 << TAG} },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* helper for spawning shell commands in the pre dwm-5.0 fashion */
 | 
					/* helper for spawning shell commands in the pre dwm-5.0 fashion */
 | 
				
			||||||
#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
 | 
					#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* commands */
 | 
					/* commands */
 | 
				
			||||||
static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
 | 
					static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
 | 
				
			||||||
static const char *dmenucmd[] = { "dmenu_run", "-c", "-l", "20", NULL };
 | 
					static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL };
 | 
				
			||||||
 | 
					static const char *termcmd[]  = { "st", NULL };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static Key keys[] = {
 | 
					static Key keys[] = {
 | 
				
			||||||
  /* modifier           key         function        argument */
 | 
						/* modifier                     key        function        argument */
 | 
				
			||||||
  { MODKEY|ShiftMask,   XK_Escape,  quit,           {0} },
 | 
						{ MODKEY,                       XK_p,      spawn,          {.v = dmenucmd } },
 | 
				
			||||||
  { MODKEY|ShiftMask,   XK_b,       togglebar,      {0} },
 | 
						{ MODKEY|ShiftMask,             XK_Return, spawn,          {.v = termcmd } },
 | 
				
			||||||
  { MODKEY|ShiftMask,   XK_c,       setlayout,      {.v = &layouts[2]} },
 | 
						{ MODKEY,                       XK_b,      togglebar,      {0} },
 | 
				
			||||||
  { MODKEY|ShiftMask,   XK_d,       togglefloating, {0} },
 | 
						{ MODKEY,                       XK_j,      focusstack,     {.i = +1 } },
 | 
				
			||||||
  { MODKEY|ShiftMask,   XK_f,       togglefullscr,  {0} },
 | 
						{ MODKEY,                       XK_k,      focusstack,     {.i = -1 } },
 | 
				
			||||||
  { MODKEY,             XK_h,       focusstack,     {.i = -1} },
 | 
						{ MODKEY,                       XK_i,      incnmaster,     {.i = +1 } },
 | 
				
			||||||
  { MODKEY|ShiftMask,   XK_h,       zoom,           {0} },
 | 
						{ MODKEY,                       XK_d,      incnmaster,     {.i = -1 } },
 | 
				
			||||||
  { MODKEY,             XK_j,       focusstack,     {.i = +1} },
 | 
						{ MODKEY,                       XK_h,      setmfact,       {.f = -0.05} },
 | 
				
			||||||
  { MODKEY|ShiftMask,   XK_j,       zoom,           {0} },
 | 
						{ MODKEY,                       XK_l,      setmfact,       {.f = +0.05} },
 | 
				
			||||||
  { MODKEY,             XK_k,       focusstack,     {.i = -1} },
 | 
						{ MODKEY,                       XK_Return, zoom,           {0} },
 | 
				
			||||||
  { MODKEY|ShiftMask,   XK_k,       zoom,           {0} },
 | 
						{ MODKEY,                       XK_Tab,    view,           {0} },
 | 
				
			||||||
  { MODKEY,             XK_l,       focusstack,     {.i = +1} },
 | 
						{ MODKEY|ShiftMask,             XK_c,      killclient,     {0} },
 | 
				
			||||||
  { MODKEY|ShiftMask,   XK_m,       setlayout,      {.v = &layouts[0]} },
 | 
						{ MODKEY,                       XK_t,      setlayout,      {.v = &layouts[0]} },
 | 
				
			||||||
  { MODKEY|ShiftMask,   XK_o,       setmfact,       {.f = +0.05} },
 | 
						{ MODKEY,                       XK_f,      setlayout,      {.v = &layouts[1]} },
 | 
				
			||||||
  { MODKEY|ShiftMask,   XK_q,       killclient,     {0} },
 | 
						{ MODKEY,                       XK_m,      setlayout,      {.v = &layouts[2]} },
 | 
				
			||||||
  { MODKEY|ShiftMask,   XK_t,       setlayout,      {.v = &layouts[1]} },
 | 
						{ MODKEY,                       XK_space,  setlayout,      {0} },
 | 
				
			||||||
  { MODKEY|ShiftMask,   XK_u,       setlayout,      {.v = &layouts[3]} },
 | 
						{ MODKEY|ShiftMask,             XK_space,  togglefloating, {0} },
 | 
				
			||||||
  { MODKEY|ShiftMask,   XK_v,       setlayout,      {.v = &layouts[4]} },
 | 
						{ MODKEY,                       XK_0,      view,           {.ui = ~0 } },
 | 
				
			||||||
  { MODKEY|ShiftMask,   XK_z,       setmfact,       {.f = -0.05} },
 | 
						{ MODKEY|ShiftMask,             XK_0,      tag,            {.ui = ~0 } },
 | 
				
			||||||
  { MODKEY,             XK_0,       view,           {.ui = ~0} },
 | 
						{ MODKEY,                       XK_comma,  focusmon,       {.i = -1 } },
 | 
				
			||||||
  { MODKEY|ShiftMask,   XK_0,       tag,            {.ui = ~0} },
 | 
						{ MODKEY,                       XK_period, focusmon,       {.i = +1 } },
 | 
				
			||||||
  { MODKEY,             XK_comma,   focusmon,       {.i = -1} },
 | 
						{ MODKEY|ShiftMask,             XK_comma,  tagmon,         {.i = -1 } },
 | 
				
			||||||
  { MODKEY,             XK_period,  focusmon,       {.i = +1} },
 | 
						{ MODKEY|ShiftMask,             XK_period, tagmon,         {.i = +1 } },
 | 
				
			||||||
  { MODKEY|ShiftMask,   XK_comma,   tagmon,         {.i = -1} },
 | 
						TAGKEYS(                        XK_1,                      0)
 | 
				
			||||||
  { MODKEY|ShiftMask,   XK_period,  tagmon,         {.i = +1} },
 | 
						TAGKEYS(                        XK_2,                      1)
 | 
				
			||||||
  { Mod1Mask,           XK_Tab,     focusstack,     {.i = +1} },
 | 
						TAGKEYS(                        XK_3,                      2)
 | 
				
			||||||
 | 
						TAGKEYS(                        XK_4,                      3)
 | 
				
			||||||
  TAGKEYS(XK_1, 0)
 | 
						TAGKEYS(                        XK_5,                      4)
 | 
				
			||||||
  TAGKEYS(XK_2, 1)
 | 
						TAGKEYS(                        XK_6,                      5)
 | 
				
			||||||
  TAGKEYS(XK_3, 2)
 | 
						TAGKEYS(                        XK_7,                      6)
 | 
				
			||||||
  TAGKEYS(XK_4, 3)
 | 
						TAGKEYS(                        XK_8,                      7)
 | 
				
			||||||
  TAGKEYS(XK_5, 4)
 | 
						TAGKEYS(                        XK_9,                      8)
 | 
				
			||||||
  TAGKEYS(XK_6, 5)
 | 
						{ MODKEY|ShiftMask,             XK_q,      quit,           {0} },
 | 
				
			||||||
  TAGKEYS(XK_7, 6)
 | 
					 | 
				
			||||||
  TAGKEYS(XK_8, 7)
 | 
					 | 
				
			||||||
  TAGKEYS(XK_9, 8)
 | 
					 | 
				
			||||||
  TAGKEYS(XK_0, 9)
 | 
					 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* button definitions */
 | 
					/* button definitions */
 | 
				
			||||||
/* click can be ClkTagBar, ClkLtSymbol, ClkStatusText, ClkClientWin, or ClkRootWin */
 | 
					/* click can be ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */
 | 
				
			||||||
static Button buttons[] = {
 | 
					static Button buttons[] = {
 | 
				
			||||||
  /* click          event mask  button    function        argument */
 | 
						/* click                event mask      button          function        argument */
 | 
				
			||||||
  { ClkLtSymbol,    0,          Button1,  cyclelayout,    {.i = +1} },
 | 
						{ ClkLtSymbol,          0,              Button1,        setlayout,      {0} },
 | 
				
			||||||
  { ClkLtSymbol,    0,          Button2,  setlayout,      {.v = &layouts[0]} },
 | 
						{ ClkLtSymbol,          0,              Button3,        setlayout,      {.v = &layouts[2]} },
 | 
				
			||||||
  { ClkLtSymbol,    0,          Button3,  cyclelayout,    {.i = -1} },
 | 
						{ ClkWinTitle,          0,              Button2,        zoom,           {0} },
 | 
				
			||||||
  { ClkStatusText,  0,          Button1,  sigdwmblocks,   {.i = 1} },
 | 
						{ ClkStatusText,        0,              Button2,        spawn,          {.v = termcmd } },
 | 
				
			||||||
  { ClkStatusText,  0,          Button2,  sigdwmblocks,   {.i = 2} },
 | 
						{ ClkClientWin,         MODKEY,         Button1,        movemouse,      {0} },
 | 
				
			||||||
  { ClkStatusText,  0,          Button3,  sigdwmblocks,   {.i = 3} },
 | 
						{ ClkClientWin,         MODKEY,         Button2,        togglefloating, {0} },
 | 
				
			||||||
  { ClkClientWin,   MODKEY,     Button1,  movemouse,      {0} },
 | 
						{ ClkClientWin,         MODKEY,         Button3,        resizemouse,    {0} },
 | 
				
			||||||
  { ClkClientWin,   MODKEY,     Button2,  togglefloating, {0} },
 | 
						{ ClkTagBar,            0,              Button1,        view,           {0} },
 | 
				
			||||||
  { ClkClientWin,   MODKEY,     Button3,  resizemouse,    {0} },
 | 
						{ ClkTagBar,            0,              Button3,        toggleview,     {0} },
 | 
				
			||||||
  { ClkTagBar,      0,          Button1,  view,           {0} },
 | 
						{ ClkTagBar,            MODKEY,         Button1,        tag,            {0} },
 | 
				
			||||||
  { ClkTagBar,      0,          Button3,  toggleview,     {0} },
 | 
						{ ClkTagBar,            MODKEY,         Button3,        toggletag,      {0} },
 | 
				
			||||||
  { ClkTagBar,      MODKEY,     Button1,  tag,            {0} },
 | 
					 | 
				
			||||||
  { ClkTagBar,      MODKEY,     Button3,  toggletag,      {0} },
 | 
					 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -22,7 +22,7 @@ FREETYPEINC = /usr/include/freetype2
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
# includes and libs
 | 
					# includes and libs
 | 
				
			||||||
INCS = -I${X11INC} -I${FREETYPEINC}
 | 
					INCS = -I${X11INC} -I${FREETYPEINC}
 | 
				
			||||||
LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS} -lXrender
 | 
					LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# flags
 | 
					# flags
 | 
				
			||||||
CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_C_SOURCE=2 -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS}
 | 
					CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_C_SOURCE=2 -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS}
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										30
									
								
								drw.c
									
									
									
									
									
								
							
							
						
						
									
										30
									
								
								drw.c
									
									
									
									
									
								
							@@ -61,7 +61,7 @@ utf8decode(const char *c, long *u, size_t clen)
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Drw *
 | 
					Drw *
 | 
				
			||||||
drw_create(Display *dpy, int screen, Window root, unsigned int w, unsigned int h, Visual *visual, unsigned int depth, Colormap cmap)
 | 
					drw_create(Display *dpy, int screen, Window root, unsigned int w, unsigned int h)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	Drw *drw = ecalloc(1, sizeof(Drw));
 | 
						Drw *drw = ecalloc(1, sizeof(Drw));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -70,11 +70,8 @@ drw_create(Display *dpy, int screen, Window root, unsigned int w, unsigned int h
 | 
				
			|||||||
	drw->root = root;
 | 
						drw->root = root;
 | 
				
			||||||
	drw->w = w;
 | 
						drw->w = w;
 | 
				
			||||||
	drw->h = h;
 | 
						drw->h = h;
 | 
				
			||||||
	drw->visual = visual;
 | 
						drw->drawable = XCreatePixmap(dpy, root, w, h, DefaultDepth(dpy, screen));
 | 
				
			||||||
	drw->depth = depth;
 | 
						drw->gc = XCreateGC(dpy, root, 0, NULL);
 | 
				
			||||||
	drw->cmap = cmap;
 | 
					 | 
				
			||||||
	drw->drawable = XCreatePixmap(dpy, root, w, h, depth);
 | 
					 | 
				
			||||||
	drw->gc = XCreateGC(dpy, drw->drawable, 0, NULL);
 | 
					 | 
				
			||||||
	XSetLineAttributes(dpy, drw->gc, 1, LineSolid, CapButt, JoinMiter);
 | 
						XSetLineAttributes(dpy, drw->gc, 1, LineSolid, CapButt, JoinMiter);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return drw;
 | 
						return drw;
 | 
				
			||||||
@@ -90,7 +87,7 @@ drw_resize(Drw *drw, unsigned int w, unsigned int h)
 | 
				
			|||||||
	drw->h = h;
 | 
						drw->h = h;
 | 
				
			||||||
	if (drw->drawable)
 | 
						if (drw->drawable)
 | 
				
			||||||
		XFreePixmap(drw->dpy, drw->drawable);
 | 
							XFreePixmap(drw->dpy, drw->drawable);
 | 
				
			||||||
	drw->drawable = XCreatePixmap(drw->dpy, drw->root, w, h, drw->depth);
 | 
						drw->drawable = XCreatePixmap(drw->dpy, drw->root, w, h, DefaultDepth(drw->dpy, drw->screen));
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void
 | 
					void
 | 
				
			||||||
@@ -142,11 +139,11 @@ xfont_create(Drw *drw, const char *fontname, FcPattern *fontpattern)
 | 
				
			|||||||
	 * https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=916349
 | 
						 * https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=916349
 | 
				
			||||||
	 * and lots more all over the internet.
 | 
						 * and lots more all over the internet.
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	/*FcBool iscol;
 | 
						FcBool iscol;
 | 
				
			||||||
	if(FcPatternGetBool(xfont->pattern, FC_COLOR, 0, &iscol) == FcResultMatch && iscol) {
 | 
						if(FcPatternGetBool(xfont->pattern, FC_COLOR, 0, &iscol) == FcResultMatch && iscol) {
 | 
				
			||||||
		XftFontClose(drw->dpy, xfont);
 | 
							XftFontClose(drw->dpy, xfont);
 | 
				
			||||||
		return NULL;
 | 
							return NULL;
 | 
				
			||||||
	}*/
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	font = ecalloc(1, sizeof(Fnt));
 | 
						font = ecalloc(1, sizeof(Fnt));
 | 
				
			||||||
	font->xfont = xfont;
 | 
						font->xfont = xfont;
 | 
				
			||||||
@@ -196,22 +193,21 @@ drw_fontset_free(Fnt *font)
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void
 | 
					void
 | 
				
			||||||
drw_clr_create(Drw *drw, Clr *dest, const char *clrname, unsigned int alpha)
 | 
					drw_clr_create(Drw *drw, Clr *dest, const char *clrname)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	if (!drw || !dest || !clrname)
 | 
						if (!drw || !dest || !clrname)
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!XftColorAllocName(drw->dpy, drw->visual, drw->cmap,
 | 
						if (!XftColorAllocName(drw->dpy, DefaultVisual(drw->dpy, drw->screen),
 | 
				
			||||||
 | 
						                       DefaultColormap(drw->dpy, drw->screen),
 | 
				
			||||||
	                       clrname, dest))
 | 
						                       clrname, dest))
 | 
				
			||||||
		die("error, cannot allocate color '%s'", clrname);
 | 
							die("error, cannot allocate color '%s'", clrname);
 | 
				
			||||||
 | 
					 | 
				
			||||||
	dest->pixel = (dest->pixel & 0x00ffffffU) | (alpha << 24);
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Wrapper to create color schemes. The caller has to call free(3) on the
 | 
					/* Wrapper to create color schemes. The caller has to call free(3) on the
 | 
				
			||||||
 * returned color scheme when done using it. */
 | 
					 * returned color scheme when done using it. */
 | 
				
			||||||
Clr *
 | 
					Clr *
 | 
				
			||||||
drw_scm_create(Drw *drw, const char *clrnames[], const unsigned int alphas[], size_t clrcount)
 | 
					drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	size_t i;
 | 
						size_t i;
 | 
				
			||||||
	Clr *ret;
 | 
						Clr *ret;
 | 
				
			||||||
@@ -221,7 +217,7 @@ drw_scm_create(Drw *drw, const char *clrnames[], const unsigned int alphas[], si
 | 
				
			|||||||
		return NULL;
 | 
							return NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for (i = 0; i < clrcount; i++)
 | 
						for (i = 0; i < clrcount; i++)
 | 
				
			||||||
		drw_clr_create(drw, &ret[i], clrnames[i], alphas[i]);
 | 
							drw_clr_create(drw, &ret[i], clrnames[i]);
 | 
				
			||||||
	return ret;
 | 
						return ret;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -277,7 +273,9 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp
 | 
				
			|||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		XSetForeground(drw->dpy, drw->gc, drw->scheme[invert ? ColFg : ColBg].pixel);
 | 
							XSetForeground(drw->dpy, drw->gc, drw->scheme[invert ? ColFg : ColBg].pixel);
 | 
				
			||||||
		XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w, h);
 | 
							XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w, h);
 | 
				
			||||||
		d = XftDrawCreate(drw->dpy, drw->drawable, drw->visual, drw->cmap);
 | 
							d = XftDrawCreate(drw->dpy, drw->drawable,
 | 
				
			||||||
 | 
							                  DefaultVisual(drw->dpy, drw->screen),
 | 
				
			||||||
 | 
							                  DefaultColormap(drw->dpy, drw->screen));
 | 
				
			||||||
		x += lpad;
 | 
							x += lpad;
 | 
				
			||||||
		w -= lpad;
 | 
							w -= lpad;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										9
									
								
								drw.h
									
									
									
									
									
								
							
							
						
						
									
										9
									
								
								drw.h
									
									
									
									
									
								
							@@ -20,9 +20,6 @@ typedef struct {
 | 
				
			|||||||
	Display *dpy;
 | 
						Display *dpy;
 | 
				
			||||||
	int screen;
 | 
						int screen;
 | 
				
			||||||
	Window root;
 | 
						Window root;
 | 
				
			||||||
	Visual *visual;
 | 
					 | 
				
			||||||
	unsigned int depth;
 | 
					 | 
				
			||||||
	Colormap cmap;
 | 
					 | 
				
			||||||
	Drawable drawable;
 | 
						Drawable drawable;
 | 
				
			||||||
	GC gc;
 | 
						GC gc;
 | 
				
			||||||
	Clr *scheme;
 | 
						Clr *scheme;
 | 
				
			||||||
@@ -30,7 +27,7 @@ typedef struct {
 | 
				
			|||||||
} Drw;
 | 
					} Drw;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Drawable abstraction */
 | 
					/* Drawable abstraction */
 | 
				
			||||||
Drw *drw_create(Display *dpy, int screen, Window win, unsigned int w, unsigned int h, Visual *visual, unsigned int depth, Colormap cmap);
 | 
					Drw *drw_create(Display *dpy, int screen, Window win, unsigned int w, unsigned int h);
 | 
				
			||||||
void drw_resize(Drw *drw, unsigned int w, unsigned int h);
 | 
					void drw_resize(Drw *drw, unsigned int w, unsigned int h);
 | 
				
			||||||
void drw_free(Drw *drw);
 | 
					void drw_free(Drw *drw);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -41,8 +38,8 @@ unsigned int drw_fontset_getwidth(Drw *drw, const char *text);
 | 
				
			|||||||
void drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned int *w, unsigned int *h);
 | 
					void drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned int *w, unsigned int *h);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Colorscheme abstraction */
 | 
					/* Colorscheme abstraction */
 | 
				
			||||||
void drw_clr_create(Drw *drw, Clr *dest, const char *clrname, unsigned int alpha);
 | 
					void drw_clr_create(Drw *drw, Clr *dest, const char *clrname);
 | 
				
			||||||
Clr *drw_scm_create(Drw *drw, const char *clrnames[], const unsigned int alphas[], size_t clrcount);
 | 
					Clr *drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Cursor abstraction */
 | 
					/* Cursor abstraction */
 | 
				
			||||||
Cur *drw_cur_create(Drw *drw, int shape);
 | 
					Cur *drw_cur_create(Drw *drw, int shape);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,17 +0,0 @@
 | 
				
			|||||||
diff -up dwm-a/dwm.c dwm-b/dwm.c
 | 
					 | 
				
			||||||
--- dwm-a/dwm.c	2019-02-02 06:55:28.000000000 -0600
 | 
					 | 
				
			||||||
+++ dwm-b/dwm.c	2019-02-23 21:43:13.359179100 -0600
 | 
					 | 
				
			||||||
@@ -719,9 +719,10 @@ drawbar(Monitor *m)
 | 
					 | 
				
			||||||
 		drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? SchemeSel : SchemeNorm]);
 | 
					 | 
				
			||||||
 		drw_text(drw, x, 0, w, bh, lrpad / 2, tags[i], urg & 1 << i);
 | 
					 | 
				
			||||||
 		if (occ & 1 << i)
 | 
					 | 
				
			||||||
-			drw_rect(drw, x + boxs, boxs, boxw, boxw,
 | 
					 | 
				
			||||||
-				m == selmon && selmon->sel && selmon->sel->tags & 1 << i,
 | 
					 | 
				
			||||||
-				urg & 1 << i);
 | 
					 | 
				
			||||||
+			drw_rect(drw, x + boxw, 0, w - ( 2 * boxw + 1), boxw,
 | 
					 | 
				
			||||||
+			    m == selmon && selmon->sel && selmon->sel->tags & 1 << i,
 | 
					 | 
				
			||||||
+			    urg & 1 << i);
 | 
					 | 
				
			||||||
+
 | 
					 | 
				
			||||||
 		x += w;
 | 
					 | 
				
			||||||
 	}
 | 
					 | 
				
			||||||
 	w = blw = TEXTW(m->ltsymbol);
 | 
					 | 
				
			||||||
@@ -1,53 +0,0 @@
 | 
				
			|||||||
From 3a16816a6f5d38014c2a06ce395873c545c8789a Mon Sep 17 00:00:00 2001
 | 
					 | 
				
			||||||
From: Soenke Lambert <s.lambert@mittwald.de>
 | 
					 | 
				
			||||||
Date: Tue, 12 Nov 2019 10:44:02 +0100
 | 
					 | 
				
			||||||
Subject: [PATCH] Fullscreen current window with [Alt]+[Shift]+[f]
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
This actually fullscreens a window, instead of just hiding the statusbar
 | 
					 | 
				
			||||||
and applying the monocle layout.
 | 
					 | 
				
			||||||
---
 | 
					 | 
				
			||||||
 config.def.h | 1 +
 | 
					 | 
				
			||||||
 dwm.c        | 8 ++++++++
 | 
					 | 
				
			||||||
 2 files changed, 9 insertions(+)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
diff --git a/config.def.h b/config.def.h
 | 
					 | 
				
			||||||
index 1c0b587..8cd3204 100644
 | 
					 | 
				
			||||||
--- a/config.def.h
 | 
					 | 
				
			||||||
+++ b/config.def.h
 | 
					 | 
				
			||||||
@@ -78,6 +78,7 @@ static Key keys[] = {
 | 
					 | 
				
			||||||
 	{ MODKEY,                       XK_m,      setlayout,      {.v = &layouts[2]} },
 | 
					 | 
				
			||||||
 	{ MODKEY,                       XK_space,  setlayout,      {0} },
 | 
					 | 
				
			||||||
 	{ MODKEY|ShiftMask,             XK_space,  togglefloating, {0} },
 | 
					 | 
				
			||||||
+	{ MODKEY|ShiftMask,             XK_f,      togglefullscr,  {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 4465af1..c1b899a 100644
 | 
					 | 
				
			||||||
--- a/dwm.c
 | 
					 | 
				
			||||||
+++ b/dwm.c
 | 
					 | 
				
			||||||
@@ -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 togglefullscr(const Arg *arg);
 | 
					 | 
				
			||||||
 static void toggletag(const Arg *arg);
 | 
					 | 
				
			||||||
 static void toggleview(const Arg *arg);
 | 
					 | 
				
			||||||
 static void unfocus(Client *c, int setfocus);
 | 
					 | 
				
			||||||
@@ -1719,6 +1720,13 @@ togglefloating(const Arg *arg)
 | 
					 | 
				
			||||||
 	arrange(selmon);
 | 
					 | 
				
			||||||
 }
 | 
					 | 
				
			||||||
 
 | 
					 | 
				
			||||||
+void
 | 
					 | 
				
			||||||
+togglefullscr(const Arg *arg)
 | 
					 | 
				
			||||||
+{
 | 
					 | 
				
			||||||
+  if(selmon->sel)
 | 
					 | 
				
			||||||
+    setfullscreen(selmon->sel, !selmon->sel->isfullscreen);
 | 
					 | 
				
			||||||
+}
 | 
					 | 
				
			||||||
+
 | 
					 | 
				
			||||||
 void
 | 
					 | 
				
			||||||
 toggletag(const Arg *arg)
 | 
					 | 
				
			||||||
 {
 | 
					 | 
				
			||||||
-- 
 | 
					 | 
				
			||||||
2.17.1
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
@@ -1,289 +0,0 @@
 | 
				
			|||||||
From f699934b8c8a9c15988ad359bf8fedd6c55abd53 Mon Sep 17 00:00:00 2001
 | 
					 | 
				
			||||||
From: Thomas Oltmann <thomas.oltmann.hhg@gmail.com>
 | 
					 | 
				
			||||||
Date: Wed, 13 Jun 2018 19:46:26 +0200
 | 
					 | 
				
			||||||
Subject: [PATCH] Allow dwm to have translucent bars, while keeping all the
 | 
					 | 
				
			||||||
 text on it opaque, just like the alpha-patch for st. Updated for b69c870.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
---
 | 
					 | 
				
			||||||
 config.def.h |  7 ++++++
 | 
					 | 
				
			||||||
 config.mk    |  2 +-
 | 
					 | 
				
			||||||
 drw.c        | 26 ++++++++++++-----------
 | 
					 | 
				
			||||||
 drw.h        |  9 +++++---
 | 
					 | 
				
			||||||
 dwm.c        | 60 ++++++++++++++++++++++++++++++++++++++++++++++------
 | 
					 | 
				
			||||||
 5 files changed, 82 insertions(+), 22 deletions(-)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
diff --git a/config.def.h b/config.def.h
 | 
					 | 
				
			||||||
index 1c0b587..4f68fe8 100644
 | 
					 | 
				
			||||||
--- a/config.def.h
 | 
					 | 
				
			||||||
+++ b/config.def.h
 | 
					 | 
				
			||||||
@@ -12,11 +12,18 @@ static const char col_gray2[]       = "#444444";
 | 
					 | 
				
			||||||
 static const char col_gray3[]       = "#bbbbbb";
 | 
					 | 
				
			||||||
 static const char col_gray4[]       = "#eeeeee";
 | 
					 | 
				
			||||||
 static const char col_cyan[]        = "#005577";
 | 
					 | 
				
			||||||
+static const unsigned int baralpha = 0xd0;
 | 
					 | 
				
			||||||
+static const unsigned int borderalpha = OPAQUE;
 | 
					 | 
				
			||||||
 static const char *colors[][3]      = {
 | 
					 | 
				
			||||||
 	/*               fg         bg         border   */
 | 
					 | 
				
			||||||
 	[SchemeNorm] = { col_gray3, col_gray1, col_gray2 },
 | 
					 | 
				
			||||||
 	[SchemeSel]  = { col_gray4, col_cyan,  col_cyan  },
 | 
					 | 
				
			||||||
 };
 | 
					 | 
				
			||||||
+static const unsigned int alphas[][3]      = {
 | 
					 | 
				
			||||||
+	/*               fg      bg        border     */
 | 
					 | 
				
			||||||
+	[SchemeNorm] = { OPAQUE, baralpha, borderalpha },
 | 
					 | 
				
			||||||
+	[SchemeSel]  = { OPAQUE, baralpha, borderalpha },
 | 
					 | 
				
			||||||
+};
 | 
					 | 
				
			||||||
 
 | 
					 | 
				
			||||||
 /* tagging */
 | 
					 | 
				
			||||||
 static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
 | 
					 | 
				
			||||||
diff --git a/config.mk b/config.mk
 | 
					 | 
				
			||||||
index 25e2685..bef8de0 100644
 | 
					 | 
				
			||||||
--- a/config.mk
 | 
					 | 
				
			||||||
+++ b/config.mk
 | 
					 | 
				
			||||||
@@ -22,7 +22,7 @@ FREETYPEINC = /usr/include/freetype2
 | 
					 | 
				
			||||||
 
 | 
					 | 
				
			||||||
 # includes and libs
 | 
					 | 
				
			||||||
 INCS = -I${X11INC} -I${FREETYPEINC}
 | 
					 | 
				
			||||||
-LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS}
 | 
					 | 
				
			||||||
+LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS} -lXrender
 | 
					 | 
				
			||||||
 
 | 
					 | 
				
			||||||
 # flags
 | 
					 | 
				
			||||||
 CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_C_SOURCE=2 -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS}
 | 
					 | 
				
			||||||
diff --git a/drw.c b/drw.c
 | 
					 | 
				
			||||||
index c638323..77fc113 100644
 | 
					 | 
				
			||||||
--- a/drw.c
 | 
					 | 
				
			||||||
+++ b/drw.c
 | 
					 | 
				
			||||||
@@ -61,7 +61,7 @@ utf8decode(const char *c, long *u, size_t clen)
 | 
					 | 
				
			||||||
 }
 | 
					 | 
				
			||||||
 
 | 
					 | 
				
			||||||
 Drw *
 | 
					 | 
				
			||||||
-drw_create(Display *dpy, int screen, Window root, unsigned int w, unsigned int h)
 | 
					 | 
				
			||||||
+drw_create(Display *dpy, int screen, Window root, unsigned int w, unsigned int h, Visual *visual, unsigned int depth, Colormap cmap)
 | 
					 | 
				
			||||||
 {
 | 
					 | 
				
			||||||
 	Drw *drw = ecalloc(1, sizeof(Drw));
 | 
					 | 
				
			||||||
 
 | 
					 | 
				
			||||||
@@ -70,8 +70,11 @@ drw_create(Display *dpy, int screen, Window root, unsigned int w, unsigned int h
 | 
					 | 
				
			||||||
 	drw->root = root;
 | 
					 | 
				
			||||||
 	drw->w = w;
 | 
					 | 
				
			||||||
 	drw->h = h;
 | 
					 | 
				
			||||||
-	drw->drawable = XCreatePixmap(dpy, root, w, h, DefaultDepth(dpy, screen));
 | 
					 | 
				
			||||||
-	drw->gc = XCreateGC(dpy, root, 0, NULL);
 | 
					 | 
				
			||||||
+	drw->visual = visual;
 | 
					 | 
				
			||||||
+	drw->depth = depth;
 | 
					 | 
				
			||||||
+	drw->cmap = cmap;
 | 
					 | 
				
			||||||
+	drw->drawable = XCreatePixmap(dpy, root, w, h, depth);
 | 
					 | 
				
			||||||
+	drw->gc = XCreateGC(dpy, drw->drawable, 0, NULL);
 | 
					 | 
				
			||||||
 	XSetLineAttributes(dpy, drw->gc, 1, LineSolid, CapButt, JoinMiter);
 | 
					 | 
				
			||||||
 
 | 
					 | 
				
			||||||
 	return drw;
 | 
					 | 
				
			||||||
@@ -87,7 +90,7 @@ drw_resize(Drw *drw, unsigned int w, unsigned int h)
 | 
					 | 
				
			||||||
 	drw->h = h;
 | 
					 | 
				
			||||||
 	if (drw->drawable)
 | 
					 | 
				
			||||||
 		XFreePixmap(drw->dpy, drw->drawable);
 | 
					 | 
				
			||||||
-	drw->drawable = XCreatePixmap(drw->dpy, drw->root, w, h, DefaultDepth(drw->dpy, drw->screen));
 | 
					 | 
				
			||||||
+	drw->drawable = XCreatePixmap(drw->dpy, drw->root, w, h, drw->depth);
 | 
					 | 
				
			||||||
 }
 | 
					 | 
				
			||||||
 
 | 
					 | 
				
			||||||
 void
 | 
					 | 
				
			||||||
@@ -180,21 +183,22 @@ drw_fontset_free(Fnt *font)
 | 
					 | 
				
			||||||
 }
 | 
					 | 
				
			||||||
 
 | 
					 | 
				
			||||||
 void
 | 
					 | 
				
			||||||
-drw_clr_create(Drw *drw, Clr *dest, const char *clrname)
 | 
					 | 
				
			||||||
+drw_clr_create(Drw *drw, Clr *dest, const char *clrname, unsigned int alpha)
 | 
					 | 
				
			||||||
 {
 | 
					 | 
				
			||||||
 	if (!drw || !dest || !clrname)
 | 
					 | 
				
			||||||
 		return;
 | 
					 | 
				
			||||||
 
 | 
					 | 
				
			||||||
-	if (!XftColorAllocName(drw->dpy, DefaultVisual(drw->dpy, drw->screen),
 | 
					 | 
				
			||||||
-	                       DefaultColormap(drw->dpy, drw->screen),
 | 
					 | 
				
			||||||
+	if (!XftColorAllocName(drw->dpy, drw->visual, drw->cmap,
 | 
					 | 
				
			||||||
 	                       clrname, dest))
 | 
					 | 
				
			||||||
 		die("error, cannot allocate color '%s'", clrname);
 | 
					 | 
				
			||||||
+
 | 
					 | 
				
			||||||
+	dest->pixel = (dest->pixel & 0x00ffffffU) | (alpha << 24);
 | 
					 | 
				
			||||||
 }
 | 
					 | 
				
			||||||
 
 | 
					 | 
				
			||||||
 /* Wrapper to create color schemes. The caller has to call free(3) on the
 | 
					 | 
				
			||||||
  * returned color scheme when done using it. */
 | 
					 | 
				
			||||||
 Clr *
 | 
					 | 
				
			||||||
-drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount)
 | 
					 | 
				
			||||||
+drw_scm_create(Drw *drw, const char *clrnames[], const unsigned int alphas[], size_t clrcount)
 | 
					 | 
				
			||||||
 {
 | 
					 | 
				
			||||||
 	size_t i;
 | 
					 | 
				
			||||||
 	Clr *ret;
 | 
					 | 
				
			||||||
@@ -204,7 +208,7 @@ drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount)
 | 
					 | 
				
			||||||
 		return NULL;
 | 
					 | 
				
			||||||
 
 | 
					 | 
				
			||||||
 	for (i = 0; i < clrcount; i++)
 | 
					 | 
				
			||||||
-		drw_clr_create(drw, &ret[i], clrnames[i]);
 | 
					 | 
				
			||||||
+		drw_clr_create(drw, &ret[i], clrnames[i], alphas[i]);
 | 
					 | 
				
			||||||
 	return ret;
 | 
					 | 
				
			||||||
 }
 | 
					 | 
				
			||||||
 
 | 
					 | 
				
			||||||
@@ -260,9 +264,7 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp
 | 
					 | 
				
			||||||
 	} else {
 | 
					 | 
				
			||||||
 		XSetForeground(drw->dpy, drw->gc, drw->scheme[invert ? ColFg : ColBg].pixel);
 | 
					 | 
				
			||||||
 		XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w, h);
 | 
					 | 
				
			||||||
-		d = XftDrawCreate(drw->dpy, drw->drawable,
 | 
					 | 
				
			||||||
-		                  DefaultVisual(drw->dpy, drw->screen),
 | 
					 | 
				
			||||||
-		                  DefaultColormap(drw->dpy, drw->screen));
 | 
					 | 
				
			||||||
+		d = XftDrawCreate(drw->dpy, drw->drawable, drw->visual, drw->cmap);
 | 
					 | 
				
			||||||
 		x += lpad;
 | 
					 | 
				
			||||||
 		w -= lpad;
 | 
					 | 
				
			||||||
 	}
 | 
					 | 
				
			||||||
diff --git a/drw.h b/drw.h
 | 
					 | 
				
			||||||
index 4bcd5ad..a56f523 100644
 | 
					 | 
				
			||||||
--- a/drw.h
 | 
					 | 
				
			||||||
+++ b/drw.h
 | 
					 | 
				
			||||||
@@ -20,6 +20,9 @@ typedef struct {
 | 
					 | 
				
			||||||
 	Display *dpy;
 | 
					 | 
				
			||||||
 	int screen;
 | 
					 | 
				
			||||||
 	Window root;
 | 
					 | 
				
			||||||
+	Visual *visual;
 | 
					 | 
				
			||||||
+	unsigned int depth;
 | 
					 | 
				
			||||||
+	Colormap cmap;
 | 
					 | 
				
			||||||
 	Drawable drawable;
 | 
					 | 
				
			||||||
 	GC gc;
 | 
					 | 
				
			||||||
 	Clr *scheme;
 | 
					 | 
				
			||||||
@@ -27,7 +30,7 @@ typedef struct {
 | 
					 | 
				
			||||||
 } Drw;
 | 
					 | 
				
			||||||
 
 | 
					 | 
				
			||||||
 /* Drawable abstraction */
 | 
					 | 
				
			||||||
-Drw *drw_create(Display *dpy, int screen, Window win, unsigned int w, unsigned int h);
 | 
					 | 
				
			||||||
+Drw *drw_create(Display *dpy, int screen, Window win, unsigned int w, unsigned int h, Visual *visual, unsigned int depth, Colormap cmap);
 | 
					 | 
				
			||||||
 void drw_resize(Drw *drw, unsigned int w, unsigned int h);
 | 
					 | 
				
			||||||
 void drw_free(Drw *drw);
 | 
					 | 
				
			||||||
 
 | 
					 | 
				
			||||||
@@ -38,8 +41,8 @@ unsigned int drw_fontset_getwidth(Drw *drw, const char *text);
 | 
					 | 
				
			||||||
 void drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned int *w, unsigned int *h);
 | 
					 | 
				
			||||||
 
 | 
					 | 
				
			||||||
 /* Colorscheme abstraction */
 | 
					 | 
				
			||||||
-void drw_clr_create(Drw *drw, Clr *dest, const char *clrname);
 | 
					 | 
				
			||||||
-Clr *drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount);
 | 
					 | 
				
			||||||
+void drw_clr_create(Drw *drw, Clr *dest, const char *clrname, unsigned int alpha);
 | 
					 | 
				
			||||||
+Clr *drw_scm_create(Drw *drw, const char *clrnames[], const unsigned int alphas[], size_t clrcount);
 | 
					 | 
				
			||||||
 
 | 
					 | 
				
			||||||
 /* Cursor abstraction */
 | 
					 | 
				
			||||||
 Cur *drw_cur_create(Drw *drw, int shape);
 | 
					 | 
				
			||||||
diff --git a/dwm.c b/dwm.c
 | 
					 | 
				
			||||||
index 4465af1..20f8309 100644
 | 
					 | 
				
			||||||
--- a/dwm.c
 | 
					 | 
				
			||||||
+++ b/dwm.c
 | 
					 | 
				
			||||||
@@ -57,6 +57,8 @@
 | 
					 | 
				
			||||||
 #define TAGMASK                 ((1 << LENGTH(tags)) - 1)
 | 
					 | 
				
			||||||
 #define TEXTW(X)                (drw_fontset_getwidth(drw, (X)) + lrpad)
 | 
					 | 
				
			||||||
 
 | 
					 | 
				
			||||||
+#define OPAQUE                  0xffU
 | 
					 | 
				
			||||||
+
 | 
					 | 
				
			||||||
 /* enums */
 | 
					 | 
				
			||||||
 enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
 | 
					 | 
				
			||||||
 enum { SchemeNorm, SchemeSel }; /* color schemes */
 | 
					 | 
				
			||||||
@@ -232,6 +234,7 @@ static Monitor *wintomon(Window w);
 | 
					 | 
				
			||||||
 static int xerror(Display *dpy, XErrorEvent *ee);
 | 
					 | 
				
			||||||
 static int xerrordummy(Display *dpy, XErrorEvent *ee);
 | 
					 | 
				
			||||||
 static int xerrorstart(Display *dpy, XErrorEvent *ee);
 | 
					 | 
				
			||||||
+static void xinitvisual();
 | 
					 | 
				
			||||||
 static void zoom(const Arg *arg);
 | 
					 | 
				
			||||||
 
 | 
					 | 
				
			||||||
 /* variables */
 | 
					 | 
				
			||||||
@@ -268,6 +271,11 @@ static Drw *drw;
 | 
					 | 
				
			||||||
 static Monitor *mons, *selmon;
 | 
					 | 
				
			||||||
 static Window root, wmcheckwin;
 | 
					 | 
				
			||||||
 
 | 
					 | 
				
			||||||
+static int useargb = 0;
 | 
					 | 
				
			||||||
+static Visual *visual;
 | 
					 | 
				
			||||||
+static int depth;
 | 
					 | 
				
			||||||
+static Colormap cmap;
 | 
					 | 
				
			||||||
+
 | 
					 | 
				
			||||||
 /* configuration, allows nested code to access above variables */
 | 
					 | 
				
			||||||
 #include "config.h"
 | 
					 | 
				
			||||||
 
 | 
					 | 
				
			||||||
@@ -1541,7 +1549,8 @@ setup(void)
 | 
					 | 
				
			||||||
 	sw = DisplayWidth(dpy, screen);
 | 
					 | 
				
			||||||
 	sh = DisplayHeight(dpy, screen);
 | 
					 | 
				
			||||||
 	root = RootWindow(dpy, screen);
 | 
					 | 
				
			||||||
-	drw = drw_create(dpy, screen, root, sw, sh);
 | 
					 | 
				
			||||||
+	xinitvisual();
 | 
					 | 
				
			||||||
+	drw = drw_create(dpy, screen, root, sw, sh, visual, depth, cmap);
 | 
					 | 
				
			||||||
 	if (!drw_fontset_create(drw, fonts, LENGTH(fonts)))
 | 
					 | 
				
			||||||
 		die("no fonts could be loaded.");
 | 
					 | 
				
			||||||
 	lrpad = drw->fonts->h;
 | 
					 | 
				
			||||||
@@ -1569,7 +1578,7 @@ setup(void)
 | 
					 | 
				
			||||||
 	/* init appearance */
 | 
					 | 
				
			||||||
 	scheme = ecalloc(LENGTH(colors), sizeof(Clr *));
 | 
					 | 
				
			||||||
 	for (i = 0; i < LENGTH(colors); i++)
 | 
					 | 
				
			||||||
-		scheme[i] = drw_scm_create(drw, colors[i], 3);
 | 
					 | 
				
			||||||
+		scheme[i] = drw_scm_create(drw, colors[i], alphas[i], 3);
 | 
					 | 
				
			||||||
 	/* init bars */
 | 
					 | 
				
			||||||
 	updatebars();
 | 
					 | 
				
			||||||
 	updatestatus();
 | 
					 | 
				
			||||||
@@ -1804,16 +1813,18 @@ updatebars(void)
 | 
					 | 
				
			||||||
 	Monitor *m;
 | 
					 | 
				
			||||||
 	XSetWindowAttributes wa = {
 | 
					 | 
				
			||||||
 		.override_redirect = True,
 | 
					 | 
				
			||||||
-		.background_pixmap = ParentRelative,
 | 
					 | 
				
			||||||
+		.background_pixel = 0,
 | 
					 | 
				
			||||||
+		.border_pixel = 0,
 | 
					 | 
				
			||||||
+		.colormap = cmap,
 | 
					 | 
				
			||||||
 		.event_mask = ButtonPressMask|ExposureMask
 | 
					 | 
				
			||||||
 	};
 | 
					 | 
				
			||||||
 	XClassHint ch = {"dwm", "dwm"};
 | 
					 | 
				
			||||||
 	for (m = mons; m; m = m->next) {
 | 
					 | 
				
			||||||
 		if (m->barwin)
 | 
					 | 
				
			||||||
 			continue;
 | 
					 | 
				
			||||||
-		m->barwin = XCreateWindow(dpy, root, m->wx, m->by, m->ww, bh, 0, DefaultDepth(dpy, screen),
 | 
					 | 
				
			||||||
-				CopyFromParent, DefaultVisual(dpy, screen),
 | 
					 | 
				
			||||||
-				CWOverrideRedirect|CWBackPixmap|CWEventMask, &wa);
 | 
					 | 
				
			||||||
+		m->barwin = XCreateWindow(dpy, root, m->wx, m->by, m->ww, bh, 0, depth,
 | 
					 | 
				
			||||||
+		                          InputOutput, visual,
 | 
					 | 
				
			||||||
+		                          CWOverrideRedirect|CWBackPixel|CWBorderPixel|CWColormap|CWEventMask, &wa);
 | 
					 | 
				
			||||||
 		XDefineCursor(dpy, m->barwin, cursor[CurNormal]->cursor);
 | 
					 | 
				
			||||||
 		XMapRaised(dpy, m->barwin);
 | 
					 | 
				
			||||||
 		XSetClassHint(dpy, m->barwin, &ch);
 | 
					 | 
				
			||||||
@@ -2110,6 +2121,43 @@ xerrorstart(Display *dpy, XErrorEvent *ee)
 | 
					 | 
				
			||||||
 	return -1;
 | 
					 | 
				
			||||||
 }
 | 
					 | 
				
			||||||
 
 | 
					 | 
				
			||||||
+void
 | 
					 | 
				
			||||||
+xinitvisual()
 | 
					 | 
				
			||||||
+{
 | 
					 | 
				
			||||||
+	XVisualInfo *infos;
 | 
					 | 
				
			||||||
+	XRenderPictFormat *fmt;
 | 
					 | 
				
			||||||
+	int nitems;
 | 
					 | 
				
			||||||
+	int i;
 | 
					 | 
				
			||||||
+
 | 
					 | 
				
			||||||
+	XVisualInfo tpl = {
 | 
					 | 
				
			||||||
+		.screen = screen,
 | 
					 | 
				
			||||||
+		.depth = 32,
 | 
					 | 
				
			||||||
+		.class = TrueColor
 | 
					 | 
				
			||||||
+	};
 | 
					 | 
				
			||||||
+	long masks = VisualScreenMask | VisualDepthMask | VisualClassMask;
 | 
					 | 
				
			||||||
+
 | 
					 | 
				
			||||||
+	infos = XGetVisualInfo(dpy, masks, &tpl, &nitems);
 | 
					 | 
				
			||||||
+	visual = NULL;
 | 
					 | 
				
			||||||
+	for(i = 0; i < nitems; i ++) {
 | 
					 | 
				
			||||||
+		fmt = XRenderFindVisualFormat(dpy, infos[i].visual);
 | 
					 | 
				
			||||||
+		if (fmt->type == PictTypeDirect && fmt->direct.alphaMask) {
 | 
					 | 
				
			||||||
+			visual = infos[i].visual;
 | 
					 | 
				
			||||||
+			depth = infos[i].depth;
 | 
					 | 
				
			||||||
+			cmap = XCreateColormap(dpy, root, visual, AllocNone);
 | 
					 | 
				
			||||||
+			useargb = 1;
 | 
					 | 
				
			||||||
+			break;
 | 
					 | 
				
			||||||
+		}
 | 
					 | 
				
			||||||
+	}
 | 
					 | 
				
			||||||
+
 | 
					 | 
				
			||||||
+	XFree(infos);
 | 
					 | 
				
			||||||
+
 | 
					 | 
				
			||||||
+	if (! visual) {
 | 
					 | 
				
			||||||
+		visual = DefaultVisual(dpy, screen);
 | 
					 | 
				
			||||||
+		depth = DefaultDepth(dpy, screen);
 | 
					 | 
				
			||||||
+		cmap = DefaultColormap(dpy, screen);
 | 
					 | 
				
			||||||
+	}
 | 
					 | 
				
			||||||
+}
 | 
					 | 
				
			||||||
+
 | 
					 | 
				
			||||||
 void
 | 
					 | 
				
			||||||
 zoom(const Arg *arg)
 | 
					 | 
				
			||||||
 {
 | 
					 | 
				
			||||||
-- 
 | 
					 | 
				
			||||||
2.17.0
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
@@ -1,101 +0,0 @@
 | 
				
			|||||||
diff --git a/config.def.h b/config.def.h
 | 
					 | 
				
			||||||
index fd77a07..c3a044b 100644
 | 
					 | 
				
			||||||
--- a/config.def.h
 | 
					 | 
				
			||||||
+++ b/config.def.h
 | 
					 | 
				
			||||||
@@ -41,6 +41,8 @@ static const Layout layouts[] = {
 | 
					 | 
				
			||||||
 	{ "[]=",      tile },    /* first entry is default */
 | 
					 | 
				
			||||||
 	{ "><>",      NULL },    /* no layout function means floating behavior */
 | 
					 | 
				
			||||||
 	{ "[M]",      monocle },
 | 
					 | 
				
			||||||
+	{ "TTT",      bstack },
 | 
					 | 
				
			||||||
+	{ "===",      bstackhoriz },
 | 
					 | 
				
			||||||
 };
 | 
					 | 
				
			||||||
 
 | 
					 | 
				
			||||||
 /* key definitions */
 | 
					 | 
				
			||||||
@@ -76,6 +78,8 @@ static Key keys[] = {
 | 
					 | 
				
			||||||
 	{ MODKEY,                       XK_t,      setlayout,      {.v = &layouts[0]} },
 | 
					 | 
				
			||||||
 	{ MODKEY,                       XK_f,      setlayout,      {.v = &layouts[1]} },
 | 
					 | 
				
			||||||
 	{ MODKEY,                       XK_m,      setlayout,      {.v = &layouts[2]} },
 | 
					 | 
				
			||||||
+	{ MODKEY,                       XK_u,      setlayout,      {.v = &layouts[3]} },
 | 
					 | 
				
			||||||
+	{ MODKEY,                       XK_o,      setlayout,      {.v = &layouts[4]} },
 | 
					 | 
				
			||||||
 	{ MODKEY,                       XK_space,  setlayout,      {0} },
 | 
					 | 
				
			||||||
 	{ MODKEY|ShiftMask,             XK_space,  togglefloating, {0} },
 | 
					 | 
				
			||||||
 	{ MODKEY,                       XK_0,      view,           {.ui = ~0 } },
 | 
					 | 
				
			||||||
diff --git a/dwm.c b/dwm.c
 | 
					 | 
				
			||||||
index b2bc9bd..8b74165 100644
 | 
					 | 
				
			||||||
--- a/dwm.c
 | 
					 | 
				
			||||||
+++ b/dwm.c
 | 
					 | 
				
			||||||
@@ -234,6 +234,8 @@ static int xerror(Display *dpy, XErrorEvent *ee);
 | 
					 | 
				
			||||||
 static int xerrordummy(Display *dpy, XErrorEvent *ee);
 | 
					 | 
				
			||||||
 static int xerrorstart(Display *dpy, XErrorEvent *ee);
 | 
					 | 
				
			||||||
 static void zoom(const Arg *arg);
 | 
					 | 
				
			||||||
+static void bstack(Monitor *m);
 | 
					 | 
				
			||||||
+static void bstackhoriz(Monitor *m);
 | 
					 | 
				
			||||||
 
 | 
					 | 
				
			||||||
 /* variables */
 | 
					 | 
				
			||||||
 static const char broken[] = "broken";
 | 
					 | 
				
			||||||
@@ -2138,3 +2140,65 @@ main(int argc, char *argv[])
 | 
					 | 
				
			||||||
 	XCloseDisplay(dpy);
 | 
					 | 
				
			||||||
 	return EXIT_SUCCESS;
 | 
					 | 
				
			||||||
 }
 | 
					 | 
				
			||||||
+
 | 
					 | 
				
			||||||
+static void
 | 
					 | 
				
			||||||
+bstack(Monitor *m) {
 | 
					 | 
				
			||||||
+	int w, h, mh, mx, tx, ty, tw;
 | 
					 | 
				
			||||||
+	unsigned int i, n;
 | 
					 | 
				
			||||||
+	Client *c;
 | 
					 | 
				
			||||||
+
 | 
					 | 
				
			||||||
+	for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
 | 
					 | 
				
			||||||
+	if (n == 0)
 | 
					 | 
				
			||||||
+		return;
 | 
					 | 
				
			||||||
+	if (n > m->nmaster) {
 | 
					 | 
				
			||||||
+		mh = m->nmaster ? m->mfact * m->wh : 0;
 | 
					 | 
				
			||||||
+		tw = m->ww / (n - m->nmaster);
 | 
					 | 
				
			||||||
+		ty = m->wy + mh;
 | 
					 | 
				
			||||||
+	} else {
 | 
					 | 
				
			||||||
+		mh = m->wh;
 | 
					 | 
				
			||||||
+		tw = m->ww;
 | 
					 | 
				
			||||||
+		ty = m->wy;
 | 
					 | 
				
			||||||
+	}
 | 
					 | 
				
			||||||
+	for (i = mx = 0, tx = m->wx, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) {
 | 
					 | 
				
			||||||
+		if (i < m->nmaster) {
 | 
					 | 
				
			||||||
+			w = (m->ww - mx) / (MIN(n, m->nmaster) - i);
 | 
					 | 
				
			||||||
+			resize(c, m->wx + mx, m->wy, w - (2 * c->bw), mh - (2 * c->bw), 0);
 | 
					 | 
				
			||||||
+			mx += WIDTH(c);
 | 
					 | 
				
			||||||
+		} else {
 | 
					 | 
				
			||||||
+			h = m->wh - mh;
 | 
					 | 
				
			||||||
+			resize(c, tx, ty, tw - (2 * c->bw), h - (2 * c->bw), 0);
 | 
					 | 
				
			||||||
+			if (tw != m->ww)
 | 
					 | 
				
			||||||
+				tx += WIDTH(c);
 | 
					 | 
				
			||||||
+		}
 | 
					 | 
				
			||||||
+	}
 | 
					 | 
				
			||||||
+}
 | 
					 | 
				
			||||||
+
 | 
					 | 
				
			||||||
+static void
 | 
					 | 
				
			||||||
+bstackhoriz(Monitor *m) {
 | 
					 | 
				
			||||||
+	int w, mh, mx, tx, ty, th;
 | 
					 | 
				
			||||||
+	unsigned int i, n;
 | 
					 | 
				
			||||||
+	Client *c;
 | 
					 | 
				
			||||||
+
 | 
					 | 
				
			||||||
+	for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
 | 
					 | 
				
			||||||
+	if (n == 0)
 | 
					 | 
				
			||||||
+		return;
 | 
					 | 
				
			||||||
+	if (n > m->nmaster) {
 | 
					 | 
				
			||||||
+		mh = m->nmaster ? m->mfact * m->wh : 0;
 | 
					 | 
				
			||||||
+		th = (m->wh - mh) / (n - m->nmaster);
 | 
					 | 
				
			||||||
+		ty = m->wy + mh;
 | 
					 | 
				
			||||||
+	} else {
 | 
					 | 
				
			||||||
+		th = mh = m->wh;
 | 
					 | 
				
			||||||
+		ty = m->wy;
 | 
					 | 
				
			||||||
+	}
 | 
					 | 
				
			||||||
+	for (i = mx = 0, tx = m->wx, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) {
 | 
					 | 
				
			||||||
+		if (i < m->nmaster) {
 | 
					 | 
				
			||||||
+			w = (m->ww - mx) / (MIN(n, m->nmaster) - i);
 | 
					 | 
				
			||||||
+			resize(c, m->wx + mx, m->wy, w - (2 * c->bw), mh - (2 * c->bw), 0);
 | 
					 | 
				
			||||||
+			mx += WIDTH(c);
 | 
					 | 
				
			||||||
+		} else {
 | 
					 | 
				
			||||||
+			resize(c, tx, ty, m->ww - (2 * c->bw), th - (2 * c->bw), 0);
 | 
					 | 
				
			||||||
+			if (th != m->wh)
 | 
					 | 
				
			||||||
+				ty += HEIGHT(c);
 | 
					 | 
				
			||||||
+		}
 | 
					 | 
				
			||||||
+	}
 | 
					 | 
				
			||||||
+}
 | 
					 | 
				
			||||||
@@ -1,58 +0,0 @@
 | 
				
			|||||||
diff --git a/config.def.h b/config.def.h
 | 
					 | 
				
			||||||
index 7054c06..e0cdcf3 100644
 | 
					 | 
				
			||||||
--- a/config.def.h
 | 
					 | 
				
			||||||
+++ b/config.def.h
 | 
					 | 
				
			||||||
@@ -24,9 +24,9 @@ static const Rule rules[] = {
 | 
					 | 
				
			||||||
 	 *	WM_CLASS(STRING) = instance, class
 | 
					 | 
				
			||||||
 	 *	WM_NAME(STRING) = title
 | 
					 | 
				
			||||||
 	 */
 | 
					 | 
				
			||||||
-	/* class      instance    title       tags mask     isfloating   monitor */
 | 
					 | 
				
			||||||
-	{ "Gimp",     NULL,       NULL,       0,            1,           -1 },
 | 
					 | 
				
			||||||
-	{ "Firefox",  NULL,       NULL,       1 << 8,       0,           -1 },
 | 
					 | 
				
			||||||
+	/* class      instance    title       tags mask     iscentered     isfloating   monitor */
 | 
					 | 
				
			||||||
+	{ "Gimp",     NULL,       NULL,       0,            0,             1,           -1 },
 | 
					 | 
				
			||||||
+	{ "Firefox",  NULL,       NULL,       1 << 8,       0,             0,           -1 },
 | 
					 | 
				
			||||||
 };
 | 
					 | 
				
			||||||
 
 | 
					 | 
				
			||||||
 /* layout(s) */
 | 
					 | 
				
			||||||
diff --git a/dwm.c b/dwm.c
 | 
					 | 
				
			||||||
index 0362114..4aaaa60 100644
 | 
					 | 
				
			||||||
--- a/dwm.c
 | 
					 | 
				
			||||||
+++ b/dwm.c
 | 
					 | 
				
			||||||
@@ -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, iscentered, isfloating, isurgent, neverfocus, oldstate, isfullscreen;
 | 
					 | 
				
			||||||
 	Client *next;
 | 
					 | 
				
			||||||
 	Client *snext;
 | 
					 | 
				
			||||||
 	Monitor *mon;
 | 
					 | 
				
			||||||
@@ -137,6 +137,7 @@ typedef struct {
 | 
					 | 
				
			||||||
 	const char *instance;
 | 
					 | 
				
			||||||
 	const char *title;
 | 
					 | 
				
			||||||
 	unsigned int tags;
 | 
					 | 
				
			||||||
+	int iscentered;
 | 
					 | 
				
			||||||
 	int isfloating;
 | 
					 | 
				
			||||||
 	int monitor;
 | 
					 | 
				
			||||||
 } Rule;
 | 
					 | 
				
			||||||
@@ -296,6 +297,7 @@ applyrules(Client *c)
 | 
					 | 
				
			||||||
 		&& (!r->class || strstr(class, r->class))
 | 
					 | 
				
			||||||
 		&& (!r->instance || strstr(instance, r->instance)))
 | 
					 | 
				
			||||||
 		{
 | 
					 | 
				
			||||||
+			c->iscentered = r->iscentered;
 | 
					 | 
				
			||||||
 			c->isfloating = r->isfloating;
 | 
					 | 
				
			||||||
 			c->tags |= r->tags;
 | 
					 | 
				
			||||||
 			for (m = mons; m && m->num != r->monitor; m = m->next);
 | 
					 | 
				
			||||||
@@ -1063,6 +1065,11 @@ manage(Window w, XWindowAttributes *wa)
 | 
					 | 
				
			||||||
 	           && (c->x + (c->w / 2) < c->mon->wx + c->mon->ww)) ? bh : c->mon->my);
 | 
					 | 
				
			||||||
 	c->bw = borderpx;
 | 
					 | 
				
			||||||
 
 | 
					 | 
				
			||||||
+	if(c->iscentered) {
 | 
					 | 
				
			||||||
+		c->x = (c->mon->mw - WIDTH(c)) / 2;
 | 
					 | 
				
			||||||
+		c->y = (c->mon->mh - HEIGHT(c)) / 2;
 | 
					 | 
				
			||||||
+	}
 | 
					 | 
				
			||||||
+
 | 
					 | 
				
			||||||
 	wc.border_width = c->bw;
 | 
					 | 
				
			||||||
 	XConfigureWindow(dpy, w, CWBorderWidth, &wc);
 | 
					 | 
				
			||||||
 	XSetWindowBorder(dpy, w, scheme[SchemeNorm].border->pix);
 | 
					 | 
				
			||||||
@@ -1,93 +0,0 @@
 | 
				
			|||||||
From a09e766a4342f580582082a92b2de65f33208eb4 Mon Sep 17 00:00:00 2001
 | 
					 | 
				
			||||||
From: Christopher Drelich <cd@cdrakka.com>
 | 
					 | 
				
			||||||
Date: Thu, 24 May 2018 00:56:56 -0400
 | 
					 | 
				
			||||||
Subject: [PATCH] Function to cycle through available layouts.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
MOD-CTRL-, and MOD-CTRL-.
 | 
					 | 
				
			||||||
cycle backwards and forwards through available layouts.
 | 
					 | 
				
			||||||
Probably only useful if you have a lot of additional layouts.
 | 
					 | 
				
			||||||
The NULL, NULL layout should always be the last layout in your list,
 | 
					 | 
				
			||||||
in order to guarantee consistent behavior.
 | 
					 | 
				
			||||||
---
 | 
					 | 
				
			||||||
 config.def.h |  3 +++
 | 
					 | 
				
			||||||
 dwm.1        |  6 ++++++
 | 
					 | 
				
			||||||
 dwm.c        | 18 ++++++++++++++++++
 | 
					 | 
				
			||||||
 3 files changed, 27 insertions(+)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
diff --git a/config.def.h b/config.def.h
 | 
					 | 
				
			||||||
index a9ac303..153b880 100644
 | 
					 | 
				
			||||||
--- a/config.def.h
 | 
					 | 
				
			||||||
+++ b/config.def.h
 | 
					 | 
				
			||||||
@@ -41,6 +41,7 @@ static const Layout layouts[] = {
 | 
					 | 
				
			||||||
 	{ "[]=",      tile },    /* first entry is default */
 | 
					 | 
				
			||||||
 	{ "><>",      NULL },    /* no layout function means floating behavior */
 | 
					 | 
				
			||||||
 	{ "[M]",      monocle },
 | 
					 | 
				
			||||||
+	{ NULL,       NULL },
 | 
					 | 
				
			||||||
 };
 | 
					 | 
				
			||||||
 
 | 
					 | 
				
			||||||
 /* key definitions */
 | 
					 | 
				
			||||||
@@ -76,6 +77,8 @@ static Key keys[] = {
 | 
					 | 
				
			||||||
 	{ MODKEY,                       XK_t,      setlayout,      {.v = &layouts[0]} },
 | 
					 | 
				
			||||||
 	{ MODKEY,                       XK_f,      setlayout,      {.v = &layouts[1]} },
 | 
					 | 
				
			||||||
 	{ MODKEY,                       XK_m,      setlayout,      {.v = &layouts[2]} },
 | 
					 | 
				
			||||||
+	{ MODKEY|ControlMask,		XK_comma,  cyclelayout,    {.i = -1 } },
 | 
					 | 
				
			||||||
+	{ MODKEY|ControlMask,           XK_period, cyclelayout,    {.i = +1 } },
 | 
					 | 
				
			||||||
 	{ MODKEY,                       XK_space,  setlayout,      {0} },
 | 
					 | 
				
			||||||
 	{ MODKEY|ShiftMask,             XK_space,  togglefloating, {0} },
 | 
					 | 
				
			||||||
 	{ MODKEY,                       XK_0,      view,           {.ui = ~0 } },
 | 
					 | 
				
			||||||
diff --git a/dwm.1 b/dwm.1
 | 
					 | 
				
			||||||
index 13b3729..165891b 100644
 | 
					 | 
				
			||||||
--- a/dwm.1
 | 
					 | 
				
			||||||
+++ b/dwm.1
 | 
					 | 
				
			||||||
@@ -92,6 +92,12 @@ Sets monocle layout.
 | 
					 | 
				
			||||||
 .B Mod1\-space
 | 
					 | 
				
			||||||
 Toggles between current and previous layout.
 | 
					 | 
				
			||||||
 .TP
 | 
					 | 
				
			||||||
+.B Mod1\-Control\-,
 | 
					 | 
				
			||||||
+Cycles backwards in layout list.
 | 
					 | 
				
			||||||
+.TP
 | 
					 | 
				
			||||||
+.B Mod1\-Control\-.
 | 
					 | 
				
			||||||
+Cycles forwards in layout list.
 | 
					 | 
				
			||||||
+.TP
 | 
					 | 
				
			||||||
 .B Mod1\-j
 | 
					 | 
				
			||||||
 Focus next window.
 | 
					 | 
				
			||||||
 .TP
 | 
					 | 
				
			||||||
diff --git a/dwm.c b/dwm.c
 | 
					 | 
				
			||||||
index bb95e26..db73000 100644
 | 
					 | 
				
			||||||
--- a/dwm.c
 | 
					 | 
				
			||||||
+++ b/dwm.c
 | 
					 | 
				
			||||||
@@ -157,6 +157,7 @@ static void configure(Client *c);
 | 
					 | 
				
			||||||
 static void configurenotify(XEvent *e);
 | 
					 | 
				
			||||||
 static void configurerequest(XEvent *e);
 | 
					 | 
				
			||||||
 static Monitor *createmon(void);
 | 
					 | 
				
			||||||
+static void cyclelayout(const Arg *arg);
 | 
					 | 
				
			||||||
 static void destroynotify(XEvent *e);
 | 
					 | 
				
			||||||
 static void detach(Client *c);
 | 
					 | 
				
			||||||
 static void detachstack(Client *c);
 | 
					 | 
				
			||||||
@@ -645,6 +646,23 @@ createmon(void)
 | 
					 | 
				
			||||||
 }
 | 
					 | 
				
			||||||
 
 | 
					 | 
				
			||||||
 void
 | 
					 | 
				
			||||||
+cyclelayout(const Arg *arg) {
 | 
					 | 
				
			||||||
+	Layout *l;
 | 
					 | 
				
			||||||
+	for(l = (Layout *)layouts; l != selmon->lt[selmon->sellt]; l++);
 | 
					 | 
				
			||||||
+	if(arg->i > 0) {
 | 
					 | 
				
			||||||
+		if(l->symbol && (l + 1)->symbol)
 | 
					 | 
				
			||||||
+			setlayout(&((Arg) { .v = (l + 1) }));
 | 
					 | 
				
			||||||
+		else
 | 
					 | 
				
			||||||
+			setlayout(&((Arg) { .v = layouts }));
 | 
					 | 
				
			||||||
+	} else {
 | 
					 | 
				
			||||||
+		if(l != layouts && (l - 1)->symbol)
 | 
					 | 
				
			||||||
+			setlayout(&((Arg) { .v = (l - 1) }));
 | 
					 | 
				
			||||||
+		else
 | 
					 | 
				
			||||||
+			setlayout(&((Arg) { .v = &layouts[LENGTH(layouts) - 2] }));
 | 
					 | 
				
			||||||
+	}
 | 
					 | 
				
			||||||
+}
 | 
					 | 
				
			||||||
+
 | 
					 | 
				
			||||||
+void
 | 
					 | 
				
			||||||
 destroynotify(XEvent *e)
 | 
					 | 
				
			||||||
 {
 | 
					 | 
				
			||||||
 	Client *c;
 | 
					 | 
				
			||||||
-- 
 | 
					 | 
				
			||||||
2.7.4
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
@@ -1,90 +0,0 @@
 | 
				
			|||||||
From cb3cac91db32403bb581aecbc2957b00bb49c898 Mon Sep 17 00:00:00 2001
 | 
					 | 
				
			||||||
From: aleks <aleks.stier@icloud.com>
 | 
					 | 
				
			||||||
Date: Mon, 6 May 2019 16:34:58 +0200
 | 
					 | 
				
			||||||
Subject: [PATCH] Add deck-layout
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
deck is a dwm-layout which is inspired by the TTWM window manager.
 | 
					 | 
				
			||||||
It applies the monocle-layout to the clients in the stack.
 | 
					 | 
				
			||||||
The master-client is still visible. The stacked clients are like
 | 
					 | 
				
			||||||
a deck of cards, hence the name.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
The vanilla patch doesn't work properly with patches which add gaps.
 | 
					 | 
				
			||||||
This means that when the deck-layout is activated gaps are omitted.
 | 
					 | 
				
			||||||
To make it work with the tilegap-patch apply the dwm-deck-tilegap patch
 | 
					 | 
				
			||||||
on top of the dwm-deck patch.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
The vanilla patch doesn't respect the master-area which is defined by
 | 
					 | 
				
			||||||
the rmaster-patch. To make it work with the rmaster-patch apply the
 | 
					 | 
				
			||||||
dwm-deck-rmaster patch on top of the dwm-deck patch.
 | 
					 | 
				
			||||||
---
 | 
					 | 
				
			||||||
 config.def.h |  2 ++
 | 
					 | 
				
			||||||
 dwm.c        | 26 ++++++++++++++++++++++++++
 | 
					 | 
				
			||||||
 2 files changed, 28 insertions(+)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
diff --git a/config.def.h b/config.def.h
 | 
					 | 
				
			||||||
index 77ff358..55d8a07 100644
 | 
					 | 
				
			||||||
--- a/config.def.h
 | 
					 | 
				
			||||||
+++ b/config.def.h
 | 
					 | 
				
			||||||
@@ -32,6 +32,7 @@ static const Layout layouts[] = {
 | 
					 | 
				
			||||||
 	{ "[]=",      tile },    /* first entry is default */
 | 
					 | 
				
			||||||
 	{ "><>",      NULL },    /* no layout function means floating behavior */
 | 
					 | 
				
			||||||
 	{ "[M]",      monocle },
 | 
					 | 
				
			||||||
+	{ "[D]",      deck },
 | 
					 | 
				
			||||||
 };
 | 
					 | 
				
			||||||
 
 | 
					 | 
				
			||||||
 /* key definitions */
 | 
					 | 
				
			||||||
@@ -66,6 +67,7 @@ static Key keys[] = {
 | 
					 | 
				
			||||||
 	{ MODKEY,                       XK_t,      setlayout,      {.v = &layouts[0]} },
 | 
					 | 
				
			||||||
 	{ MODKEY,                       XK_f,      setlayout,      {.v = &layouts[1]} },
 | 
					 | 
				
			||||||
 	{ MODKEY,                       XK_m,      setlayout,      {.v = &layouts[2]} },
 | 
					 | 
				
			||||||
+	{ MODKEY,                       XK_c,      setlayout,      {.v = &layouts[3]} },
 | 
					 | 
				
			||||||
 	{ MODKEY,                       XK_space,  setlayout,      {0} },
 | 
					 | 
				
			||||||
 	{ MODKEY|ShiftMask,             XK_space,  togglefloating, {0} },
 | 
					 | 
				
			||||||
 	{ MODKEY,                       XK_0,      view,           {.ui = ~0 } },
 | 
					 | 
				
			||||||
diff --git a/dwm.c b/dwm.c
 | 
					 | 
				
			||||||
index 1d78655..356ab44 100644
 | 
					 | 
				
			||||||
--- a/dwm.c
 | 
					 | 
				
			||||||
+++ b/dwm.c
 | 
					 | 
				
			||||||
@@ -171,6 +171,7 @@ static void configure(Client *c);
 | 
					 | 
				
			||||||
 static void configurenotify(XEvent *e);
 | 
					 | 
				
			||||||
 static void configurerequest(XEvent *e);
 | 
					 | 
				
			||||||
 static Monitor *createmon(void);
 | 
					 | 
				
			||||||
+static void deck(Monitor *m);
 | 
					 | 
				
			||||||
 static void destroynotify(XEvent *e);
 | 
					 | 
				
			||||||
 static void detach(Client *c);
 | 
					 | 
				
			||||||
 static void detachstack(Client *c);
 | 
					 | 
				
			||||||
@@ -669,6 +670,31 @@ destroynotify(XEvent *e) {
 | 
					 | 
				
			||||||
 		unmanage(c, True);
 | 
					 | 
				
			||||||
 }
 | 
					 | 
				
			||||||
 
 | 
					 | 
				
			||||||
+void
 | 
					 | 
				
			||||||
+deck(Monitor *m) {
 | 
					 | 
				
			||||||
+	unsigned int i, n, h, mw, my;
 | 
					 | 
				
			||||||
+	Client *c;
 | 
					 | 
				
			||||||
+
 | 
					 | 
				
			||||||
+	for(n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
 | 
					 | 
				
			||||||
+	if(n == 0)
 | 
					 | 
				
			||||||
+		return;
 | 
					 | 
				
			||||||
+
 | 
					 | 
				
			||||||
+	if(n > m->nmaster) {
 | 
					 | 
				
			||||||
+		mw = m->nmaster ? m->ww * m->mfact : 0;
 | 
					 | 
				
			||||||
+		snprintf(m->ltsymbol, sizeof m->ltsymbol, "[%d]", n - m->nmaster);
 | 
					 | 
				
			||||||
+	}
 | 
					 | 
				
			||||||
+	else
 | 
					 | 
				
			||||||
+		mw = m->ww;
 | 
					 | 
				
			||||||
+	for(i = my = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
 | 
					 | 
				
			||||||
+		if(i < m->nmaster) {
 | 
					 | 
				
			||||||
+			h = (m->wh - my) / (MIN(n, m->nmaster) - i);
 | 
					 | 
				
			||||||
+			resize(c, m->wx, m->wy + my, mw - (2*c->bw), h - (2*c->bw), False);
 | 
					 | 
				
			||||||
+			my += HEIGHT(c);
 | 
					 | 
				
			||||||
+		}
 | 
					 | 
				
			||||||
+		else
 | 
					 | 
				
			||||||
+			resize(c, m->wx + mw, m->wy, m->ww - mw - (2*c->bw), m->wh - (2*c->bw), False);
 | 
					 | 
				
			||||||
+}
 | 
					 | 
				
			||||||
+
 | 
					 | 
				
			||||||
 void
 | 
					 | 
				
			||||||
 detach(Client *c) {
 | 
					 | 
				
			||||||
 	Client **tc;
 | 
					 | 
				
			||||||
-- 
 | 
					 | 
				
			||||||
2.21.0
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
@@ -1,30 +0,0 @@
 | 
				
			|||||||
From 9102fdb9c670218373bbe83c891c8e8138d6a6f4 Mon Sep 17 00:00:00 2001
 | 
					 | 
				
			||||||
From: redacted <redacted@example.com>
 | 
					 | 
				
			||||||
Date: Tue, 23 Apr 2019 00:39:27 +0100
 | 
					 | 
				
			||||||
Subject: [PATCH] added noborder patch
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
---
 | 
					 | 
				
			||||||
 dwm.c | 7 +++++++
 | 
					 | 
				
			||||||
 1 file changed, 7 insertions(+)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
diff --git a/dwm.c b/dwm.c
 | 
					 | 
				
			||||||
index 4465af1..685eca1 100644
 | 
					 | 
				
			||||||
--- a/dwm.c
 | 
					 | 
				
			||||||
+++ b/dwm.c
 | 
					 | 
				
			||||||
@@ -1282,6 +1282,13 @@ resizeclient(Client *c, int x, int y, int w, int h)
 | 
					 | 
				
			||||||
 	c->oldw = c->w; c->w = wc.width = w;
 | 
					 | 
				
			||||||
 	c->oldh = c->h; c->h = wc.height = h;
 | 
					 | 
				
			||||||
 	wc.border_width = c->bw;
 | 
					 | 
				
			||||||
+	if (((nexttiled(c->mon->clients) == c && !nexttiled(c->next))
 | 
					 | 
				
			||||||
+	    || &monocle == c->mon->lt[c->mon->sellt]->arrange)
 | 
					 | 
				
			||||||
+	    && !c->isfullscreen && !c->isfloating) {
 | 
					 | 
				
			||||||
+		c->w = wc.width += c->bw * 2;
 | 
					 | 
				
			||||||
+		c->h = wc.height += c->bw * 2;
 | 
					 | 
				
			||||||
+		wc.border_width = 0;
 | 
					 | 
				
			||||||
+	}
 | 
					 | 
				
			||||||
 	XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc);
 | 
					 | 
				
			||||||
 	configure(c);
 | 
					 | 
				
			||||||
 	XSync(dpy, False);
 | 
					 | 
				
			||||||
-- 
 | 
					 | 
				
			||||||
2.21.0
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
@@ -1,81 +0,0 @@
 | 
				
			|||||||
From 969dbbc548f16da5d94630e3d54e9c96c5296520 Mon Sep 17 00:00:00 2001
 | 
					 | 
				
			||||||
From: Ryan Kes <alrayyes@gmail.com>
 | 
					 | 
				
			||||||
Date: Thu, 28 Mar 2019 14:36:07 +0100
 | 
					 | 
				
			||||||
Subject: [PATCH] dwm-notitle-6.2
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
---
 | 
					 | 
				
			||||||
 config.def.h |  1 -
 | 
					 | 
				
			||||||
 dwm.c        | 20 ++++----------------
 | 
					 | 
				
			||||||
 2 files changed, 4 insertions(+), 17 deletions(-)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
diff --git a/config.def.h b/config.def.h
 | 
					 | 
				
			||||||
index 1c0b587..19330cd 100644
 | 
					 | 
				
			||||||
--- a/config.def.h
 | 
					 | 
				
			||||||
+++ b/config.def.h
 | 
					 | 
				
			||||||
@@ -102,7 +102,6 @@ static Button buttons[] = {
 | 
					 | 
				
			||||||
 	/* click                event mask      button          function        argument */
 | 
					 | 
				
			||||||
 	{ ClkLtSymbol,          0,              Button1,        setlayout,      {0} },
 | 
					 | 
				
			||||||
 	{ ClkLtSymbol,          0,              Button3,        setlayout,      {.v = &layouts[2]} },
 | 
					 | 
				
			||||||
-	{ ClkWinTitle,          0,              Button2,        zoom,           {0} },
 | 
					 | 
				
			||||||
 	{ ClkStatusText,        0,              Button2,        spawn,          {.v = termcmd } },
 | 
					 | 
				
			||||||
 	{ ClkClientWin,         MODKEY,         Button1,        movemouse,      {0} },
 | 
					 | 
				
			||||||
 	{ ClkClientWin,         MODKEY,         Button2,        togglefloating, {0} },
 | 
					 | 
				
			||||||
diff --git a/dwm.c b/dwm.c
 | 
					 | 
				
			||||||
index 4465af1..bcf5cb1 100644
 | 
					 | 
				
			||||||
--- a/dwm.c
 | 
					 | 
				
			||||||
+++ b/dwm.c
 | 
					 | 
				
			||||||
@@ -64,8 +64,8 @@ enum { NetSupported, NetWMName, NetWMState, NetWMCheck,
 | 
					 | 
				
			||||||
        NetWMFullscreen, NetActiveWindow, NetWMWindowType,
 | 
					 | 
				
			||||||
        NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */
 | 
					 | 
				
			||||||
 enum { WMProtocols, WMDelete, WMState, WMTakeFocus, WMLast }; /* default atoms */
 | 
					 | 
				
			||||||
-enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle,
 | 
					 | 
				
			||||||
-       ClkClientWin, ClkRootWin, ClkLast }; /* clicks */
 | 
					 | 
				
			||||||
+enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkClientWin,
 | 
					 | 
				
			||||||
+       ClkRootWin, ClkLast }; /* clicks */
 | 
					 | 
				
			||||||
 
 | 
					 | 
				
			||||||
 typedef union {
 | 
					 | 
				
			||||||
 	int i;
 | 
					 | 
				
			||||||
@@ -439,10 +439,8 @@ buttonpress(XEvent *e)
 | 
					 | 
				
			||||||
 			arg.ui = 1 << i;
 | 
					 | 
				
			||||||
 		} else if (ev->x < x + blw)
 | 
					 | 
				
			||||||
 			click = ClkLtSymbol;
 | 
					 | 
				
			||||||
-		else if (ev->x > selmon->ww - TEXTW(stext))
 | 
					 | 
				
			||||||
-			click = ClkStatusText;
 | 
					 | 
				
			||||||
 		else
 | 
					 | 
				
			||||||
-			click = ClkWinTitle;
 | 
					 | 
				
			||||||
+			click = ClkStatusText;
 | 
					 | 
				
			||||||
 	} else if ((c = wintoclient(ev->window))) {
 | 
					 | 
				
			||||||
 		focus(c);
 | 
					 | 
				
			||||||
 		restack(selmon);
 | 
					 | 
				
			||||||
@@ -729,15 +727,8 @@ drawbar(Monitor *m)
 | 
					 | 
				
			||||||
 	x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0);
 | 
					 | 
				
			||||||
 
 | 
					 | 
				
			||||||
 	if ((w = m->ww - sw - x) > bh) {
 | 
					 | 
				
			||||||
-		if (m->sel) {
 | 
					 | 
				
			||||||
-			drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]);
 | 
					 | 
				
			||||||
-			drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0);
 | 
					 | 
				
			||||||
-			if (m->sel->isfloating)
 | 
					 | 
				
			||||||
-				drw_rect(drw, x + boxs, boxs, boxw, boxw, m->sel->isfixed, 0);
 | 
					 | 
				
			||||||
-		} else {
 | 
					 | 
				
			||||||
 			drw_setscheme(drw, scheme[SchemeNorm]);
 | 
					 | 
				
			||||||
 			drw_rect(drw, x, 0, w, bh, 1, 1);
 | 
					 | 
				
			||||||
-		}
 | 
					 | 
				
			||||||
 	}
 | 
					 | 
				
			||||||
 	drw_map(drw, m->barwin, 0, 0, m->ww, bh);
 | 
					 | 
				
			||||||
 }
 | 
					 | 
				
			||||||
@@ -1235,11 +1226,8 @@ propertynotify(XEvent *e)
 | 
					 | 
				
			||||||
 			drawbars();
 | 
					 | 
				
			||||||
 			break;
 | 
					 | 
				
			||||||
 		}
 | 
					 | 
				
			||||||
-		if (ev->atom == XA_WM_NAME || ev->atom == netatom[NetWMName]) {
 | 
					 | 
				
			||||||
+		if (ev->atom == XA_WM_NAME || ev->atom == netatom[NetWMName])
 | 
					 | 
				
			||||||
 			updatetitle(c);
 | 
					 | 
				
			||||||
-			if (c == c->mon->sel)
 | 
					 | 
				
			||||||
-				drawbar(c->mon);
 | 
					 | 
				
			||||||
-		}
 | 
					 | 
				
			||||||
 		if (ev->atom == netatom[NetWMWindowType])
 | 
					 | 
				
			||||||
 			updatewindowtype(c);
 | 
					 | 
				
			||||||
 	}
 | 
					 | 
				
			||||||
-- 
 | 
					 | 
				
			||||||
2.21.0
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
@@ -1,177 +0,0 @@
 | 
				
			|||||||
diff --git a/dwm.c b/dwm.c
 | 
					 | 
				
			||||||
index a5ce993..45f1e27 100644
 | 
					 | 
				
			||||||
--- a/dwm.c
 | 
					 | 
				
			||||||
+++ b/dwm.c
 | 
					 | 
				
			||||||
@@ -112,6 +112,7 @@ typedef struct {
 | 
					 | 
				
			||||||
 	void (*arrange)(Monitor *);
 | 
					 | 
				
			||||||
 } Layout;
 | 
					 | 
				
			||||||
 
 | 
					 | 
				
			||||||
+typedef struct Pertag Pertag;
 | 
					 | 
				
			||||||
 struct Monitor {
 | 
					 | 
				
			||||||
 	char ltsymbol[16];
 | 
					 | 
				
			||||||
 	float mfact;
 | 
					 | 
				
			||||||
@@ -131,6 +132,7 @@ struct Monitor {
 | 
					 | 
				
			||||||
 	Monitor *next;
 | 
					 | 
				
			||||||
 	Window barwin;
 | 
					 | 
				
			||||||
 	const Layout *lt[2];
 | 
					 | 
				
			||||||
+	Pertag *pertag;
 | 
					 | 
				
			||||||
 };
 | 
					 | 
				
			||||||
 
 | 
					 | 
				
			||||||
 typedef struct {
 | 
					 | 
				
			||||||
@@ -272,6 +274,15 @@ static Window root, wmcheckwin;
 | 
					 | 
				
			||||||
 /* configuration, allows nested code to access above variables */
 | 
					 | 
				
			||||||
 #include "config.h"
 | 
					 | 
				
			||||||
 
 | 
					 | 
				
			||||||
+struct Pertag {
 | 
					 | 
				
			||||||
+	unsigned int curtag, prevtag; /* current and previous tag */
 | 
					 | 
				
			||||||
+	int nmasters[LENGTH(tags) + 1]; /* number of windows in master area */
 | 
					 | 
				
			||||||
+	float mfacts[LENGTH(tags) + 1]; /* mfacts per tag */
 | 
					 | 
				
			||||||
+	unsigned int sellts[LENGTH(tags) + 1]; /* selected layouts */
 | 
					 | 
				
			||||||
+	const Layout *ltidxs[LENGTH(tags) + 1][2]; /* matrix of tags and layouts indexes  */
 | 
					 | 
				
			||||||
+	int showbars[LENGTH(tags) + 1]; /* display bar for the current tag */
 | 
					 | 
				
			||||||
+};
 | 
					 | 
				
			||||||
+
 | 
					 | 
				
			||||||
 /* compile-time check if all tags fit into an unsigned int bit array. */
 | 
					 | 
				
			||||||
 struct NumTags { char limitexceeded[LENGTH(tags) > 31 ? -1 : 1]; };
 | 
					 | 
				
			||||||
 
 | 
					 | 
				
			||||||
@@ -632,6 +643,7 @@ Monitor *
 | 
					 | 
				
			||||||
 createmon(void)
 | 
					 | 
				
			||||||
 {
 | 
					 | 
				
			||||||
 	Monitor *m;
 | 
					 | 
				
			||||||
+	unsigned int i;
 | 
					 | 
				
			||||||
 
 | 
					 | 
				
			||||||
 	m = ecalloc(1, sizeof(Monitor));
 | 
					 | 
				
			||||||
 	m->tagset[0] = m->tagset[1] = 1;
 | 
					 | 
				
			||||||
@@ -642,6 +654,20 @@ createmon(void)
 | 
					 | 
				
			||||||
 	m->lt[0] = &layouts[0];
 | 
					 | 
				
			||||||
 	m->lt[1] = &layouts[1 % LENGTH(layouts)];
 | 
					 | 
				
			||||||
 	strncpy(m->ltsymbol, layouts[0].symbol, sizeof m->ltsymbol);
 | 
					 | 
				
			||||||
+	m->pertag = ecalloc(1, sizeof(Pertag));
 | 
					 | 
				
			||||||
+	m->pertag->curtag = m->pertag->prevtag = 1;
 | 
					 | 
				
			||||||
+
 | 
					 | 
				
			||||||
+	for (i = 0; i <= LENGTH(tags); i++) {
 | 
					 | 
				
			||||||
+		m->pertag->nmasters[i] = m->nmaster;
 | 
					 | 
				
			||||||
+		m->pertag->mfacts[i] = m->mfact;
 | 
					 | 
				
			||||||
+
 | 
					 | 
				
			||||||
+		m->pertag->ltidxs[i][0] = m->lt[0];
 | 
					 | 
				
			||||||
+		m->pertag->ltidxs[i][1] = m->lt[1];
 | 
					 | 
				
			||||||
+		m->pertag->sellts[i] = m->sellt;
 | 
					 | 
				
			||||||
+
 | 
					 | 
				
			||||||
+		m->pertag->showbars[i] = m->showbar;
 | 
					 | 
				
			||||||
+	}
 | 
					 | 
				
			||||||
+
 | 
					 | 
				
			||||||
 	return m;
 | 
					 | 
				
			||||||
 }
 | 
					 | 
				
			||||||
 
 | 
					 | 
				
			||||||
@@ -968,7 +994,7 @@ grabkeys(void)
 | 
					 | 
				
			||||||
 void
 | 
					 | 
				
			||||||
 incnmaster(const Arg *arg)
 | 
					 | 
				
			||||||
 {
 | 
					 | 
				
			||||||
-	selmon->nmaster = MAX(selmon->nmaster + arg->i, 0);
 | 
					 | 
				
			||||||
+	selmon->nmaster = selmon->pertag->nmasters[selmon->pertag->curtag] = MAX(selmon->nmaster + arg->i, 0);
 | 
					 | 
				
			||||||
 	arrange(selmon);
 | 
					 | 
				
			||||||
 }
 | 
					 | 
				
			||||||
 
 | 
					 | 
				
			||||||
@@ -1503,9 +1529,9 @@ void
 | 
					 | 
				
			||||||
 setlayout(const Arg *arg)
 | 
					 | 
				
			||||||
 {
 | 
					 | 
				
			||||||
 	if (!arg || !arg->v || arg->v != selmon->lt[selmon->sellt])
 | 
					 | 
				
			||||||
-		selmon->sellt ^= 1;
 | 
					 | 
				
			||||||
+		selmon->sellt = selmon->pertag->sellts[selmon->pertag->curtag] ^= 1;
 | 
					 | 
				
			||||||
 	if (arg && arg->v)
 | 
					 | 
				
			||||||
-		selmon->lt[selmon->sellt] = (Layout *)arg->v;
 | 
					 | 
				
			||||||
+		selmon->lt[selmon->sellt] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt] = (Layout *)arg->v;
 | 
					 | 
				
			||||||
 	strncpy(selmon->ltsymbol, selmon->lt[selmon->sellt]->symbol, sizeof selmon->ltsymbol);
 | 
					 | 
				
			||||||
 	if (selmon->sel)
 | 
					 | 
				
			||||||
 		arrange(selmon);
 | 
					 | 
				
			||||||
@@ -1524,7 +1550,7 @@ setmfact(const Arg *arg)
 | 
					 | 
				
			||||||
 	f = arg->f < 1.0 ? arg->f + selmon->mfact : arg->f - 1.0;
 | 
					 | 
				
			||||||
 	if (f < 0.1 || f > 0.9)
 | 
					 | 
				
			||||||
 		return;
 | 
					 | 
				
			||||||
-	selmon->mfact = f;
 | 
					 | 
				
			||||||
+	selmon->mfact = selmon->pertag->mfacts[selmon->pertag->curtag] = f;
 | 
					 | 
				
			||||||
 	arrange(selmon);
 | 
					 | 
				
			||||||
 }
 | 
					 | 
				
			||||||
 
 | 
					 | 
				
			||||||
@@ -1701,7 +1727,7 @@ tile(Monitor *m)
 | 
					 | 
				
			||||||
 void
 | 
					 | 
				
			||||||
 togglebar(const Arg *arg)
 | 
					 | 
				
			||||||
 {
 | 
					 | 
				
			||||||
-	selmon->showbar = !selmon->showbar;
 | 
					 | 
				
			||||||
+	selmon->showbar = selmon->pertag->showbars[selmon->pertag->curtag] = !selmon->showbar;
 | 
					 | 
				
			||||||
 	updatebarpos(selmon);
 | 
					 | 
				
			||||||
 	XMoveResizeWindow(dpy, selmon->barwin, selmon->wx, selmon->by, selmon->ww, bh);
 | 
					 | 
				
			||||||
 	arrange(selmon);
 | 
					 | 
				
			||||||
@@ -1740,9 +1766,33 @@ void
 | 
					 | 
				
			||||||
 toggleview(const Arg *arg)
 | 
					 | 
				
			||||||
 {
 | 
					 | 
				
			||||||
 	unsigned int newtagset = selmon->tagset[selmon->seltags] ^ (arg->ui & TAGMASK);
 | 
					 | 
				
			||||||
+	int i;
 | 
					 | 
				
			||||||
 
 | 
					 | 
				
			||||||
 	if (newtagset) {
 | 
					 | 
				
			||||||
 		selmon->tagset[selmon->seltags] = newtagset;
 | 
					 | 
				
			||||||
+
 | 
					 | 
				
			||||||
+		if (newtagset == ~0) {
 | 
					 | 
				
			||||||
+			selmon->pertag->prevtag = selmon->pertag->curtag;
 | 
					 | 
				
			||||||
+			selmon->pertag->curtag = 0;
 | 
					 | 
				
			||||||
+		}
 | 
					 | 
				
			||||||
+
 | 
					 | 
				
			||||||
+		/* test if the user did not select the same tag */
 | 
					 | 
				
			||||||
+		if (!(newtagset & 1 << (selmon->pertag->curtag - 1))) {
 | 
					 | 
				
			||||||
+			selmon->pertag->prevtag = selmon->pertag->curtag;
 | 
					 | 
				
			||||||
+			for (i = 0; !(newtagset & 1 << i); i++) ;
 | 
					 | 
				
			||||||
+			selmon->pertag->curtag = i + 1;
 | 
					 | 
				
			||||||
+		}
 | 
					 | 
				
			||||||
+
 | 
					 | 
				
			||||||
+		/* apply settings for this view */
 | 
					 | 
				
			||||||
+		selmon->nmaster = selmon->pertag->nmasters[selmon->pertag->curtag];
 | 
					 | 
				
			||||||
+		selmon->mfact = selmon->pertag->mfacts[selmon->pertag->curtag];
 | 
					 | 
				
			||||||
+		selmon->sellt = selmon->pertag->sellts[selmon->pertag->curtag];
 | 
					 | 
				
			||||||
+		selmon->lt[selmon->sellt] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt];
 | 
					 | 
				
			||||||
+		selmon->lt[selmon->sellt^1] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt^1];
 | 
					 | 
				
			||||||
+
 | 
					 | 
				
			||||||
+		if (selmon->showbar != selmon->pertag->showbars[selmon->pertag->curtag])
 | 
					 | 
				
			||||||
+			togglebar(NULL);
 | 
					 | 
				
			||||||
+
 | 
					 | 
				
			||||||
 		focus(NULL);
 | 
					 | 
				
			||||||
 		arrange(selmon);
 | 
					 | 
				
			||||||
 	}
 | 
					 | 
				
			||||||
@@ -2036,11 +2086,37 @@ updatewmhints(Client *c)
 | 
					 | 
				
			||||||
 void
 | 
					 | 
				
			||||||
 view(const Arg *arg)
 | 
					 | 
				
			||||||
 {
 | 
					 | 
				
			||||||
+	int i;
 | 
					 | 
				
			||||||
+	unsigned int tmptag;
 | 
					 | 
				
			||||||
+
 | 
					 | 
				
			||||||
 	if ((arg->ui & TAGMASK) == selmon->tagset[selmon->seltags])
 | 
					 | 
				
			||||||
 		return;
 | 
					 | 
				
			||||||
 	selmon->seltags ^= 1; /* toggle sel tagset */
 | 
					 | 
				
			||||||
-	if (arg->ui & TAGMASK)
 | 
					 | 
				
			||||||
+	if (arg->ui & TAGMASK) {
 | 
					 | 
				
			||||||
 		selmon->tagset[selmon->seltags] = arg->ui & TAGMASK;
 | 
					 | 
				
			||||||
+		selmon->pertag->prevtag = selmon->pertag->curtag;
 | 
					 | 
				
			||||||
+
 | 
					 | 
				
			||||||
+		if (arg->ui == ~0)
 | 
					 | 
				
			||||||
+			selmon->pertag->curtag = 0;
 | 
					 | 
				
			||||||
+		else {
 | 
					 | 
				
			||||||
+			for (i = 0; !(arg->ui & 1 << i); i++) ;
 | 
					 | 
				
			||||||
+			selmon->pertag->curtag = i + 1;
 | 
					 | 
				
			||||||
+		}
 | 
					 | 
				
			||||||
+	} else {
 | 
					 | 
				
			||||||
+		tmptag = selmon->pertag->prevtag;
 | 
					 | 
				
			||||||
+		selmon->pertag->prevtag = selmon->pertag->curtag;
 | 
					 | 
				
			||||||
+		selmon->pertag->curtag = tmptag;
 | 
					 | 
				
			||||||
+	}
 | 
					 | 
				
			||||||
+
 | 
					 | 
				
			||||||
+	selmon->nmaster = selmon->pertag->nmasters[selmon->pertag->curtag];
 | 
					 | 
				
			||||||
+	selmon->mfact = selmon->pertag->mfacts[selmon->pertag->curtag];
 | 
					 | 
				
			||||||
+	selmon->sellt = selmon->pertag->sellts[selmon->pertag->curtag];
 | 
					 | 
				
			||||||
+	selmon->lt[selmon->sellt] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt];
 | 
					 | 
				
			||||||
+	selmon->lt[selmon->sellt^1] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt^1];
 | 
					 | 
				
			||||||
+
 | 
					 | 
				
			||||||
+	if (selmon->showbar != selmon->pertag->showbars[selmon->pertag->curtag])
 | 
					 | 
				
			||||||
+		togglebar(NULL);
 | 
					 | 
				
			||||||
+
 | 
					 | 
				
			||||||
 	focus(NULL);
 | 
					 | 
				
			||||||
 	arrange(selmon);
 | 
					 | 
				
			||||||
 }
 | 
					 | 
				
			||||||
@@ -1,166 +0,0 @@
 | 
				
			|||||||
diff --git a/dwm.c b/dwm.c
 | 
					 | 
				
			||||||
index d27cb67..464c9d6 100644
 | 
					 | 
				
			||||||
--- a/dwm.c
 | 
					 | 
				
			||||||
+++ b/dwm.c
 | 
					 | 
				
			||||||
@@ -163,6 +163,7 @@ static void detach(Client *c);
 | 
					 | 
				
			||||||
 static Monitor *dirtomon(int dir);
 | 
					 | 
				
			||||||
 static void drawbar(Monitor *m);
 | 
					 | 
				
			||||||
 static void drawbars(void);
 | 
					 | 
				
			||||||
+static int drawstatusbar(Monitor *m, int bh, char* text);
 | 
					 | 
				
			||||||
 static void enternotify(XEvent *e);
 | 
					 | 
				
			||||||
 static void expose(XEvent *e);
 | 
					 | 
				
			||||||
 static void focus(Client *c);
 | 
					 | 
				
			||||||
@@ -237,7 +238,7 @@ static void zoom(const Arg *arg);
 | 
					 | 
				
			||||||
 
 | 
					 | 
				
			||||||
 /* variables */
 | 
					 | 
				
			||||||
 static const char broken[] = "broken";
 | 
					 | 
				
			||||||
-static char stext[256];
 | 
					 | 
				
			||||||
+static char stext[1024];
 | 
					 | 
				
			||||||
 static int screen;
 | 
					 | 
				
			||||||
 static int sw, sh;           /* X display screen geometry width, height */
 | 
					 | 
				
			||||||
 static int bh, blw = 0;      /* bar geometry */
 | 
					 | 
				
			||||||
@@ -483,7 +484,7 @@ cleanup(void)
 | 
					 | 
				
			||||||
 		cleanupmon(mons);
 | 
					 | 
				
			||||||
 	for (i = 0; i < CurLast; i++)
 | 
					 | 
				
			||||||
 		drw_cur_free(drw, cursor[i]);
 | 
					 | 
				
			||||||
-	for (i = 0; i < LENGTH(colors); i++)
 | 
					 | 
				
			||||||
+	for (i = 0; i < LENGTH(colors) + 1; i++)
 | 
					 | 
				
			||||||
 		free(scheme[i]);
 | 
					 | 
				
			||||||
 	XDestroyWindow(dpy, wmcheckwin);
 | 
					 | 
				
			||||||
 	drw_free(drw);
 | 
					 | 
				
			||||||
@@ -690,6 +691,114 @@ dirtomon(int dir)
 | 
					 | 
				
			||||||
 	return m;
 | 
					 | 
				
			||||||
 }
 | 
					 | 
				
			||||||
 
 | 
					 | 
				
			||||||
+int
 | 
					 | 
				
			||||||
+drawstatusbar(Monitor *m, int bh, char* stext) {
 | 
					 | 
				
			||||||
+	int ret, i, w, x, len;
 | 
					 | 
				
			||||||
+	short isCode = 0;
 | 
					 | 
				
			||||||
+	char *text;
 | 
					 | 
				
			||||||
+	char *p;
 | 
					 | 
				
			||||||
+
 | 
					 | 
				
			||||||
+	len = strlen(stext) + 1 ;
 | 
					 | 
				
			||||||
+	if (!(text = (char*) malloc(sizeof(char)*len)))
 | 
					 | 
				
			||||||
+		die("malloc");
 | 
					 | 
				
			||||||
+	p = text;
 | 
					 | 
				
			||||||
+	memcpy(text, stext, len);
 | 
					 | 
				
			||||||
+
 | 
					 | 
				
			||||||
+	/* compute width of the status text */
 | 
					 | 
				
			||||||
+	w = 0;
 | 
					 | 
				
			||||||
+	i = -1;
 | 
					 | 
				
			||||||
+	while (text[++i]) {
 | 
					 | 
				
			||||||
+		if (text[i] == '^') {
 | 
					 | 
				
			||||||
+			if (!isCode) {
 | 
					 | 
				
			||||||
+				isCode = 1;
 | 
					 | 
				
			||||||
+				text[i] = '\0';
 | 
					 | 
				
			||||||
+				w += TEXTW(text) - lrpad;
 | 
					 | 
				
			||||||
+				text[i] = '^';
 | 
					 | 
				
			||||||
+				if (text[++i] == 'f')
 | 
					 | 
				
			||||||
+					w += atoi(text + ++i);
 | 
					 | 
				
			||||||
+			} else {
 | 
					 | 
				
			||||||
+				isCode = 0;
 | 
					 | 
				
			||||||
+				text = text + i + 1;
 | 
					 | 
				
			||||||
+				i = -1;
 | 
					 | 
				
			||||||
+			}
 | 
					 | 
				
			||||||
+		}
 | 
					 | 
				
			||||||
+	}
 | 
					 | 
				
			||||||
+	if (!isCode)
 | 
					 | 
				
			||||||
+		w += TEXTW(text) - lrpad;
 | 
					 | 
				
			||||||
+	else
 | 
					 | 
				
			||||||
+		isCode = 0;
 | 
					 | 
				
			||||||
+	text = p;
 | 
					 | 
				
			||||||
+
 | 
					 | 
				
			||||||
+	w += 2; /* 1px padding on both sides */
 | 
					 | 
				
			||||||
+	ret = x = m->ww - w;
 | 
					 | 
				
			||||||
+
 | 
					 | 
				
			||||||
+	drw_setscheme(drw, scheme[LENGTH(colors)]);
 | 
					 | 
				
			||||||
+	drw->scheme[ColFg] = scheme[SchemeNorm][ColFg];
 | 
					 | 
				
			||||||
+	drw->scheme[ColBg] = scheme[SchemeNorm][ColBg];
 | 
					 | 
				
			||||||
+	drw_rect(drw, x, 0, w, bh, 1, 1);
 | 
					 | 
				
			||||||
+	x++;
 | 
					 | 
				
			||||||
+
 | 
					 | 
				
			||||||
+	/* process status text */
 | 
					 | 
				
			||||||
+	i = -1;
 | 
					 | 
				
			||||||
+	while (text[++i]) {
 | 
					 | 
				
			||||||
+		if (text[i] == '^' && !isCode) {
 | 
					 | 
				
			||||||
+			isCode = 1;
 | 
					 | 
				
			||||||
+
 | 
					 | 
				
			||||||
+			text[i] = '\0';
 | 
					 | 
				
			||||||
+			w = TEXTW(text) - lrpad;
 | 
					 | 
				
			||||||
+			drw_text(drw, x, 0, w, bh, 0, text, 0);
 | 
					 | 
				
			||||||
+
 | 
					 | 
				
			||||||
+			x += w;
 | 
					 | 
				
			||||||
+
 | 
					 | 
				
			||||||
+			/* process code */
 | 
					 | 
				
			||||||
+			while (text[++i] != '^') {
 | 
					 | 
				
			||||||
+				if (text[i] == 'c') {
 | 
					 | 
				
			||||||
+					char buf[8];
 | 
					 | 
				
			||||||
+					memcpy(buf, (char*)text+i+1, 7);
 | 
					 | 
				
			||||||
+					buf[7] = '\0';
 | 
					 | 
				
			||||||
+					drw_clr_create(drw, &drw->scheme[ColFg], buf);
 | 
					 | 
				
			||||||
+					i += 7;
 | 
					 | 
				
			||||||
+				} else if (text[i] == 'b') {
 | 
					 | 
				
			||||||
+					char buf[8];
 | 
					 | 
				
			||||||
+					memcpy(buf, (char*)text+i+1, 7);
 | 
					 | 
				
			||||||
+					buf[7] = '\0';
 | 
					 | 
				
			||||||
+					drw_clr_create(drw, &drw->scheme[ColBg], buf);
 | 
					 | 
				
			||||||
+					i += 7;
 | 
					 | 
				
			||||||
+				} else if (text[i] == 'd') {
 | 
					 | 
				
			||||||
+					drw->scheme[ColFg] = scheme[SchemeNorm][ColFg];
 | 
					 | 
				
			||||||
+					drw->scheme[ColBg] = scheme[SchemeNorm][ColBg];
 | 
					 | 
				
			||||||
+				} else if (text[i] == 'r') {
 | 
					 | 
				
			||||||
+					int rx = atoi(text + ++i);
 | 
					 | 
				
			||||||
+					while (text[++i] != ',');
 | 
					 | 
				
			||||||
+					int ry = atoi(text + ++i);
 | 
					 | 
				
			||||||
+					while (text[++i] != ',');
 | 
					 | 
				
			||||||
+					int rw = atoi(text + ++i);
 | 
					 | 
				
			||||||
+					while (text[++i] != ',');
 | 
					 | 
				
			||||||
+					int rh = atoi(text + ++i);
 | 
					 | 
				
			||||||
+
 | 
					 | 
				
			||||||
+					drw_rect(drw, rx + x, ry, rw, rh, 1, 0);
 | 
					 | 
				
			||||||
+				} else if (text[i] == 'f') {
 | 
					 | 
				
			||||||
+					x += atoi(text + ++i);
 | 
					 | 
				
			||||||
+				}
 | 
					 | 
				
			||||||
+			}
 | 
					 | 
				
			||||||
+
 | 
					 | 
				
			||||||
+			text = text + i + 1;
 | 
					 | 
				
			||||||
+			i=-1;
 | 
					 | 
				
			||||||
+			isCode = 0;
 | 
					 | 
				
			||||||
+		}
 | 
					 | 
				
			||||||
+	}
 | 
					 | 
				
			||||||
+
 | 
					 | 
				
			||||||
+	if (!isCode) {
 | 
					 | 
				
			||||||
+		w = TEXTW(text) - lrpad;
 | 
					 | 
				
			||||||
+		drw_text(drw, x, 0, w, bh, 0, text, 0);
 | 
					 | 
				
			||||||
+	}
 | 
					 | 
				
			||||||
+
 | 
					 | 
				
			||||||
+	drw_setscheme(drw, scheme[SchemeNorm]);
 | 
					 | 
				
			||||||
+	free(p);
 | 
					 | 
				
			||||||
+
 | 
					 | 
				
			||||||
+	return ret;
 | 
					 | 
				
			||||||
+}
 | 
					 | 
				
			||||||
+
 | 
					 | 
				
			||||||
 void
 | 
					 | 
				
			||||||
 drawbar(Monitor *m)
 | 
					 | 
				
			||||||
 {
 | 
					 | 
				
			||||||
@@ -701,9 +802,7 @@ drawbar(Monitor *m)
 | 
					 | 
				
			||||||
 
 | 
					 | 
				
			||||||
 	/* draw status first so it can be overdrawn by tags later */
 | 
					 | 
				
			||||||
 	if (m == selmon) { /* status is only drawn on selected monitor */
 | 
					 | 
				
			||||||
-		drw_setscheme(drw, scheme[SchemeNorm]);
 | 
					 | 
				
			||||||
-		sw = TEXTW(stext) - lrpad + 2; /* 2px right padding */
 | 
					 | 
				
			||||||
-		drw_text(drw, m->ww - sw, 0, sw, bh, 0, stext, 0);
 | 
					 | 
				
			||||||
+		sw = m->ww - drawstatusbar(m, bh, stext);
 | 
					 | 
				
			||||||
 	}
 | 
					 | 
				
			||||||
 
 | 
					 | 
				
			||||||
 	for (c = m->clients; c; c = c->next) {
 | 
					 | 
				
			||||||
@@ -1572,7 +1671,8 @@ setup(void)
 | 
					 | 
				
			||||||
 	cursor[CurResize] = drw_cur_create(drw, XC_sizing);
 | 
					 | 
				
			||||||
 	cursor[CurMove] = drw_cur_create(drw, XC_fleur);
 | 
					 | 
				
			||||||
 	/* init appearance */
 | 
					 | 
				
			||||||
-	scheme = ecalloc(LENGTH(colors), sizeof(Clr *));
 | 
					 | 
				
			||||||
+	scheme = ecalloc(LENGTH(colors) + 1, sizeof(Clr *));
 | 
					 | 
				
			||||||
+	scheme[LENGTH(colors)] = drw_scm_create(drw, colors[0], 3);
 | 
					 | 
				
			||||||
 	for (i = 0; i < LENGTH(colors); i++)
 | 
					 | 
				
			||||||
 		scheme[i] = drw_scm_create(drw, colors[i], 3);
 | 
					 | 
				
			||||||
 	/* init bars */
 | 
					 | 
				
			||||||
@@ -1,25 +0,0 @@
 | 
				
			|||||||
diff -up a/dwm.c b/dwm.c
 | 
					 | 
				
			||||||
--- a/dwm.c	2020-07-09 16:49:10.023585649 +0200
 | 
					 | 
				
			||||||
+++ b/dwm.c	2020-07-09 16:49:43.497542191 +0200
 | 
					 | 
				
			||||||
@@ -702,7 +702,7 @@ drawbar(Monitor *m)
 | 
					 | 
				
			||||||
 	Client *c;
 | 
					 | 
				
			||||||
 
 | 
					 | 
				
			||||||
 	/* draw status first so it can be overdrawn by tags later */
 | 
					 | 
				
			||||||
-	if (m == selmon) { /* status is only drawn on selected monitor */
 | 
					 | 
				
			||||||
+	if (m == selmon || 1) { /* status is only drawn on selected monitor */
 | 
					 | 
				
			||||||
 		drw_setscheme(drw, scheme[SchemeNorm]);
 | 
					 | 
				
			||||||
 		sw = TEXTW(stext) - lrpad + 2; /* 2px right padding */
 | 
					 | 
				
			||||||
 		drw_text(drw, m->ww - sw, 0, sw, bh, 0, stext, 0);
 | 
					 | 
				
			||||||
@@ -1987,9 +1987,11 @@ updatesizehints(Client *c)
 | 
					 | 
				
			||||||
 void
 | 
					 | 
				
			||||||
 updatestatus(void)
 | 
					 | 
				
			||||||
 {
 | 
					 | 
				
			||||||
+	Monitor* m;
 | 
					 | 
				
			||||||
 	if (!gettextprop(root, XA_WM_NAME, stext, sizeof(stext)))
 | 
					 | 
				
			||||||
 		strcpy(stext, "dwm-"VERSION);
 | 
					 | 
				
			||||||
-	drawbar(selmon);
 | 
					 | 
				
			||||||
+	for(m = mons; m; m = m->next)
 | 
					 | 
				
			||||||
+		drawbar(m);
 | 
					 | 
				
			||||||
 }
 | 
					 | 
				
			||||||
 
 | 
					 | 
				
			||||||
 void
 | 
					 | 
				
			||||||
@@ -1,157 +0,0 @@
 | 
				
			|||||||
diff --git a/config.def.h b/config.def.h
 | 
					 | 
				
			||||||
index 1c0b587..b67825e 100644
 | 
					 | 
				
			||||||
--- a/config.def.h
 | 
					 | 
				
			||||||
+++ b/config.def.h
 | 
					 | 
				
			||||||
@@ -103,7 +103,9 @@ static Button buttons[] = {
 | 
					 | 
				
			||||||
 	{ ClkLtSymbol,          0,              Button1,        setlayout,      {0} },
 | 
					 | 
				
			||||||
 	{ ClkLtSymbol,          0,              Button3,        setlayout,      {.v = &layouts[2]} },
 | 
					 | 
				
			||||||
 	{ ClkWinTitle,          0,              Button2,        zoom,           {0} },
 | 
					 | 
				
			||||||
-	{ ClkStatusText,        0,              Button2,        spawn,          {.v = termcmd } },
 | 
					 | 
				
			||||||
+	{ ClkStatusText,        0,              Button1,        sigdwmblocks,   {.i = 1} },
 | 
					 | 
				
			||||||
+	{ ClkStatusText,        0,              Button2,        sigdwmblocks,   {.i = 2} },
 | 
					 | 
				
			||||||
+	{ ClkStatusText,        0,              Button3,        sigdwmblocks,   {.i = 3} },
 | 
					 | 
				
			||||||
 	{ ClkClientWin,         MODKEY,         Button1,        movemouse,      {0} },
 | 
					 | 
				
			||||||
 	{ ClkClientWin,         MODKEY,         Button2,        togglefloating, {0} },
 | 
					 | 
				
			||||||
 	{ ClkClientWin,         MODKEY,         Button3,        resizemouse,    {0} },
 | 
					 | 
				
			||||||
diff --git a/dwm.c b/dwm.c
 | 
					 | 
				
			||||||
index 4465af1..c600131 100644
 | 
					 | 
				
			||||||
--- a/dwm.c
 | 
					 | 
				
			||||||
+++ b/dwm.c
 | 
					 | 
				
			||||||
@@ -156,6 +156,7 @@ static void clientmessage(XEvent *e);
 | 
					 | 
				
			||||||
 static void configure(Client *c);
 | 
					 | 
				
			||||||
 static void configurenotify(XEvent *e);
 | 
					 | 
				
			||||||
 static void configurerequest(XEvent *e);
 | 
					 | 
				
			||||||
+static void copyvalidchars(char *text, char *rawtext);
 | 
					 | 
				
			||||||
 static Monitor *createmon(void);
 | 
					 | 
				
			||||||
 static void destroynotify(XEvent *e);
 | 
					 | 
				
			||||||
 static void detach(Client *c);
 | 
					 | 
				
			||||||
@@ -169,6 +170,7 @@ static void focus(Client *c);
 | 
					 | 
				
			||||||
 static void focusin(XEvent *e);
 | 
					 | 
				
			||||||
 static void focusmon(const Arg *arg);
 | 
					 | 
				
			||||||
 static void focusstack(const Arg *arg);
 | 
					 | 
				
			||||||
+static int getdwmblockspid();
 | 
					 | 
				
			||||||
 static int getrootptr(int *x, int *y);
 | 
					 | 
				
			||||||
 static long getstate(Window w);
 | 
					 | 
				
			||||||
 static int gettextprop(Window w, Atom atom, char *text, unsigned int size);
 | 
					 | 
				
			||||||
@@ -205,6 +207,7 @@ static void setup(void);
 | 
					 | 
				
			||||||
 static void seturgent(Client *c, int urg);
 | 
					 | 
				
			||||||
 static void showhide(Client *c);
 | 
					 | 
				
			||||||
 static void sigchld(int unused);
 | 
					 | 
				
			||||||
+static void sigdwmblocks(const Arg *arg);
 | 
					 | 
				
			||||||
 static void spawn(const Arg *arg);
 | 
					 | 
				
			||||||
 static void tag(const Arg *arg);
 | 
					 | 
				
			||||||
 static void tagmon(const Arg *arg);
 | 
					 | 
				
			||||||
@@ -237,6 +240,9 @@ static void zoom(const Arg *arg);
 | 
					 | 
				
			||||||
 /* variables */
 | 
					 | 
				
			||||||
 static const char broken[] = "broken";
 | 
					 | 
				
			||||||
 static char stext[256];
 | 
					 | 
				
			||||||
+static char rawstext[256];
 | 
					 | 
				
			||||||
+static int dwmblockssig;
 | 
					 | 
				
			||||||
+pid_t dwmblockspid = 0;
 | 
					 | 
				
			||||||
 static int screen;
 | 
					 | 
				
			||||||
 static int sw, sh;           /* X display screen geometry width, height */
 | 
					 | 
				
			||||||
 static int bh, blw = 0;      /* bar geometry */
 | 
					 | 
				
			||||||
@@ -439,9 +445,26 @@ buttonpress(XEvent *e)
 | 
					 | 
				
			||||||
 			arg.ui = 1 << i;
 | 
					 | 
				
			||||||
 		} else if (ev->x < x + blw)
 | 
					 | 
				
			||||||
 			click = ClkLtSymbol;
 | 
					 | 
				
			||||||
-		else if (ev->x > selmon->ww - TEXTW(stext))
 | 
					 | 
				
			||||||
+		else if (ev->x > (x = selmon->ww - TEXTW(stext) + lrpad)) {
 | 
					 | 
				
			||||||
 			click = ClkStatusText;
 | 
					 | 
				
			||||||
-		else
 | 
					 | 
				
			||||||
+
 | 
					 | 
				
			||||||
+			char *text = rawstext;
 | 
					 | 
				
			||||||
+			int i = -1;
 | 
					 | 
				
			||||||
+			char ch;
 | 
					 | 
				
			||||||
+			dwmblockssig = 0;
 | 
					 | 
				
			||||||
+			while (text[++i]) {
 | 
					 | 
				
			||||||
+				if ((unsigned char)text[i] < ' ') {
 | 
					 | 
				
			||||||
+					ch = text[i];
 | 
					 | 
				
			||||||
+					text[i] = '\0';
 | 
					 | 
				
			||||||
+					x += TEXTW(text) - lrpad;
 | 
					 | 
				
			||||||
+					text[i] = ch;
 | 
					 | 
				
			||||||
+					text += i+1;
 | 
					 | 
				
			||||||
+					i = -1;
 | 
					 | 
				
			||||||
+					if (x >= ev->x) break;
 | 
					 | 
				
			||||||
+					dwmblockssig = ch;
 | 
					 | 
				
			||||||
+				}
 | 
					 | 
				
			||||||
+			}
 | 
					 | 
				
			||||||
+		} else
 | 
					 | 
				
			||||||
 			click = ClkWinTitle;
 | 
					 | 
				
			||||||
 	} else if ((c = wintoclient(ev->window))) {
 | 
					 | 
				
			||||||
 		focus(c);
 | 
					 | 
				
			||||||
@@ -627,6 +650,19 @@ configurerequest(XEvent *e)
 | 
					 | 
				
			||||||
 	XSync(dpy, False);
 | 
					 | 
				
			||||||
 }
 | 
					 | 
				
			||||||
 
 | 
					 | 
				
			||||||
+void
 | 
					 | 
				
			||||||
+copyvalidchars(char *text, char *rawtext)
 | 
					 | 
				
			||||||
+{
 | 
					 | 
				
			||||||
+	int i = -1, j = 0;
 | 
					 | 
				
			||||||
+
 | 
					 | 
				
			||||||
+	while(rawtext[++i]) {
 | 
					 | 
				
			||||||
+		if ((unsigned char)rawtext[i] >= ' ') {
 | 
					 | 
				
			||||||
+			text[j++] = rawtext[i];
 | 
					 | 
				
			||||||
+		}
 | 
					 | 
				
			||||||
+	}
 | 
					 | 
				
			||||||
+	text[j] = '\0';
 | 
					 | 
				
			||||||
+}
 | 
					 | 
				
			||||||
+
 | 
					 | 
				
			||||||
 Monitor *
 | 
					 | 
				
			||||||
 createmon(void)
 | 
					 | 
				
			||||||
 {
 | 
					 | 
				
			||||||
@@ -871,6 +907,18 @@ getatomprop(Client *c, Atom prop)
 | 
					 | 
				
			||||||
 	return atom;
 | 
					 | 
				
			||||||
 }
 | 
					 | 
				
			||||||
 
 | 
					 | 
				
			||||||
+int
 | 
					 | 
				
			||||||
+getdwmblockspid()
 | 
					 | 
				
			||||||
+{
 | 
					 | 
				
			||||||
+	char buf[16];
 | 
					 | 
				
			||||||
+	FILE *fp = popen("pidof -s dwmblocks", "r");
 | 
					 | 
				
			||||||
+	fgets(buf, sizeof(buf), fp);
 | 
					 | 
				
			||||||
+	pid_t pid = strtoul(buf, NULL, 10);
 | 
					 | 
				
			||||||
+	pclose(fp);
 | 
					 | 
				
			||||||
+	dwmblockspid = pid;
 | 
					 | 
				
			||||||
+	return pid != 0 ? 0 : -1;
 | 
					 | 
				
			||||||
+}
 | 
					 | 
				
			||||||
+
 | 
					 | 
				
			||||||
 int
 | 
					 | 
				
			||||||
 getrootptr(int *x, int *y)
 | 
					 | 
				
			||||||
 {
 | 
					 | 
				
			||||||
@@ -1636,6 +1684,23 @@ sigchld(int unused)
 | 
					 | 
				
			||||||
 	while (0 < waitpid(-1, NULL, WNOHANG));
 | 
					 | 
				
			||||||
 }
 | 
					 | 
				
			||||||
 
 | 
					 | 
				
			||||||
+void
 | 
					 | 
				
			||||||
+sigdwmblocks(const Arg *arg)
 | 
					 | 
				
			||||||
+{
 | 
					 | 
				
			||||||
+	union sigval sv;
 | 
					 | 
				
			||||||
+	sv.sival_int = (dwmblockssig << 8) | arg->i;
 | 
					 | 
				
			||||||
+	if (!dwmblockspid)
 | 
					 | 
				
			||||||
+		if (getdwmblockspid() == -1)
 | 
					 | 
				
			||||||
+			return;
 | 
					 | 
				
			||||||
+
 | 
					 | 
				
			||||||
+	if (sigqueue(dwmblockspid, SIGUSR1, sv) == -1) {
 | 
					 | 
				
			||||||
+		if (errno == ESRCH) {
 | 
					 | 
				
			||||||
+			if (!getdwmblockspid())
 | 
					 | 
				
			||||||
+				sigqueue(dwmblockspid, SIGUSR1, sv);
 | 
					 | 
				
			||||||
+		}
 | 
					 | 
				
			||||||
+	}
 | 
					 | 
				
			||||||
+}
 | 
					 | 
				
			||||||
+
 | 
					 | 
				
			||||||
 void
 | 
					 | 
				
			||||||
 spawn(const Arg *arg)
 | 
					 | 
				
			||||||
 {
 | 
					 | 
				
			||||||
@@ -1987,8 +2052,10 @@ updatesizehints(Client *c)
 | 
					 | 
				
			||||||
 void
 | 
					 | 
				
			||||||
 updatestatus(void)
 | 
					 | 
				
			||||||
 {
 | 
					 | 
				
			||||||
-	if (!gettextprop(root, XA_WM_NAME, stext, sizeof(stext)))
 | 
					 | 
				
			||||||
+	if (!gettextprop(root, XA_WM_NAME, rawstext, sizeof(rawstext)))
 | 
					 | 
				
			||||||
 		strcpy(stext, "dwm-"VERSION);
 | 
					 | 
				
			||||||
+	else
 | 
					 | 
				
			||||||
+		copyvalidchars(stext, rawstext);
 | 
					 | 
				
			||||||
 	drawbar(selmon);
 | 
					 | 
				
			||||||
 }
 | 
					 | 
				
			||||||
 
 | 
					 | 
				
			||||||
@@ -1,44 +0,0 @@
 | 
				
			|||||||
From 0aea8051b1ae85c568dc69d4cf9865de9ad6acce Mon Sep 17 00:00:00 2001
 | 
					 | 
				
			||||||
From: Michal Orman <michal.orman@gmail.com>
 | 
					 | 
				
			||||||
Date: Wed, 22 Mar 2023 16:02:45 +0100
 | 
					 | 
				
			||||||
Subject: [PATCH] Make XK_0 a regular tag.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Change the default behavior of XK_0 from selecting all tags to be
 | 
					 | 
				
			||||||
a regular 10th tag.
 | 
					 | 
				
			||||||
---
 | 
					 | 
				
			||||||
 config.def.h | 5 ++---
 | 
					 | 
				
			||||||
 1 file changed, 2 insertions(+), 3 deletions(-)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
diff --git a/config.def.h b/config.def.h
 | 
					 | 
				
			||||||
index 9efa774..15d02d7 100644
 | 
					 | 
				
			||||||
--- a/config.def.h
 | 
					 | 
				
			||||||
+++ b/config.def.h
 | 
					 | 
				
			||||||
@@ -19,7 +19,7 @@ static const char *colors[][3]      = {
 | 
					 | 
				
			||||||
 };
 | 
					 | 
				
			||||||
 
 | 
					 | 
				
			||||||
 /* tagging */
 | 
					 | 
				
			||||||
-static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
 | 
					 | 
				
			||||||
+static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9", "0" };
 | 
					 | 
				
			||||||
 
 | 
					 | 
				
			||||||
 static const Rule rules[] = {
 | 
					 | 
				
			||||||
 	/* xprop(1):
 | 
					 | 
				
			||||||
@@ -79,8 +79,6 @@ static const Key keys[] = {
 | 
					 | 
				
			||||||
 	{ MODKEY,                       XK_m,      setlayout,      {.v = &layouts[2]} },
 | 
					 | 
				
			||||||
 	{ MODKEY,                       XK_space,  setlayout,      {0} },
 | 
					 | 
				
			||||||
 	{ MODKEY|ShiftMask,             XK_space,  togglefloating, {0} },
 | 
					 | 
				
			||||||
-	{ MODKEY,                       XK_0,      view,           {.ui = ~0 } },
 | 
					 | 
				
			||||||
-	{ MODKEY|ShiftMask,             XK_0,      tag,            {.ui = ~0 } },
 | 
					 | 
				
			||||||
 	{ MODKEY,                       XK_comma,  focusmon,       {.i = -1 } },
 | 
					 | 
				
			||||||
 	{ MODKEY,                       XK_period, focusmon,       {.i = +1 } },
 | 
					 | 
				
			||||||
 	{ MODKEY|ShiftMask,             XK_comma,  tagmon,         {.i = -1 } },
 | 
					 | 
				
			||||||
@@ -94,6 +92,7 @@ static const Key keys[] = {
 | 
					 | 
				
			||||||
 	TAGKEYS(                        XK_7,                      6)
 | 
					 | 
				
			||||||
 	TAGKEYS(                        XK_8,                      7)
 | 
					 | 
				
			||||||
 	TAGKEYS(                        XK_9,                      8)
 | 
					 | 
				
			||||||
+	TAGKEYS(                        XK_0,                      9)
 | 
					 | 
				
			||||||
 	{ MODKEY|ShiftMask,             XK_q,      quit,           {0} },
 | 
					 | 
				
			||||||
 };
 | 
					 | 
				
			||||||
 
 | 
					 | 
				
			||||||
-- 
 | 
					 | 
				
			||||||
2.40.0
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
							
								
								
									
										6
									
								
								dwm.1
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								dwm.1
									
									
									
									
									
								
							@@ -92,12 +92,6 @@ Sets monocle layout.
 | 
				
			|||||||
.B Mod1\-space
 | 
					.B Mod1\-space
 | 
				
			||||||
Toggles between current and previous layout.
 | 
					Toggles between current and previous layout.
 | 
				
			||||||
.TP
 | 
					.TP
 | 
				
			||||||
.B Mod1\-Control\-,
 | 
					 | 
				
			||||||
Cycles backwards in layout list.
 | 
					 | 
				
			||||||
.TP
 | 
					 | 
				
			||||||
.B Mod1\-Control\-.
 | 
					 | 
				
			||||||
Cycles forwards in layout list.
 | 
					 | 
				
			||||||
.TP
 | 
					 | 
				
			||||||
.B Mod1\-j
 | 
					.B Mod1\-j
 | 
				
			||||||
Focus next window.
 | 
					Focus next window.
 | 
				
			||||||
.TP
 | 
					.TP
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										520
									
								
								dwm.c
									
									
									
									
									
								
							
							
						
						
									
										520
									
								
								dwm.c
									
									
									
									
									
								
							@@ -72,7 +72,6 @@
 | 
				
			|||||||
#define VERSION_MAJOR               0
 | 
					#define VERSION_MAJOR               0
 | 
				
			||||||
#define VERSION_MINOR               0
 | 
					#define VERSION_MINOR               0
 | 
				
			||||||
#define XEMBED_EMBEDDED_VERSION (VERSION_MAJOR << 16) | VERSION_MINOR
 | 
					#define XEMBED_EMBEDDED_VERSION (VERSION_MAJOR << 16) | VERSION_MINOR
 | 
				
			||||||
#define OPAQUE                  0xffU
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* enums */
 | 
					/* enums */
 | 
				
			||||||
enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
 | 
					enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
 | 
				
			||||||
@@ -83,8 +82,8 @@ enum { NetSupported, NetWMName, NetWMState, NetWMCheck,
 | 
				
			|||||||
       NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */
 | 
					       NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */
 | 
				
			||||||
enum { Manager, Xembed, XembedInfo, XLast }; /* Xembed atoms */
 | 
					enum { Manager, Xembed, XembedInfo, XLast }; /* Xembed atoms */
 | 
				
			||||||
enum { WMProtocols, WMDelete, WMState, WMTakeFocus, WMLast }; /* default atoms */
 | 
					enum { WMProtocols, WMDelete, WMState, WMTakeFocus, WMLast }; /* default atoms */
 | 
				
			||||||
enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkClientWin,
 | 
					enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle,
 | 
				
			||||||
       ClkRootWin, ClkLast }; /* clicks */
 | 
					       ClkClientWin, ClkRootWin, ClkLast }; /* clicks */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
typedef union {
 | 
					typedef union {
 | 
				
			||||||
	int i;
 | 
						int i;
 | 
				
			||||||
@@ -111,7 +110,7 @@ struct Client {
 | 
				
			|||||||
	int basew, baseh, incw, inch, maxw, maxh, minw, minh;
 | 
						int basew, baseh, incw, inch, maxw, maxh, minw, minh;
 | 
				
			||||||
	int bw, oldbw;
 | 
						int bw, oldbw;
 | 
				
			||||||
	unsigned int tags;
 | 
						unsigned int tags;
 | 
				
			||||||
	int isfixed, iscentered, isfloating, isurgent, neverfocus, oldstate, isfullscreen;
 | 
						int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen;
 | 
				
			||||||
	Client *next;
 | 
						Client *next;
 | 
				
			||||||
	Client *snext;
 | 
						Client *snext;
 | 
				
			||||||
	Monitor *mon;
 | 
						Monitor *mon;
 | 
				
			||||||
@@ -130,7 +129,6 @@ typedef struct {
 | 
				
			|||||||
	void (*arrange)(Monitor *);
 | 
						void (*arrange)(Monitor *);
 | 
				
			||||||
} Layout;
 | 
					} Layout;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
typedef struct Pertag Pertag;
 | 
					 | 
				
			||||||
struct Monitor {
 | 
					struct Monitor {
 | 
				
			||||||
	char ltsymbol[16];
 | 
						char ltsymbol[16];
 | 
				
			||||||
	float mfact;
 | 
						float mfact;
 | 
				
			||||||
@@ -150,7 +148,6 @@ struct Monitor {
 | 
				
			|||||||
	Monitor *next;
 | 
						Monitor *next;
 | 
				
			||||||
	Window barwin;
 | 
						Window barwin;
 | 
				
			||||||
	const Layout *lt[2];
 | 
						const Layout *lt[2];
 | 
				
			||||||
	Pertag *pertag;
 | 
					 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
typedef struct {
 | 
					typedef struct {
 | 
				
			||||||
@@ -158,7 +155,6 @@ typedef struct {
 | 
				
			|||||||
	const char *instance;
 | 
						const char *instance;
 | 
				
			||||||
	const char *title;
 | 
						const char *title;
 | 
				
			||||||
	unsigned int tags;
 | 
						unsigned int tags;
 | 
				
			||||||
	int iscentered;
 | 
					 | 
				
			||||||
	int isfloating;
 | 
						int isfloating;
 | 
				
			||||||
	int monitor;
 | 
						int monitor;
 | 
				
			||||||
} Rule;
 | 
					} Rule;
 | 
				
			||||||
@@ -184,24 +180,19 @@ static void clientmessage(XEvent *e);
 | 
				
			|||||||
static void configure(Client *c);
 | 
					static void configure(Client *c);
 | 
				
			||||||
static void configurenotify(XEvent *e);
 | 
					static void configurenotify(XEvent *e);
 | 
				
			||||||
static void configurerequest(XEvent *e);
 | 
					static void configurerequest(XEvent *e);
 | 
				
			||||||
static void copyvalidchars(char *text, char *rawtext);
 | 
					 | 
				
			||||||
static Monitor *createmon(void);
 | 
					static Monitor *createmon(void);
 | 
				
			||||||
static void deck(Monitor *m);
 | 
					 | 
				
			||||||
static void cyclelayout(const Arg *arg);
 | 
					 | 
				
			||||||
static void destroynotify(XEvent *e);
 | 
					static void destroynotify(XEvent *e);
 | 
				
			||||||
static void detach(Client *c);
 | 
					static void detach(Client *c);
 | 
				
			||||||
static void detachstack(Client *c);
 | 
					static void detachstack(Client *c);
 | 
				
			||||||
static Monitor *dirtomon(int dir);
 | 
					static Monitor *dirtomon(int dir);
 | 
				
			||||||
static void drawbar(Monitor *m);
 | 
					static void drawbar(Monitor *m);
 | 
				
			||||||
static void drawbars(void);
 | 
					static void drawbars(void);
 | 
				
			||||||
static int drawstatusbar(Monitor *m, int bh, char* text);
 | 
					 | 
				
			||||||
static void enternotify(XEvent *e);
 | 
					static void enternotify(XEvent *e);
 | 
				
			||||||
static void expose(XEvent *e);
 | 
					static void expose(XEvent *e);
 | 
				
			||||||
static void focus(Client *c);
 | 
					static void focus(Client *c);
 | 
				
			||||||
static void focusin(XEvent *e);
 | 
					static void focusin(XEvent *e);
 | 
				
			||||||
static void focusmon(const Arg *arg);
 | 
					static void focusmon(const Arg *arg);
 | 
				
			||||||
static void focusstack(const Arg *arg);
 | 
					static void focusstack(const Arg *arg);
 | 
				
			||||||
static int getdwmblockspid();
 | 
					 | 
				
			||||||
static Atom getatomprop(Client *c, Atom prop);
 | 
					static Atom getatomprop(Client *c, Atom prop);
 | 
				
			||||||
static int getrootptr(int *x, int *y);
 | 
					static int getrootptr(int *x, int *y);
 | 
				
			||||||
static long getstate(Window w);
 | 
					static long getstate(Window w);
 | 
				
			||||||
@@ -243,7 +234,6 @@ static void setup(void);
 | 
				
			|||||||
static void seturgent(Client *c, int urg);
 | 
					static void seturgent(Client *c, int urg);
 | 
				
			||||||
static void showhide(Client *c);
 | 
					static void showhide(Client *c);
 | 
				
			||||||
static void sigchld(int unused);
 | 
					static void sigchld(int unused);
 | 
				
			||||||
static void sigdwmblocks(const Arg *arg);
 | 
					 | 
				
			||||||
static void spawn(const Arg *arg);
 | 
					static void spawn(const Arg *arg);
 | 
				
			||||||
static Monitor *systraytomon(Monitor *m);
 | 
					static Monitor *systraytomon(Monitor *m);
 | 
				
			||||||
static void tag(const Arg *arg);
 | 
					static void tag(const Arg *arg);
 | 
				
			||||||
@@ -251,7 +241,6 @@ static void tagmon(const Arg *arg);
 | 
				
			|||||||
static void tile(Monitor *);
 | 
					static void tile(Monitor *);
 | 
				
			||||||
static void togglebar(const Arg *arg);
 | 
					static void togglebar(const Arg *arg);
 | 
				
			||||||
static void togglefloating(const Arg *arg);
 | 
					static void togglefloating(const Arg *arg);
 | 
				
			||||||
static void togglefullscr(const Arg *arg);
 | 
					 | 
				
			||||||
static void toggletag(const Arg *arg);
 | 
					static void toggletag(const Arg *arg);
 | 
				
			||||||
static void toggleview(const Arg *arg);
 | 
					static void toggleview(const Arg *arg);
 | 
				
			||||||
static void unfocus(Client *c, int setfocus);
 | 
					static void unfocus(Client *c, int setfocus);
 | 
				
			||||||
@@ -277,18 +266,12 @@ static Client *wintosystrayicon(Window w);
 | 
				
			|||||||
static int xerror(Display *dpy, XErrorEvent *ee);
 | 
					static int xerror(Display *dpy, XErrorEvent *ee);
 | 
				
			||||||
static int xerrordummy(Display *dpy, XErrorEvent *ee);
 | 
					static int xerrordummy(Display *dpy, XErrorEvent *ee);
 | 
				
			||||||
static int xerrorstart(Display *dpy, XErrorEvent *ee);
 | 
					static int xerrorstart(Display *dpy, XErrorEvent *ee);
 | 
				
			||||||
static void xinitvisual();
 | 
					 | 
				
			||||||
static void zoom(const Arg *arg);
 | 
					static void zoom(const Arg *arg);
 | 
				
			||||||
static void bstack(Monitor *m);
 | 
					 | 
				
			||||||
static void bstackhoriz(Monitor *m);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* variables */
 | 
					/* variables */
 | 
				
			||||||
static Systray *systray =  NULL;
 | 
					static Systray *systray =  NULL;
 | 
				
			||||||
static const char broken[] = "broken";
 | 
					static const char broken[] = "broken";
 | 
				
			||||||
static char stext[1024];
 | 
					static char stext[256];
 | 
				
			||||||
static char rawstext[1024];
 | 
					 | 
				
			||||||
static int dwmblockssig;
 | 
					 | 
				
			||||||
pid_t dwmblockspid = 0;
 | 
					 | 
				
			||||||
static int screen;
 | 
					static int screen;
 | 
				
			||||||
static int sw, sh;           /* X display screen geometry width, height */
 | 
					static int sw, sh;           /* X display screen geometry width, height */
 | 
				
			||||||
static int bh, blw = 0;      /* bar geometry */
 | 
					static int bh, blw = 0;      /* bar geometry */
 | 
				
			||||||
@@ -321,23 +304,9 @@ static Drw *drw;
 | 
				
			|||||||
static Monitor *mons, *selmon;
 | 
					static Monitor *mons, *selmon;
 | 
				
			||||||
static Window root, wmcheckwin;
 | 
					static Window root, wmcheckwin;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int useargb = 0;
 | 
					 | 
				
			||||||
static Visual *visual;
 | 
					 | 
				
			||||||
static int depth;
 | 
					 | 
				
			||||||
static Colormap cmap;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* configuration, allows nested code to access above variables */
 | 
					/* configuration, allows nested code to access above variables */
 | 
				
			||||||
#include "config.h"
 | 
					#include "config.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct Pertag {
 | 
					 | 
				
			||||||
	unsigned int curtag, prevtag; /* current and previous tag */
 | 
					 | 
				
			||||||
	int nmasters[LENGTH(tags) + 1]; /* number of windows in master area */
 | 
					 | 
				
			||||||
	float mfacts[LENGTH(tags) + 1]; /* mfacts per tag */
 | 
					 | 
				
			||||||
	unsigned int sellts[LENGTH(tags) + 1]; /* selected layouts */
 | 
					 | 
				
			||||||
	const Layout *ltidxs[LENGTH(tags) + 1][2]; /* matrix of tags and layouts indexes  */
 | 
					 | 
				
			||||||
	int showbars[LENGTH(tags) + 1]; /* display bar for the current tag */
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* compile-time check if all tags fit into an unsigned int bit array. */
 | 
					/* compile-time check if all tags fit into an unsigned int bit array. */
 | 
				
			||||||
struct NumTags { char limitexceeded[LENGTH(tags) > 31 ? -1 : 1]; };
 | 
					struct NumTags { char limitexceeded[LENGTH(tags) > 31 ? -1 : 1]; };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -364,7 +333,6 @@ applyrules(Client *c)
 | 
				
			|||||||
		&& (!r->class || strstr(class, r->class))
 | 
							&& (!r->class || strstr(class, r->class))
 | 
				
			||||||
		&& (!r->instance || strstr(instance, r->instance)))
 | 
							&& (!r->instance || strstr(instance, r->instance)))
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			c->iscentered = r->iscentered;
 | 
					 | 
				
			||||||
			c->isfloating = r->isfloating;
 | 
								c->isfloating = r->isfloating;
 | 
				
			||||||
			c->tags |= r->tags;
 | 
								c->tags |= r->tags;
 | 
				
			||||||
			for (m = mons; m && m->num != r->monitor; m = m->next);
 | 
								for (m = mons; m && m->num != r->monitor; m = m->next);
 | 
				
			||||||
@@ -507,27 +475,10 @@ buttonpress(XEvent *e)
 | 
				
			|||||||
			arg.ui = 1 << i;
 | 
								arg.ui = 1 << i;
 | 
				
			||||||
		} else if (ev->x < x + blw)
 | 
							} else if (ev->x < x + blw)
 | 
				
			||||||
			click = ClkLtSymbol;
 | 
								click = ClkLtSymbol;
 | 
				
			||||||
		else if (ev->x > (x = selmon->ww - TEXTW(stext) + lrpad) - getsystraywidth()) {
 | 
							else if (ev->x > selmon->ww - TEXTW(stext) - getsystraywidth())
 | 
				
			||||||
			click = ClkStatusText;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
			char *text = rawstext;
 | 
					 | 
				
			||||||
			int i = -1;
 | 
					 | 
				
			||||||
			char ch;
 | 
					 | 
				
			||||||
			dwmblockssig = 0;
 | 
					 | 
				
			||||||
			while (text[++i]) {
 | 
					 | 
				
			||||||
				if ((unsigned char)text[i] < ' ') {
 | 
					 | 
				
			||||||
					ch = text[i];
 | 
					 | 
				
			||||||
					text[i] = '\0';
 | 
					 | 
				
			||||||
					x += TEXTW(text) - lrpad;
 | 
					 | 
				
			||||||
					text[i] = ch;
 | 
					 | 
				
			||||||
					text += i+1;
 | 
					 | 
				
			||||||
					i = -1;
 | 
					 | 
				
			||||||
					if (x >= ev->x) break;
 | 
					 | 
				
			||||||
					dwmblockssig = ch;
 | 
					 | 
				
			||||||
				}
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		} else
 | 
					 | 
				
			||||||
			click = ClkStatusText;
 | 
								click = ClkStatusText;
 | 
				
			||||||
 | 
							else
 | 
				
			||||||
 | 
								click = ClkWinTitle;
 | 
				
			||||||
	} else if ((c = wintoclient(ev->window))) {
 | 
						} else if ((c = wintoclient(ev->window))) {
 | 
				
			||||||
		focus(c);
 | 
							focus(c);
 | 
				
			||||||
		restack(selmon);
 | 
							restack(selmon);
 | 
				
			||||||
@@ -574,7 +525,7 @@ cleanup(void)
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
	for (i = 0; i < CurLast; i++)
 | 
						for (i = 0; i < CurLast; i++)
 | 
				
			||||||
		drw_cur_free(drw, cursor[i]);
 | 
							drw_cur_free(drw, cursor[i]);
 | 
				
			||||||
	for (i = 0; i < LENGTH(colors) + 1; i++)
 | 
						for (i = 0; i < LENGTH(colors); i++)
 | 
				
			||||||
		free(scheme[i]);
 | 
							free(scheme[i]);
 | 
				
			||||||
	XDestroyWindow(dpy, wmcheckwin);
 | 
						XDestroyWindow(dpy, wmcheckwin);
 | 
				
			||||||
	drw_free(drw);
 | 
						drw_free(drw);
 | 
				
			||||||
@@ -765,24 +716,10 @@ configurerequest(XEvent *e)
 | 
				
			|||||||
	XSync(dpy, False);
 | 
						XSync(dpy, False);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void
 | 
					 | 
				
			||||||
copyvalidchars(char *text, char *rawtext)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	int i = -1, j = 0;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	while(rawtext[++i]) {
 | 
					 | 
				
			||||||
		if ((unsigned char)rawtext[i] >= ' ') {
 | 
					 | 
				
			||||||
			text[j++] = rawtext[i];
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	text[j] = '\0';
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Monitor *
 | 
					Monitor *
 | 
				
			||||||
createmon(void)
 | 
					createmon(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	Monitor *m;
 | 
						Monitor *m;
 | 
				
			||||||
	unsigned int i;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	m = ecalloc(1, sizeof(Monitor));
 | 
						m = ecalloc(1, sizeof(Monitor));
 | 
				
			||||||
	m->tagset[0] = m->tagset[1] = 1;
 | 
						m->tagset[0] = m->tagset[1] = 1;
 | 
				
			||||||
@@ -793,40 +730,9 @@ createmon(void)
 | 
				
			|||||||
	m->lt[0] = &layouts[0];
 | 
						m->lt[0] = &layouts[0];
 | 
				
			||||||
	m->lt[1] = &layouts[1 % LENGTH(layouts)];
 | 
						m->lt[1] = &layouts[1 % LENGTH(layouts)];
 | 
				
			||||||
	strncpy(m->ltsymbol, layouts[0].symbol, sizeof m->ltsymbol);
 | 
						strncpy(m->ltsymbol, layouts[0].symbol, sizeof m->ltsymbol);
 | 
				
			||||||
	m->pertag = ecalloc(1, sizeof(Pertag));
 | 
					 | 
				
			||||||
	m->pertag->curtag = m->pertag->prevtag = 1;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	for (i = 0; i <= LENGTH(tags); i++) {
 | 
					 | 
				
			||||||
		m->pertag->nmasters[i] = m->nmaster;
 | 
					 | 
				
			||||||
		m->pertag->mfacts[i] = m->mfact;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		m->pertag->ltidxs[i][0] = m->lt[0];
 | 
					 | 
				
			||||||
		m->pertag->ltidxs[i][1] = m->lt[1];
 | 
					 | 
				
			||||||
		m->pertag->sellts[i] = m->sellt;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		m->pertag->showbars[i] = m->showbar;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	return m;
 | 
						return m;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void
 | 
					 | 
				
			||||||
cyclelayout(const Arg *arg) {
 | 
					 | 
				
			||||||
	Layout *l;
 | 
					 | 
				
			||||||
	for(l = (Layout *)layouts; l != selmon->lt[selmon->sellt]; l++);
 | 
					 | 
				
			||||||
	if(arg->i > 0) {
 | 
					 | 
				
			||||||
		if(l->symbol && (l + 1)->symbol)
 | 
					 | 
				
			||||||
			setlayout(&((Arg) { .v = (l + 1) }));
 | 
					 | 
				
			||||||
		else
 | 
					 | 
				
			||||||
			setlayout(&((Arg) { .v = layouts }));
 | 
					 | 
				
			||||||
	} else {
 | 
					 | 
				
			||||||
		if(l != layouts && (l - 1)->symbol)
 | 
					 | 
				
			||||||
			setlayout(&((Arg) { .v = (l - 1) }));
 | 
					 | 
				
			||||||
		else
 | 
					 | 
				
			||||||
			setlayout(&((Arg) { .v = &layouts[LENGTH(layouts) - 2] }));
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void
 | 
					void
 | 
				
			||||||
destroynotify(XEvent *e)
 | 
					destroynotify(XEvent *e)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
@@ -842,31 +748,6 @@ destroynotify(XEvent *e)
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void
 | 
					 | 
				
			||||||
deck(Monitor *m) {
 | 
					 | 
				
			||||||
	unsigned int i, n, h, mw, my;
 | 
					 | 
				
			||||||
	Client *c;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	for(n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
 | 
					 | 
				
			||||||
	if(n == 0)
 | 
					 | 
				
			||||||
		return;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if(n > m->nmaster) {
 | 
					 | 
				
			||||||
		mw = m->nmaster ? m->ww * m->mfact : 0;
 | 
					 | 
				
			||||||
		snprintf(m->ltsymbol, sizeof m->ltsymbol, "%d", n - m->nmaster);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	else
 | 
					 | 
				
			||||||
		mw = m->ww;
 | 
					 | 
				
			||||||
	for(i = my = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
 | 
					 | 
				
			||||||
		if(i < m->nmaster) {
 | 
					 | 
				
			||||||
			h = (m->wh - my) / (MIN(n, m->nmaster) - i);
 | 
					 | 
				
			||||||
			resize(c, m->wx, m->wy + my, mw - (2*c->bw), h - (2*c->bw), False);
 | 
					 | 
				
			||||||
			my += HEIGHT(c);
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		else
 | 
					 | 
				
			||||||
			resize(c, m->wx + mw, m->wy, m->ww - mw - (2*c->bw), m->wh - (2*c->bw), False);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void
 | 
					void
 | 
				
			||||||
detach(Client *c)
 | 
					detach(Client *c)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
@@ -905,119 +786,6 @@ dirtomon(int dir)
 | 
				
			|||||||
	return m;
 | 
						return m;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int
 | 
					 | 
				
			||||||
drawstatusbar(Monitor *m, int bh, char* stext) {
 | 
					 | 
				
			||||||
	int ret, i, w, x, len;
 | 
					 | 
				
			||||||
	short isCode = 0;
 | 
					 | 
				
			||||||
	char *text;
 | 
					 | 
				
			||||||
	char *p;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	len = strlen(stext) + 1 ;
 | 
					 | 
				
			||||||
	if (!(text = (char*) malloc(sizeof(char)*len)))
 | 
					 | 
				
			||||||
		die("malloc");
 | 
					 | 
				
			||||||
	p = text;
 | 
					 | 
				
			||||||
	memcpy(text, stext, len);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/* compute width of the status text */
 | 
					 | 
				
			||||||
	w = 0;
 | 
					 | 
				
			||||||
	i = -1;
 | 
					 | 
				
			||||||
	while (text[++i]) {
 | 
					 | 
				
			||||||
		if (text[i] == '^') {
 | 
					 | 
				
			||||||
			if (!isCode) {
 | 
					 | 
				
			||||||
				isCode = 1;
 | 
					 | 
				
			||||||
				text[i] = '\0';
 | 
					 | 
				
			||||||
				w += TEXTW(text) - lrpad;
 | 
					 | 
				
			||||||
				text[i] = '^';
 | 
					 | 
				
			||||||
				if (text[++i] == 'f')
 | 
					 | 
				
			||||||
					w += atoi(text + ++i);
 | 
					 | 
				
			||||||
			} else {
 | 
					 | 
				
			||||||
				isCode = 0;
 | 
					 | 
				
			||||||
				text = text + i + 1;
 | 
					 | 
				
			||||||
				i = -1;
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	if (!isCode)
 | 
					 | 
				
			||||||
		w += TEXTW(text) - lrpad;
 | 
					 | 
				
			||||||
	else
 | 
					 | 
				
			||||||
		isCode = 0;
 | 
					 | 
				
			||||||
	text = p;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	w += 2; /* 1px padding on both sides */
 | 
					 | 
				
			||||||
	ret = m->ww - w;
 | 
					 | 
				
			||||||
        if (m == selmon){
 | 
					 | 
				
			||||||
          x = ret - getsystraywidth();
 | 
					 | 
				
			||||||
        } else {
 | 
					 | 
				
			||||||
        x = ret;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	drw_setscheme(drw, scheme[LENGTH(colors)]);
 | 
					 | 
				
			||||||
	drw->scheme[ColFg] = scheme[SchemeNorm][ColFg];
 | 
					 | 
				
			||||||
	drw->scheme[ColBg] = scheme[SchemeNorm][ColBg];
 | 
					 | 
				
			||||||
	drw_rect(drw, x, 0, w, bh, 1, 1);
 | 
					 | 
				
			||||||
	x++;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/* process status text */
 | 
					 | 
				
			||||||
	i = -1;
 | 
					 | 
				
			||||||
	while (text[++i]) {
 | 
					 | 
				
			||||||
		if (text[i] == '^' && !isCode) {
 | 
					 | 
				
			||||||
			isCode = 1;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
			text[i] = '\0';
 | 
					 | 
				
			||||||
			w = TEXTW(text) - lrpad;
 | 
					 | 
				
			||||||
			drw_text(drw, x, 0, w, bh, 0, text, 0);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
			x += w;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
			/* process code */
 | 
					 | 
				
			||||||
			while (text[++i] != '^') {
 | 
					 | 
				
			||||||
				if (text[i] == 'c') {
 | 
					 | 
				
			||||||
					char buf[8];
 | 
					 | 
				
			||||||
					memcpy(buf, (char*)text+i+1, 7);
 | 
					 | 
				
			||||||
					buf[7] = '\0';
 | 
					 | 
				
			||||||
					drw_clr_create(drw, &drw->scheme[ColFg], buf, alphas[SchemeNorm][ColFg]);
 | 
					 | 
				
			||||||
					i += 7;
 | 
					 | 
				
			||||||
				} else if (text[i] == 'b') {
 | 
					 | 
				
			||||||
					char buf[8];
 | 
					 | 
				
			||||||
					memcpy(buf, (char*)text+i+1, 7);
 | 
					 | 
				
			||||||
					buf[7] = '\0';
 | 
					 | 
				
			||||||
					drw_clr_create(drw, &drw->scheme[ColBg], buf, alphas[SchemeNorm][ColFg]);
 | 
					 | 
				
			||||||
					i += 7;
 | 
					 | 
				
			||||||
				} else if (text[i] == 'd') {
 | 
					 | 
				
			||||||
					drw->scheme[ColFg] = scheme[SchemeNorm][ColFg];
 | 
					 | 
				
			||||||
					drw->scheme[ColBg] = scheme[SchemeNorm][ColBg];
 | 
					 | 
				
			||||||
				} else if (text[i] == 'r') {
 | 
					 | 
				
			||||||
					int rx = atoi(text + ++i);
 | 
					 | 
				
			||||||
					while (text[++i] != ',');
 | 
					 | 
				
			||||||
					int ry = atoi(text + ++i);
 | 
					 | 
				
			||||||
					while (text[++i] != ',');
 | 
					 | 
				
			||||||
					int rw = atoi(text + ++i);
 | 
					 | 
				
			||||||
					while (text[++i] != ',');
 | 
					 | 
				
			||||||
					int rh = atoi(text + ++i);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
					drw_rect(drw, rx + x, ry, rw, rh, 1, 0);
 | 
					 | 
				
			||||||
				} else if (text[i] == 'f') {
 | 
					 | 
				
			||||||
					x += atoi(text + ++i);
 | 
					 | 
				
			||||||
				}
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
			text = text + i + 1;
 | 
					 | 
				
			||||||
			i=-1;
 | 
					 | 
				
			||||||
			isCode = 0;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if (!isCode) {
 | 
					 | 
				
			||||||
		w = TEXTW(text) - lrpad / 2 + 2;
 | 
					 | 
				
			||||||
		drw_text(drw, x, 0, w, bh, 0, text, 0);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	drw_setscheme(drw, scheme[SchemeNorm]);
 | 
					 | 
				
			||||||
	free(p);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	return ret;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void
 | 
					void
 | 
				
			||||||
drawbar(Monitor *m)
 | 
					drawbar(Monitor *m)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
@@ -1031,9 +799,11 @@ drawbar(Monitor *m)
 | 
				
			|||||||
		stw = getsystraywidth();
 | 
							stw = getsystraywidth();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* draw status first so it can be overdrawn by tags later */
 | 
						/* draw status first so it can be overdrawn by tags later */
 | 
				
			||||||
	if (m == selmon || 1) { /* status is only drawn on selected monitor */
 | 
						if (m == selmon) { /* status is only drawn on selected monitor */
 | 
				
			||||||
		sw = m->ww - drawstatusbar(m, bh, stext);
 | 
							drw_setscheme(drw, scheme[SchemeNorm]);
 | 
				
			||||||
        }
 | 
							sw = TEXTW(stext) - lrpad / 2 + 2; /* 2px right padding */
 | 
				
			||||||
 | 
							drw_text(drw, m->ww - sw - stw, 0, sw, bh, lrpad / 2 - 2, stext, 0);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	resizebarwin(m);
 | 
						resizebarwin(m);
 | 
				
			||||||
	for (c = m->clients; c; c = c->next) {
 | 
						for (c = m->clients; c; c = c->next) {
 | 
				
			||||||
@@ -1047,10 +817,9 @@ drawbar(Monitor *m)
 | 
				
			|||||||
		drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? SchemeSel : SchemeNorm]);
 | 
							drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? SchemeSel : SchemeNorm]);
 | 
				
			||||||
		drw_text(drw, x, 0, w, bh, lrpad / 2, tags[i], urg & 1 << i);
 | 
							drw_text(drw, x, 0, w, bh, lrpad / 2, tags[i], urg & 1 << i);
 | 
				
			||||||
		if (occ & 1 << i)
 | 
							if (occ & 1 << i)
 | 
				
			||||||
			drw_rect(drw, x + boxw, 0, w - ( 2 * boxw + 1), boxw,
 | 
								drw_rect(drw, x + boxs, boxs, boxw, boxw,
 | 
				
			||||||
			    m == selmon && selmon->sel && selmon->sel->tags & 1 << i,
 | 
									m == selmon && selmon->sel && selmon->sel->tags & 1 << i,
 | 
				
			||||||
			    urg & 1 << i);
 | 
									urg & 1 << i);
 | 
				
			||||||
 | 
					 | 
				
			||||||
		x += w;
 | 
							x += w;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	w = blw = TEXTW(m->ltsymbol);
 | 
						w = blw = TEXTW(m->ltsymbol);
 | 
				
			||||||
@@ -1058,8 +827,15 @@ drawbar(Monitor *m)
 | 
				
			|||||||
	x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0);
 | 
						x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ((w = m->ww - sw - stw - x) > bh) {
 | 
						if ((w = m->ww - sw - stw - x) > bh) {
 | 
				
			||||||
	    drw_setscheme(drw, scheme[SchemeNorm]);
 | 
							if (m->sel) {
 | 
				
			||||||
	    drw_rect(drw, x, 0, w, bh, 1, 1);
 | 
								drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]);
 | 
				
			||||||
 | 
								drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0);
 | 
				
			||||||
 | 
								if (m->sel->isfloating)
 | 
				
			||||||
 | 
									drw_rect(drw, x + boxs, boxs, boxw, boxw, m->sel->isfixed, 0);
 | 
				
			||||||
 | 
							} else {
 | 
				
			||||||
 | 
								drw_setscheme(drw, scheme[SchemeNorm]);
 | 
				
			||||||
 | 
								drw_rect(drw, x, 0, w, bh, 1, 1);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	drw_map(drw, m->barwin, 0, 0, m->ww - stw, bh);
 | 
						drw_map(drw, m->barwin, 0, 0, m->ww - stw, bh);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -1203,18 +979,6 @@ getatomprop(Client *c, Atom prop)
 | 
				
			|||||||
	return atom;
 | 
						return atom;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int
 | 
					 | 
				
			||||||
getdwmblockspid()
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	char buf[16];
 | 
					 | 
				
			||||||
	FILE *fp = popen("pidof -s dwmblocks", "r");
 | 
					 | 
				
			||||||
	fgets(buf, sizeof(buf), fp);
 | 
					 | 
				
			||||||
	pid_t pid = strtoul(buf, NULL, 10);
 | 
					 | 
				
			||||||
	pclose(fp);
 | 
					 | 
				
			||||||
	dwmblockspid = pid;
 | 
					 | 
				
			||||||
	return pid != 0 ? 0 : -1;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
int
 | 
					int
 | 
				
			||||||
getrootptr(int *x, int *y)
 | 
					getrootptr(int *x, int *y)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
@@ -1320,7 +1084,7 @@ grabkeys(void)
 | 
				
			|||||||
void
 | 
					void
 | 
				
			||||||
incnmaster(const Arg *arg)
 | 
					incnmaster(const Arg *arg)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	selmon->nmaster = selmon->pertag->nmasters[selmon->pertag->curtag] = MAX(selmon->nmaster + arg->i, 0);
 | 
						selmon->nmaster = MAX(selmon->nmaster + arg->i, 0);
 | 
				
			||||||
	arrange(selmon);
 | 
						arrange(selmon);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1403,11 +1167,6 @@ manage(Window w, XWindowAttributes *wa)
 | 
				
			|||||||
		&& (c->x + (c->w / 2) < c->mon->wx + c->mon->ww)) ? bh : c->mon->my);
 | 
							&& (c->x + (c->w / 2) < c->mon->wx + c->mon->ww)) ? bh : c->mon->my);
 | 
				
			||||||
	c->bw = borderpx;
 | 
						c->bw = borderpx;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(c->iscentered) {
 | 
					 | 
				
			||||||
		c->x = (c->mon->mw - WIDTH(c)) / 2;
 | 
					 | 
				
			||||||
		c->y = (c->mon->mh - HEIGHT(c)) / 2;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	wc.border_width = c->bw;
 | 
						wc.border_width = c->bw;
 | 
				
			||||||
	XConfigureWindow(dpy, w, CWBorderWidth, &wc);
 | 
						XConfigureWindow(dpy, w, CWBorderWidth, &wc);
 | 
				
			||||||
	XSetWindowBorder(dpy, w, scheme[SchemeNorm][ColBorder].pixel);
 | 
						XSetWindowBorder(dpy, w, scheme[SchemeNorm][ColBorder].pixel);
 | 
				
			||||||
@@ -1475,7 +1234,7 @@ monocle(Monitor *m)
 | 
				
			|||||||
		if (ISVISIBLE(c))
 | 
							if (ISVISIBLE(c))
 | 
				
			||||||
			n++;
 | 
								n++;
 | 
				
			||||||
	if (n > 0) /* override layout symbol */
 | 
						if (n > 0) /* override layout symbol */
 | 
				
			||||||
		snprintf(m->ltsymbol, sizeof m->ltsymbol, "%d", n);
 | 
							snprintf(m->ltsymbol, sizeof m->ltsymbol, "[%d]", n);
 | 
				
			||||||
	for (c = nexttiled(m->clients); c; c = nexttiled(c->next))
 | 
						for (c = nexttiled(m->clients); c; c = nexttiled(c->next))
 | 
				
			||||||
		resize(c, m->wx, m->wy, m->ww - 2 * c->bw, m->wh - 2 * c->bw, 0);
 | 
							resize(c, m->wx, m->wy, m->ww - 2 * c->bw, m->wh - 2 * c->bw, 0);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -1610,8 +1369,11 @@ propertynotify(XEvent *e)
 | 
				
			|||||||
			drawbars();
 | 
								drawbars();
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		if (ev->atom == XA_WM_NAME || ev->atom == netatom[NetWMName])
 | 
							if (ev->atom == XA_WM_NAME || ev->atom == netatom[NetWMName]) {
 | 
				
			||||||
			updatetitle(c);
 | 
								updatetitle(c);
 | 
				
			||||||
 | 
								if (c == c->mon->sel)
 | 
				
			||||||
 | 
									drawbar(c->mon);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
		if (ev->atom == netatom[NetWMWindowType])
 | 
							if (ev->atom == netatom[NetWMWindowType])
 | 
				
			||||||
			updatewindowtype(c);
 | 
								updatewindowtype(c);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@@ -1676,13 +1438,6 @@ resizeclient(Client *c, int x, int y, int w, int h)
 | 
				
			|||||||
	c->oldw = c->w; c->w = wc.width = w;
 | 
						c->oldw = c->w; c->w = wc.width = w;
 | 
				
			||||||
	c->oldh = c->h; c->h = wc.height = h;
 | 
						c->oldh = c->h; c->h = wc.height = h;
 | 
				
			||||||
	wc.border_width = c->bw;
 | 
						wc.border_width = c->bw;
 | 
				
			||||||
	if (((nexttiled(c->mon->clients) == c && !nexttiled(c->next))
 | 
					 | 
				
			||||||
	    || &monocle == c->mon->lt[c->mon->sellt]->arrange)
 | 
					 | 
				
			||||||
	    && !c->isfullscreen && !c->isfloating) {
 | 
					 | 
				
			||||||
		c->w = wc.width += c->bw * 2;
 | 
					 | 
				
			||||||
		c->h = wc.height += c->bw * 2;
 | 
					 | 
				
			||||||
		wc.border_width = 0;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc);
 | 
						XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc);
 | 
				
			||||||
	configure(c);
 | 
						configure(c);
 | 
				
			||||||
	XSync(dpy, False);
 | 
						XSync(dpy, False);
 | 
				
			||||||
@@ -1925,9 +1680,9 @@ void
 | 
				
			|||||||
setlayout(const Arg *arg)
 | 
					setlayout(const Arg *arg)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	if (!arg || !arg->v || arg->v != selmon->lt[selmon->sellt])
 | 
						if (!arg || !arg->v || arg->v != selmon->lt[selmon->sellt])
 | 
				
			||||||
		selmon->sellt = selmon->pertag->sellts[selmon->pertag->curtag] ^= 1;
 | 
							selmon->sellt ^= 1;
 | 
				
			||||||
	if (arg && arg->v)
 | 
						if (arg && arg->v)
 | 
				
			||||||
		selmon->lt[selmon->sellt] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt] = (Layout *)arg->v;
 | 
							selmon->lt[selmon->sellt] = (Layout *)arg->v;
 | 
				
			||||||
	strncpy(selmon->ltsymbol, selmon->lt[selmon->sellt]->symbol, sizeof selmon->ltsymbol);
 | 
						strncpy(selmon->ltsymbol, selmon->lt[selmon->sellt]->symbol, sizeof selmon->ltsymbol);
 | 
				
			||||||
	if (selmon->sel)
 | 
						if (selmon->sel)
 | 
				
			||||||
		arrange(selmon);
 | 
							arrange(selmon);
 | 
				
			||||||
@@ -1946,7 +1701,7 @@ setmfact(const Arg *arg)
 | 
				
			|||||||
	f = arg->f < 1.0 ? arg->f + selmon->mfact : arg->f - 1.0;
 | 
						f = arg->f < 1.0 ? arg->f + selmon->mfact : arg->f - 1.0;
 | 
				
			||||||
	if (f < 0.1 || f > 0.9)
 | 
						if (f < 0.1 || f > 0.9)
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	selmon->mfact = selmon->pertag->mfacts[selmon->pertag->curtag] = f;
 | 
						selmon->mfact = f;
 | 
				
			||||||
	arrange(selmon);
 | 
						arrange(selmon);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1965,8 +1720,7 @@ setup(void)
 | 
				
			|||||||
	sw = DisplayWidth(dpy, screen);
 | 
						sw = DisplayWidth(dpy, screen);
 | 
				
			||||||
	sh = DisplayHeight(dpy, screen);
 | 
						sh = DisplayHeight(dpy, screen);
 | 
				
			||||||
	root = RootWindow(dpy, screen);
 | 
						root = RootWindow(dpy, screen);
 | 
				
			||||||
	xinitvisual();
 | 
						drw = drw_create(dpy, screen, root, sw, sh);
 | 
				
			||||||
	drw = drw_create(dpy, screen, root, sw, sh, visual, depth, cmap);
 | 
					 | 
				
			||||||
	if (!drw_fontset_create(drw, fonts, LENGTH(fonts)))
 | 
						if (!drw_fontset_create(drw, fonts, LENGTH(fonts)))
 | 
				
			||||||
		die("no fonts could be loaded.");
 | 
							die("no fonts could be loaded.");
 | 
				
			||||||
	lrpad = drw->fonts->h;
 | 
						lrpad = drw->fonts->h;
 | 
				
			||||||
@@ -1999,10 +1753,9 @@ setup(void)
 | 
				
			|||||||
	cursor[CurResize] = drw_cur_create(drw, XC_sizing);
 | 
						cursor[CurResize] = drw_cur_create(drw, XC_sizing);
 | 
				
			||||||
	cursor[CurMove] = drw_cur_create(drw, XC_fleur);
 | 
						cursor[CurMove] = drw_cur_create(drw, XC_fleur);
 | 
				
			||||||
	/* init appearance */
 | 
						/* init appearance */
 | 
				
			||||||
	scheme = ecalloc(LENGTH(colors) + 1, sizeof(Clr *));
 | 
						scheme = ecalloc(LENGTH(colors), sizeof(Clr *));
 | 
				
			||||||
        scheme[LENGTH(colors)] = drw_scm_create(drw, colors[0], alphas[0], 3);
 | 
					 | 
				
			||||||
	for (i = 0; i < LENGTH(colors); i++)
 | 
						for (i = 0; i < LENGTH(colors); i++)
 | 
				
			||||||
		scheme[i] = drw_scm_create(drw, colors[i], alphas[i], 3);
 | 
							scheme[i] = drw_scm_create(drw, colors[i], 3);
 | 
				
			||||||
	/* init system tray */
 | 
						/* init system tray */
 | 
				
			||||||
	updatesystray();
 | 
						updatesystray();
 | 
				
			||||||
	/* init bars */
 | 
						/* init bars */
 | 
				
			||||||
@@ -2071,23 +1824,6 @@ sigchld(int unused)
 | 
				
			|||||||
	while (0 < waitpid(-1, NULL, WNOHANG));
 | 
						while (0 < waitpid(-1, NULL, WNOHANG));
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void
 | 
					 | 
				
			||||||
sigdwmblocks(const Arg *arg)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	union sigval sv;
 | 
					 | 
				
			||||||
	sv.sival_int = (dwmblockssig << 8) | arg->i;
 | 
					 | 
				
			||||||
	if (!dwmblockspid)
 | 
					 | 
				
			||||||
		if (getdwmblockspid() == -1)
 | 
					 | 
				
			||||||
			return;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if (sigqueue(dwmblockspid, SIGUSR1, sv) == -1) {
 | 
					 | 
				
			||||||
		if (errno == ESRCH) {
 | 
					 | 
				
			||||||
			if (!getdwmblockspid())
 | 
					 | 
				
			||||||
				sigqueue(dwmblockspid, SIGUSR1, sv);
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void
 | 
					void
 | 
				
			||||||
spawn(const Arg *arg)
 | 
					spawn(const Arg *arg)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
@@ -2151,7 +1887,7 @@ tile(Monitor *m)
 | 
				
			|||||||
void
 | 
					void
 | 
				
			||||||
togglebar(const Arg *arg)
 | 
					togglebar(const Arg *arg)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	selmon->showbar = selmon->pertag->showbars[selmon->pertag->curtag] = !selmon->showbar;
 | 
						selmon->showbar = !selmon->showbar;
 | 
				
			||||||
	updatebarpos(selmon);
 | 
						updatebarpos(selmon);
 | 
				
			||||||
	resizebarwin(selmon);
 | 
						resizebarwin(selmon);
 | 
				
			||||||
	if (showsystray) {
 | 
						if (showsystray) {
 | 
				
			||||||
@@ -2182,13 +1918,6 @@ togglefloating(const Arg *arg)
 | 
				
			|||||||
	arrange(selmon);
 | 
						arrange(selmon);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void
 | 
					 | 
				
			||||||
togglefullscr(const Arg *arg)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
  if(selmon->sel)
 | 
					 | 
				
			||||||
    setfullscreen(selmon->sel, !selmon->sel->isfullscreen);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void
 | 
					void
 | 
				
			||||||
toggletag(const Arg *arg)
 | 
					toggletag(const Arg *arg)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
@@ -2208,33 +1937,9 @@ void
 | 
				
			|||||||
toggleview(const Arg *arg)
 | 
					toggleview(const Arg *arg)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	unsigned int newtagset = selmon->tagset[selmon->seltags] ^ (arg->ui & TAGMASK);
 | 
						unsigned int newtagset = selmon->tagset[selmon->seltags] ^ (arg->ui & TAGMASK);
 | 
				
			||||||
	int i;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (newtagset) {
 | 
						if (newtagset) {
 | 
				
			||||||
		selmon->tagset[selmon->seltags] = newtagset;
 | 
							selmon->tagset[selmon->seltags] = newtagset;
 | 
				
			||||||
 | 
					 | 
				
			||||||
		if (newtagset == ~0) {
 | 
					 | 
				
			||||||
			selmon->pertag->prevtag = selmon->pertag->curtag;
 | 
					 | 
				
			||||||
			selmon->pertag->curtag = 0;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		/* test if the user did not select the same tag */
 | 
					 | 
				
			||||||
		if (!(newtagset & 1 << (selmon->pertag->curtag - 1))) {
 | 
					 | 
				
			||||||
			selmon->pertag->prevtag = selmon->pertag->curtag;
 | 
					 | 
				
			||||||
			for (i = 0; !(newtagset & 1 << i); i++) ;
 | 
					 | 
				
			||||||
			selmon->pertag->curtag = i + 1;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		/* apply settings for this view */
 | 
					 | 
				
			||||||
		selmon->nmaster = selmon->pertag->nmasters[selmon->pertag->curtag];
 | 
					 | 
				
			||||||
		selmon->mfact = selmon->pertag->mfacts[selmon->pertag->curtag];
 | 
					 | 
				
			||||||
		selmon->sellt = selmon->pertag->sellts[selmon->pertag->curtag];
 | 
					 | 
				
			||||||
		selmon->lt[selmon->sellt] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt];
 | 
					 | 
				
			||||||
		selmon->lt[selmon->sellt^1] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt^1];
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		if (selmon->showbar != selmon->pertag->showbars[selmon->pertag->curtag])
 | 
					 | 
				
			||||||
			togglebar(NULL);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		focus(NULL);
 | 
							focus(NULL);
 | 
				
			||||||
		arrange(selmon);
 | 
							arrange(selmon);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@@ -2305,9 +2010,7 @@ updatebars(void)
 | 
				
			|||||||
	Monitor *m;
 | 
						Monitor *m;
 | 
				
			||||||
	XSetWindowAttributes wa = {
 | 
						XSetWindowAttributes wa = {
 | 
				
			||||||
		.override_redirect = True,
 | 
							.override_redirect = True,
 | 
				
			||||||
		.background_pixel = 0,
 | 
							.background_pixmap = ParentRelative,
 | 
				
			||||||
		.border_pixel = 0,
 | 
					 | 
				
			||||||
		.colormap = cmap,
 | 
					 | 
				
			||||||
		.event_mask = ButtonPressMask|ExposureMask
 | 
							.event_mask = ButtonPressMask|ExposureMask
 | 
				
			||||||
	};
 | 
						};
 | 
				
			||||||
	XClassHint ch = {"dwm", "dwm"};
 | 
						XClassHint ch = {"dwm", "dwm"};
 | 
				
			||||||
@@ -2317,9 +2020,9 @@ updatebars(void)
 | 
				
			|||||||
		w = m->ww;
 | 
							w = m->ww;
 | 
				
			||||||
		if (showsystray && m == systraytomon(m))
 | 
							if (showsystray && m == systraytomon(m))
 | 
				
			||||||
			w -= getsystraywidth();
 | 
								w -= getsystraywidth();
 | 
				
			||||||
		m->barwin = XCreateWindow(dpy, root, m->wx, m->by, w, bh, 0, depth,
 | 
							m->barwin = XCreateWindow(dpy, root, m->wx, m->by, w, bh, 0, DefaultDepth(dpy, screen),
 | 
				
			||||||
		                          InputOutput, visual,
 | 
									CopyFromParent, DefaultVisual(dpy, screen),
 | 
				
			||||||
		                          CWOverrideRedirect|CWBackPixel|CWBorderPixel|CWColormap|CWEventMask, &wa);
 | 
									CWOverrideRedirect|CWBackPixmap|CWEventMask, &wa);
 | 
				
			||||||
		XDefineCursor(dpy, m->barwin, cursor[CurNormal]->cursor);
 | 
							XDefineCursor(dpy, m->barwin, cursor[CurNormal]->cursor);
 | 
				
			||||||
		if (showsystray && m == systraytomon(m))
 | 
							if (showsystray && m == systraytomon(m))
 | 
				
			||||||
			XMapRaised(dpy, systray->win);
 | 
								XMapRaised(dpy, systray->win);
 | 
				
			||||||
@@ -2495,14 +2198,10 @@ updatesizehints(Client *c)
 | 
				
			|||||||
void
 | 
					void
 | 
				
			||||||
updatestatus(void)
 | 
					updatestatus(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	Monitor* m;
 | 
						if (!gettextprop(root, XA_WM_NAME, stext, sizeof(stext)))
 | 
				
			||||||
	if (!gettextprop(root, XA_WM_NAME, rawstext, sizeof(rawstext)))
 | 
					 | 
				
			||||||
		strcpy(stext, "dwm-"VERSION);
 | 
							strcpy(stext, "dwm-"VERSION);
 | 
				
			||||||
	else
 | 
						drawbar(selmon);
 | 
				
			||||||
		copyvalidchars(stext, rawstext);
 | 
						updatesystray();
 | 
				
			||||||
	for(m = mons; m; m = m->next)
 | 
					 | 
				
			||||||
		drawbar(m);
 | 
					 | 
				
			||||||
	        updatesystray();
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void
 | 
					void
 | 
				
			||||||
@@ -2615,7 +2314,7 @@ updatesystray(void)
 | 
				
			|||||||
	XMapSubwindows(dpy, systray->win);
 | 
						XMapSubwindows(dpy, systray->win);
 | 
				
			||||||
	/* redraw background */
 | 
						/* redraw background */
 | 
				
			||||||
	XSetForeground(dpy, drw->gc, scheme[SchemeNorm][ColBg].pixel);
 | 
						XSetForeground(dpy, drw->gc, scheme[SchemeNorm][ColBg].pixel);
 | 
				
			||||||
        XFillRectangle(dpy, systray->win, XCreateGC(dpy, root, 0 , NULL), 0, 0, w, bh);
 | 
						XFillRectangle(dpy, systray->win, drw->gc, 0, 0, w, bh);
 | 
				
			||||||
	XSync(dpy, False);
 | 
						XSync(dpy, False);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -2662,37 +2361,11 @@ updatewmhints(Client *c)
 | 
				
			|||||||
void
 | 
					void
 | 
				
			||||||
view(const Arg *arg)
 | 
					view(const Arg *arg)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int i;
 | 
					 | 
				
			||||||
	unsigned int tmptag;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if ((arg->ui & TAGMASK) == selmon->tagset[selmon->seltags])
 | 
						if ((arg->ui & TAGMASK) == selmon->tagset[selmon->seltags])
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	selmon->seltags ^= 1; /* toggle sel tagset */
 | 
						selmon->seltags ^= 1; /* toggle sel tagset */
 | 
				
			||||||
	if (arg->ui & TAGMASK) {
 | 
						if (arg->ui & TAGMASK)
 | 
				
			||||||
		selmon->tagset[selmon->seltags] = arg->ui & TAGMASK;
 | 
							selmon->tagset[selmon->seltags] = arg->ui & TAGMASK;
 | 
				
			||||||
		selmon->pertag->prevtag = selmon->pertag->curtag;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		if (arg->ui == ~0)
 | 
					 | 
				
			||||||
			selmon->pertag->curtag = 0;
 | 
					 | 
				
			||||||
		else {
 | 
					 | 
				
			||||||
			for (i = 0; !(arg->ui & 1 << i); i++) ;
 | 
					 | 
				
			||||||
			selmon->pertag->curtag = i + 1;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	} else {
 | 
					 | 
				
			||||||
		tmptag = selmon->pertag->prevtag;
 | 
					 | 
				
			||||||
		selmon->pertag->prevtag = selmon->pertag->curtag;
 | 
					 | 
				
			||||||
		selmon->pertag->curtag = tmptag;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	selmon->nmaster = selmon->pertag->nmasters[selmon->pertag->curtag];
 | 
					 | 
				
			||||||
	selmon->mfact = selmon->pertag->mfacts[selmon->pertag->curtag];
 | 
					 | 
				
			||||||
	selmon->sellt = selmon->pertag->sellts[selmon->pertag->curtag];
 | 
					 | 
				
			||||||
	selmon->lt[selmon->sellt] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt];
 | 
					 | 
				
			||||||
	selmon->lt[selmon->sellt^1] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt^1];
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if (selmon->showbar != selmon->pertag->showbars[selmon->pertag->curtag])
 | 
					 | 
				
			||||||
		togglebar(NULL);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	focus(NULL);
 | 
						focus(NULL);
 | 
				
			||||||
	arrange(selmon);
 | 
						arrange(selmon);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -2789,43 +2462,6 @@ systraytomon(Monitor *m) {
 | 
				
			|||||||
	return t;
 | 
						return t;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void
 | 
					 | 
				
			||||||
xinitvisual()
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	XVisualInfo *infos;
 | 
					 | 
				
			||||||
	XRenderPictFormat *fmt;
 | 
					 | 
				
			||||||
	int nitems;
 | 
					 | 
				
			||||||
	int i;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	XVisualInfo tpl = {
 | 
					 | 
				
			||||||
		.screen = screen,
 | 
					 | 
				
			||||||
		.depth = 32,
 | 
					 | 
				
			||||||
		.class = TrueColor
 | 
					 | 
				
			||||||
	};
 | 
					 | 
				
			||||||
	long masks = VisualScreenMask | VisualDepthMask | VisualClassMask;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	infos = XGetVisualInfo(dpy, masks, &tpl, &nitems);
 | 
					 | 
				
			||||||
	visual = NULL;
 | 
					 | 
				
			||||||
	for(i = 0; i < nitems; i ++) {
 | 
					 | 
				
			||||||
		fmt = XRenderFindVisualFormat(dpy, infos[i].visual);
 | 
					 | 
				
			||||||
		if (fmt->type == PictTypeDirect && fmt->direct.alphaMask) {
 | 
					 | 
				
			||||||
			visual = infos[i].visual;
 | 
					 | 
				
			||||||
			depth = infos[i].depth;
 | 
					 | 
				
			||||||
			cmap = XCreateColormap(dpy, root, visual, AllocNone);
 | 
					 | 
				
			||||||
			useargb = 1;
 | 
					 | 
				
			||||||
			break;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	XFree(infos);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if (! visual) {
 | 
					 | 
				
			||||||
		visual = DefaultVisual(dpy, screen);
 | 
					 | 
				
			||||||
		depth = DefaultDepth(dpy, screen);
 | 
					 | 
				
			||||||
		cmap = DefaultColormap(dpy, screen);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void
 | 
					void
 | 
				
			||||||
zoom(const Arg *arg)
 | 
					zoom(const Arg *arg)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
@@ -2863,65 +2499,3 @@ main(int argc, char *argv[])
 | 
				
			|||||||
	XCloseDisplay(dpy);
 | 
						XCloseDisplay(dpy);
 | 
				
			||||||
	return EXIT_SUCCESS;
 | 
						return EXIT_SUCCESS;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					 | 
				
			||||||
static void
 | 
					 | 
				
			||||||
bstack(Monitor *m) {
 | 
					 | 
				
			||||||
	int w, h, mh, mx, tx, ty, tw;
 | 
					 | 
				
			||||||
	unsigned int i, n;
 | 
					 | 
				
			||||||
	Client *c;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
 | 
					 | 
				
			||||||
	if (n == 0)
 | 
					 | 
				
			||||||
		return;
 | 
					 | 
				
			||||||
	if (n > m->nmaster) {
 | 
					 | 
				
			||||||
		mh = m->nmaster ? m->mfact * m->wh : 0;
 | 
					 | 
				
			||||||
		tw = m->ww / (n - m->nmaster);
 | 
					 | 
				
			||||||
		ty = m->wy + mh;
 | 
					 | 
				
			||||||
	} else {
 | 
					 | 
				
			||||||
		mh = m->wh;
 | 
					 | 
				
			||||||
		tw = m->ww;
 | 
					 | 
				
			||||||
		ty = m->wy;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	for (i = mx = 0, tx = m->wx, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) {
 | 
					 | 
				
			||||||
		if (i < m->nmaster) {
 | 
					 | 
				
			||||||
			w = (m->ww - mx) / (MIN(n, m->nmaster) - i);
 | 
					 | 
				
			||||||
			resize(c, m->wx + mx, m->wy, w - (2 * c->bw), mh - (2 * c->bw), 0);
 | 
					 | 
				
			||||||
			mx += WIDTH(c);
 | 
					 | 
				
			||||||
		} else {
 | 
					 | 
				
			||||||
			h = m->wh - mh;
 | 
					 | 
				
			||||||
			resize(c, tx, ty, tw - (2 * c->bw), h - (2 * c->bw), 0);
 | 
					 | 
				
			||||||
			if (tw != m->ww)
 | 
					 | 
				
			||||||
				tx += WIDTH(c);
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
static void
 | 
					 | 
				
			||||||
bstackhoriz(Monitor *m) {
 | 
					 | 
				
			||||||
	int w, mh, mx, tx, ty, th;
 | 
					 | 
				
			||||||
	unsigned int i, n;
 | 
					 | 
				
			||||||
	Client *c;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
 | 
					 | 
				
			||||||
	if (n == 0)
 | 
					 | 
				
			||||||
		return;
 | 
					 | 
				
			||||||
	if (n > m->nmaster) {
 | 
					 | 
				
			||||||
		mh = m->nmaster ? m->mfact * m->wh : 0;
 | 
					 | 
				
			||||||
		th = (m->wh - mh) / (n - m->nmaster);
 | 
					 | 
				
			||||||
		ty = m->wy + mh;
 | 
					 | 
				
			||||||
	} else {
 | 
					 | 
				
			||||||
		th = mh = m->wh;
 | 
					 | 
				
			||||||
		ty = m->wy;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	for (i = mx = 0, tx = m->wx, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) {
 | 
					 | 
				
			||||||
		if (i < m->nmaster) {
 | 
					 | 
				
			||||||
			w = (m->ww - mx) / (MIN(n, m->nmaster) - i);
 | 
					 | 
				
			||||||
			resize(c, m->wx + mx, m->wy, w - (2 * c->bw), mh - (2 * c->bw), 0);
 | 
					 | 
				
			||||||
			mx += WIDTH(c);
 | 
					 | 
				
			||||||
		} else {
 | 
					 | 
				
			||||||
			resize(c, tx, ty, m->ww - (2 * c->bw), th - (2 * c->bw), 0);
 | 
					 | 
				
			||||||
			if (th != m->wh)
 | 
					 | 
				
			||||||
				ty += HEIGHT(c);
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user