about summary refs log tree commit diff stats
path: root/config.def.h
diff options
context:
space:
mode:
authorAnselm R Garbe <garbeam@gmail.com>2008-06-14 10:38:18 +0100
committerAnselm R Garbe <garbeam@gmail.com>2008-06-14 10:38:18 +0100
commit1edf6a7866ebe219bfa81a1b289fa5c8d0cdfbee (patch)
treed85bf74383db0f873c7a4ff7e500c57efec6ecf2 /config.def.h
parent4db2f44277a29ad2c6c053846568667b27658f3f (diff)
downloaddwm-1edf6a7866ebe219bfa81a1b289fa5c8d0cdfbee.tar.gz
removed font and color definitions
Diffstat (limited to 'config.def.h')
-rw-r--r--config.def.h39
1 files changed, 21 insertions, 18 deletions
diff --git a/config.def.h b/config.def.h
index 1b2349c..49d2f1f 100644
--- a/config.def.h
+++ b/config.def.h
@@ -1,20 +1,20 @@
 /* See LICENSE file for copyright and license details. */
 
 /* appearance */
-#define FONT            "-*-terminus-medium-r-normal-*-14-*-*-*-*-*-*-*"
-#define NORMBORDERCOLOR "#cccccc"
-#define NORMBGCOLOR     "#cccccc"
-#define NORMFGCOLOR     "#000000"
-#define SELBORDERCOLOR  "#0066ff"
-#define SELBGCOLOR      "#0066ff"
-#define SELFGCOLOR      "#ffffff"
-static uint borderpx    = 1;        /* border pixel of windows */
-static uint snap        = 32;       /* snap pixel */
-static Bool showbar     = True;     /* False means no bar */
-static Bool topbar      = True;     /* False means bottom bar */
+static const char font[]            = "-*-terminus-medium-r-normal-*-14-*-*-*-*-*-*-*";
+static const char normbordercolor[] = "#cccccc";
+static const char normbgcolor[]     = "#cccccc";
+static const char normfgcolor[]     = "#000000";
+static const char selbordercolor[]  = "#0066ff";
+static const char selbgcolor[]      = "#0066ff";
+static const char selfgcolor[]      = "#ffffff";
+static uint borderpx                = 1;        /* border pixel of windows */
+static uint snap                    = 32;       /* snap pixel */
+static Bool showbar                 = True;     /* False means no bar */
+static Bool topbar                  = True;     /* False means bottom bar */
 
 #ifdef XINERAMA
-static uint xidx        = 0;        /* Xinerama screen index to use */
+static uint xidx                    = 0;        /* Xinerama screen index to use */
 #endif
 
 /* tagging */
@@ -45,12 +45,16 @@ static Layout layouts[] = {
 	{ MODKEY|ControlMask|ShiftMask, KEY,      toggletag,      {.ui = 1 << TAG} },
 
 /* helper for spawning shell commands in the pre dwm-5.0 fashion */
-#define SHCMD(cmd) { .v = (char*[]){ "/bin/sh", "-c", cmd, NULL } }
+#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
+
+/* commands */
+static const char *dmenucmd[] = { "dmenu_run", "-fn", font, "-nb", normbgcolor, "-nf", normfgcolor, "-sb", selbgcolor, "-sf", selfgcolor, NULL };
+static const char *termcmd[]  = { "uxterm", NULL };
 
 static Key keys[] = {
 	/* modifier                     key        function        argument */
-	{ MODKEY,                       XK_p,      spawn,          {.v = (char *[]){"dmenu_run", "-fn", FONT, "-nb", NORMBGCOLOR, "-nf", NORMFGCOLOR, "-sb", SELBGCOLOR, "-sf", SELFGCOLOR, NULL}} },
-	{ MODKEY|ShiftMask,             XK_Return, spawn,          {.v = (char *[]){"uxterm", NULL}} },
+	{ MODKEY,                       XK_p,      spawn,          {.v = dmenucmd } },
+	{ MODKEY|ShiftMask,             XK_Return, spawn,          {.v = termcmd } },
 	{ MODKEY,                       XK_b,      togglebar,      {0} },
 	{ MODKEY,                       XK_j,      focusstack,     {.i = +1 } },
 	{ MODKEY,                       XK_k,      focusstack,     {.i = -1 } },
@@ -89,15 +93,14 @@ static Button buttons[] = {
 	/* click                event mask      button          function        argument */
 	{ ClkLtSymbol,          0,              Button1,        togglelayout,   {0} },
 	{ ClkLtSymbol,          0,              Button3,        togglemax,      {0} },
-	{ ClkWinTitle,          0,              Button1,        movemouse,      {0} },
 	{ ClkWinTitle,          0,              Button2,        zoom,           {0} },
-	{ ClkWinTitle,          0,              Button3,        resizemouse,    {0} },
+	{ ClkStatusText,        0,              Button2,        spawn,          {.v = termcmd } },
 	{ ClkWinTitle,          0,              Button4,        focusstack,     {.i = +1 } },
 	{ ClkWinTitle,          0,              Button5,        focusstack,     {.i = -1 } },
 	{ ClkClientWin,         MODKEY,         Button1,        movemouse,      {0} },
 	{ ClkClientWin,         MODKEY,         Button2,        togglefloating, {0} },
 	{ ClkClientWin,         MODKEY,         Button3,        resizemouse,    {0} },
-	{ ClkRootWin,           Button1Mask,    Button3,        spawn,          {.v = (char *[]){"uxterm", NULL}} },
+	{ ClkRootWin,           Button1Mask,    Button3,        spawn,          {.v = termcmd } },
 	TAGBUTTONS(0)
 	TAGBUTTONS(1)
 	TAGBUTTONS(2)
href='/acidbong/suckless/dwm/blame/layout.c?h=4.3&id=b3b58c08e4e15c4dbdd04bae52300d1e8effed33'>^
29c26b8 ^













352cae4 ^
29c26b8 ^















352cae4 ^

















4cdbd52 ^
352cae4 ^
4cdbd52 ^
cdbc84b ^
4cdbd52 ^



cdbc84b ^












29c26b8 ^





4cdbd52 ^
4cdbd52 ^






5a03daf ^
4cdbd52 ^
6d5f67a ^
5a03daf ^
4cdbd52 ^
238dd5d ^
4cdbd52 ^









352cae4 ^
879241c ^

352cae4 ^
879241c ^






352cae4 ^
879241c ^
352cae4 ^
879241c ^







352cae4 ^


92105e7 ^
352cae4 ^













6d5f67a ^




















352cae4 ^

















1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251



                                                                    
 

                     


            
                                 

                                          
 

            


                                                          
                                                                     


                                                                   
                                                          







                                                                     
                                          
































                                                                         




            
                    













                                                                  
                    















                                                            

















                                                                       
                       
                         
               
                              



                             












                                                    





                                                                   
    






                       
                                                        
                                            
                                      
                                     
                                                    
                                                                        









                                                          
                    

                       
                         






                                                                  
                                                  
                               
                                    







                              


                    
                                                                                   













                                                                                    




















                                                                      

















                                                                     
/* (C)opyright MMVI-MMVII Anselm R. Garbe <garbeam at gmail dot com>
 * See LICENSE file for license details.
 */
#include "dwm.h"

unsigned int blw = 0;
Layout *lt = NULL;

/* static */

static unsigned int nlayouts = 0;
static unsigned int masterw = MASTERWIDTH;
static unsigned int nmaster = NMASTER;

static void
tile(void) {
	unsigned int i, n, nx, ny, nw, nh, mw, mh, tw, th;
	Client *c;

	for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next))
		n++;
	/* window geoms */
	mh = (n > nmaster) ? wah / nmaster : wah / (n > 0 ? n : 1);
	mw = (n > nmaster) ? (waw * masterw) / 1000 : waw;
	th = (n > nmaster) ? wah / (n - nmaster) : 0;
	tw = waw - mw;

	for(i = 0, c = clients; c; c = c->next)
		if(isvisible(c)) {
			if(c->isbanned)
				XMoveWindow(dpy, c->win, c->x, c->y);
			c->isbanned = False;
			if(c->isversatile)
				continue;
			c->ismax = False;
			nx = wax;
			ny = way;
			if(i < nmaster) {
				ny += i * mh;
				nw = mw - 2 * BORDERPX;
				nh = mh - 2 * BORDERPX;
			}
			else {  /* tile window */
				nx += mw;
				nw = tw - 2 * BORDERPX;
				if(th > 2 * BORDERPX) {
					ny += (i - nmaster) * th;
					nh = th - 2 * BORDERPX;
				}
				else /* fallback if th <= 2 * BORDERPX */
					nh = wah - 2 * BORDERPX;
			}
			resize(c, nx, ny, nw, nh, False);
			i++;
		}
		else {
			c->isbanned = True;
			XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
		}
	if(!sel || !isvisible(sel)) {
		for(c = stack; c && !isvisible(c); c = c->snext);
		focus(c);
	}
	restack();
}

LAYOUTS

/* extern */

void
focusnext(Arg arg) {
	Client *c;
   
	if(!sel)
		return;
	for(c = sel->next; c && !isvisible(c); c = c->next);
	if(!c)
		for(c = clients; c && !isvisible(c); c = c->next);
	if(c) {
		focus(c);
		restack();
	}
}

void
focusprev(Arg arg) {
	Client *c;

	if(!sel)
		return;
	for(c = sel->prev; c && !isvisible(c); c = c->prev);
	if(!c) {
		for(c = clients; c && c->next; c = c->next);
		for(; c && !isvisible(c); c = c->prev);
	}
	if(c) {
		focus(c);
		restack();
	}
}

void
incmasterw(Arg arg) {
	if(lt->arrange != tile)
		return;
	if(arg.i == 0)
		masterw = MASTERWIDTH;
	else {
		if(waw * (masterw + arg.i) / 1000 >= waw - 2 * BORDERPX
		|| waw * (masterw + arg.i) / 1000 <= 2 * BORDERPX)
			return;
		masterw += arg.i;
	}
	lt->arrange();
}

void
incnmaster(Arg arg) {
	if((lt->arrange != tile) || (nmaster + arg.i < 1)
	|| (wah / (nmaster + arg.i) <= 2 * BORDERPX))
		return;
	nmaster += arg.i;
	if(sel)
		lt->arrange();
	else
		drawstatus();
}

void
initlayouts(void) {
	unsigned int i, w;

	lt = &layout[0];
	nlayouts = sizeof layout / sizeof layout[0];
	for(blw = i = 0; i < nlayouts; i++) {
		w = textw(layout[i].symbol);
		if(w > blw)
			blw = w;
	}
}

Client *
nexttiled(Client *c) {
	for(; c && (c->isversatile || !isvisible(c)); c = c->next);
	return c;
}

void
restack(void) {
	Client *c;
	XEvent ev;

	drawstatus();
	if(!sel)
		return;
	if(sel->isversatile || lt->arrange == versatile)
		XRaiseWindow(dpy, sel->win);
	if(lt->arrange != versatile) {
		if(!sel->isversatile)
			XLowerWindow(dpy, sel->win);
		for(c = nexttiled(clients); c; c = nexttiled(c->next)) {
			if(c == sel)
				continue;
			XLowerWindow(dpy, c->win);
		}
	}
	XSync(dpy, False);
	while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
}

void
setlayout(Arg arg) {
	unsigned int i;

	if(arg.i == -1) {
		for(i = 0; i < nlayouts && lt != &layout[i]; i++);
		if(i == nlayouts - 1)
			lt = &layout[0];
		else
			lt = &layout[++i];
	}
	else {
		if(arg.i < 0 || arg.i >= nlayouts)
			return;
		lt = &layout[arg.i];
	}
	if(sel)
		lt->arrange();
	else
		drawstatus();
}

void
togglemax(Arg arg) {
	XEvent ev;

	if(!sel || (lt->arrange != versatile && !sel->isversatile) || sel->isfixed)
		return;
	if((sel->ismax = !sel->ismax)) {
		sel->rx = sel->x;
		sel->ry = sel->y;
		sel->rw = sel->w;
		sel->rh = sel->h;
		resize(sel, wax, way, waw - 2 * BORDERPX, wah - 2 * BORDERPX, True);
	}
	else
		resize(sel, sel->rx, sel->ry, sel->rw, sel->rh, True);
	while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
}

void
versatile(void) {
	Client *c;

	for(c = clients; c; c = c->next) {
		if(isvisible(c)) {
			if(c->isbanned)
				XMoveWindow(dpy, c->win, c->x, c->y);
			c->isbanned = False;
			resize(c, c->x, c->y, c->w, c->h, True);
		}
		else {
			c->isbanned = True;
			XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
		}
	}
	if(!sel || !isvisible(sel)) {
		for(c = stack; c && !isvisible(c); c = c->snext);
		focus(c);
	}
	restack();
}

void
zoom(Arg arg) {
	unsigned int n;
	Client *c;

	if(!sel || lt->arrange != tile || sel->isversatile)
		return;
	for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next))
		n++;
	if((c = sel) == nexttiled(clients))
		if(!(c = nexttiled(c->next)))
			return;
	detach(c);
	attach(c);
	focus(c);
	lt->arrange();
}