diff options
Diffstat (limited to '')
| -rw-r--r-- | Makefile | 2 | ||||
| -rw-r--r-- | config.anselm.h | 97 | ||||
| -rw-r--r-- | config.def.h | 34 | ||||
| -rw-r--r-- | dwm.c | 78 |
4 files changed, 115 insertions, 96 deletions
| @@ -35,7 +35,7 @@ clean: | |||
| 35 | dist: clean | 35 | dist: clean |
| 36 | @echo creating dist tarball | 36 | @echo creating dist tarball |
| 37 | @mkdir -p dwm-${VERSION} | 37 | @mkdir -p dwm-${VERSION} |
| 38 | @cp -R LICENSE Makefile README config.def.h config.mk \ | 38 | @cp -R LICENSE Makefile README config.*.h config.mk \ |
| 39 | dwm.1 ${SRC} dwm-${VERSION} | 39 | dwm.1 ${SRC} dwm-${VERSION} |
| 40 | @tar -cf dwm-${VERSION}.tar dwm-${VERSION} | 40 | @tar -cf dwm-${VERSION}.tar dwm-${VERSION} |
| 41 | @gzip dwm-${VERSION}.tar | 41 | @gzip dwm-${VERSION}.tar |
diff --git a/config.anselm.h b/config.anselm.h index e60a2c8..0e0d3be 100644 --- a/config.anselm.h +++ b/config.anselm.h | |||
| @@ -10,35 +10,6 @@ | |||
| 10 | #define SELBGCOLOR "#0066ff" | 10 | #define SELBGCOLOR "#0066ff" |
| 11 | #define SELFGCOLOR "#ffffff" | 11 | #define SELFGCOLOR "#ffffff" |
| 12 | 12 | ||
| 13 | /* bar position */ | ||
| 14 | #define BX 0 | ||
| 15 | #define BY 0 | ||
| 16 | #define BW 1280 | ||
| 17 | |||
| 18 | /* window area, including floating windows */ | ||
| 19 | #define WX 0 | ||
| 20 | #define WY bh | ||
| 21 | #define WW sw | ||
| 22 | #define WH sh - bh | ||
| 23 | |||
| 24 | /* master area */ | ||
| 25 | #define MX WX | ||
| 26 | #define MY bh | ||
| 27 | #define MW 1280 | ||
| 28 | #define MH 800 - bh | ||
| 29 | |||
| 30 | /* tile area, might be on a different screen */ | ||
| 31 | #define TX 1280 | ||
| 32 | #define TY 0 | ||
| 33 | #define TW 1680 | ||
| 34 | #define TH 1050 | ||
| 35 | |||
| 36 | /* monocle area, might be restricted to a specific screen */ | ||
| 37 | #define MOX MX | ||
| 38 | #define MOY MY | ||
| 39 | #define MOW MW | ||
| 40 | #define MOH MH | ||
| 41 | |||
| 42 | /* tagging */ | 13 | /* tagging */ |
| 43 | const char tags[][MAXTAGLEN] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" }; | 14 | const char tags[][MAXTAGLEN] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" }; |
| 44 | 15 | ||
| @@ -56,24 +27,78 @@ Rule rules[] = { | |||
| 56 | 27 | ||
| 57 | Layout layouts[] = { | 28 | Layout layouts[] = { |
| 58 | /* symbol function isfloating */ | 29 | /* symbol function isfloating */ |
| 59 | { "[]|", tileh, False }, /* first entry is default */ | 30 | { "[]=", tilev, False }, /* first entry is default */ |
| 60 | { "[]=", tilev, False }, | 31 | { "[]|", tileh, False }, |
| 61 | { "><>", floating, True }, | 32 | { "><>", floating, True }, |
| 62 | { "[M]", monocle, True }, | 33 | { "[M]", monocle, True }, |
| 63 | }; | 34 | }; |
| 64 | 35 | ||
| 36 | void | ||
| 37 | setanselmgeoms(void) { | ||
| 38 | |||
| 39 | /* screen dimensions */ | ||
| 40 | sx = 0; | ||
| 41 | sy = 0; | ||
| 42 | sw = DisplayWidth(dpy, screen); | ||
| 43 | sh = DisplayHeight(dpy, screen); | ||
| 44 | |||
| 45 | /* bar position */ | ||
| 46 | bx = sx; | ||
| 47 | by = sy; | ||
| 48 | bw = 1280; | ||
| 49 | bh = dc.font.height + 2; | ||
| 50 | |||
| 51 | /* window area */ | ||
| 52 | wx = sx; | ||
| 53 | wy = sy + bh; | ||
| 54 | ww = sw; | ||
| 55 | wh = sh - bh; | ||
| 56 | |||
| 57 | /* master area */ | ||
| 58 | mx = wx; | ||
| 59 | my = wy; | ||
| 60 | mw = 1280; | ||
| 61 | mh = 800; | ||
| 62 | |||
| 63 | /* tile area */ | ||
| 64 | tx = 1280; | ||
| 65 | ty = 0; | ||
| 66 | tw = ww - 1280; | ||
| 67 | th = wh; | ||
| 68 | |||
| 69 | /* monocle area */ | ||
| 70 | mox = mx; | ||
| 71 | moy = my; | ||
| 72 | mow = mw; | ||
| 73 | moh = mh; | ||
| 74 | |||
| 75 | if(dc.drawable != 0) | ||
| 76 | XFreePixmap(dpy, dc.drawable); | ||
| 77 | dc.drawable = XCreatePixmap(dpy, root, bw, bh, DefaultDepth(dpy, screen)); | ||
| 78 | XMoveResizeWindow(dpy, barwin, bx, by, bw, bh); | ||
| 79 | } | ||
| 80 | |||
| 81 | void | ||
| 82 | anselmgeoms(const char *arg) { | ||
| 83 | setgeoms = setanselmgeoms; | ||
| 84 | arrange(); | ||
| 85 | } | ||
| 86 | |||
| 87 | void | ||
| 88 | defgeoms(const char *arg) { | ||
| 89 | setgeoms = setdefaultgeoms; | ||
| 90 | arrange(); | ||
| 91 | } | ||
| 92 | |||
| 65 | /* key definitions */ | 93 | /* key definitions */ |
| 66 | #define MODKEY Mod1Mask | 94 | #define MODKEY Mod1Mask |
| 67 | Key keys[] = { | 95 | Key keys[] = { |
| 68 | /* modifier key function argument */ | 96 | /* modifier key function argument */ |
| 69 | #if ANSELM_OFFICE | ||
| 70 | { MODKEY, XK_p, spawn, | 97 | { MODKEY, XK_p, spawn, |
| 71 | "exec dmenu_run -fn '"FONT"' -nb '"NORMBGCOLOR"' -nf '"NORMFGCOLOR"' -sb '"SELBGCOLOR"' -sf '"SELFGCOLOR"' -x 0 -y 0 -w 1280" }, | 98 | "exec dmenu_run -fn '"FONT"' -nb '"NORMBGCOLOR"' -nf '"NORMFGCOLOR"' -sb '"SELBGCOLOR"' -sf '"SELFGCOLOR"' -x 0 -y 0 -w 1280" }, |
| 72 | #else | ||
| 73 | { MODKEY, XK_p, spawn, | ||
| 74 | "exec dmenu_run -fn '"FONT"' -nb '"NORMBGCOLOR"' -nf '"NORMFGCOLOR"' -sb '"SELBGCOLOR"' -sf '"SELFGCOLOR"'" }, | ||
| 75 | #endif | ||
| 76 | { MODKEY|ShiftMask, XK_Return, spawn, "exec uxterm" }, | 99 | { MODKEY|ShiftMask, XK_Return, spawn, "exec uxterm" }, |
| 100 | { MODKEY, XK_a, anselmgeoms, NULL }, | ||
| 101 | { MODKEY, XK_d, defgeoms, NULL }, | ||
| 77 | { MODKEY, XK_j, focusnext, NULL }, | 102 | { MODKEY, XK_j, focusnext, NULL }, |
| 78 | { MODKEY, XK_k, focusprev, NULL }, | 103 | { MODKEY, XK_k, focusprev, NULL }, |
| 79 | { MODKEY, XK_r, reapply, NULL }, | 104 | { MODKEY, XK_r, reapply, NULL }, |
diff --git a/config.def.h b/config.def.h index 4118d68..c1eedd4 100644 --- a/config.def.h +++ b/config.def.h | |||
| @@ -10,35 +10,6 @@ | |||
| 10 | #define SELBGCOLOR "#0066ff" | 10 | #define SELBGCOLOR "#0066ff" |
| 11 | #define SELFGCOLOR "#ffffff" | 11 | #define SELFGCOLOR "#ffffff" |
| 12 | 12 | ||
| 13 | /* bar position */ | ||
| 14 | #define BX sx | ||
| 15 | #define BY sy | ||
| 16 | #define BW sw | ||
| 17 | |||
| 18 | /* window area */ | ||
| 19 | #define WX 0 | ||
| 20 | #define WY bh | ||
| 21 | #define WW sw | ||
| 22 | #define WH sh - bh | ||
| 23 | |||
| 24 | /* master area */ | ||
| 25 | #define MX WX | ||
| 26 | #define MY WY | ||
| 27 | #define MW ((int)(((float)sw) * 0.6)) | ||
| 28 | #define MH WH | ||
| 29 | |||
| 30 | /* tile area, might be on a different screen */ | ||
| 31 | #define TX MX + MW | ||
| 32 | #define TY WY | ||
| 33 | #define TW WW - MW | ||
| 34 | #define TH WH | ||
| 35 | |||
| 36 | /* monocle area, might be restricted to a specific screen */ | ||
| 37 | #define MOX WX | ||
| 38 | #define MOY WY | ||
| 39 | #define MOW WW | ||
| 40 | #define MOH WH | ||
| 41 | |||
| 42 | /* tagging */ | 13 | /* tagging */ |
| 43 | const char tags[][MAXTAGLEN] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" }; | 14 | const char tags[][MAXTAGLEN] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" }; |
| 44 | 15 | ||
| @@ -66,13 +37,8 @@ Layout layouts[] = { | |||
| 66 | #define MODKEY Mod1Mask | 37 | #define MODKEY Mod1Mask |
| 67 | Key keys[] = { | 38 | Key keys[] = { |
| 68 | /* modifier key function argument */ | 39 | /* modifier key function argument */ |
| 69 | #if ANSELM_OFFICE | ||
| 70 | { MODKEY, XK_p, spawn, | ||
| 71 | "exec dmenu_run -fn '"FONT"' -nb '"NORMBGCOLOR"' -nf '"NORMFGCOLOR"' -sb '"SELBGCOLOR"' -sf '"SELFGCOLOR"' -x 0 -y 0 -w 1280" }, | ||
| 72 | #else | ||
| 73 | { MODKEY, XK_p, spawn, | 40 | { MODKEY, XK_p, spawn, |
| 74 | "exec dmenu_run -fn '"FONT"' -nb '"NORMBGCOLOR"' -nf '"NORMFGCOLOR"' -sb '"SELBGCOLOR"' -sf '"SELFGCOLOR"'" }, | 41 | "exec dmenu_run -fn '"FONT"' -nb '"NORMBGCOLOR"' -nf '"NORMFGCOLOR"' -sb '"SELBGCOLOR"' -sf '"SELFGCOLOR"'" }, |
| 75 | #endif | ||
| 76 | { MODKEY|ShiftMask, XK_Return, spawn, "exec uxterm" }, | 42 | { MODKEY|ShiftMask, XK_Return, spawn, "exec uxterm" }, |
| 77 | { MODKEY, XK_j, focusnext, NULL }, | 43 | { MODKEY, XK_j, focusnext, NULL }, |
| 78 | { MODKEY, XK_k, focusprev, NULL }, | 44 | { MODKEY, XK_k, focusprev, NULL }, |
| @@ -160,6 +160,7 @@ void restack(void); | |||
| 160 | void run(void); | 160 | void run(void); |
| 161 | void scan(void); | 161 | void scan(void); |
| 162 | void setclientstate(Client *c, long state); | 162 | void setclientstate(Client *c, long state); |
| 163 | void setdefaultgeoms(void); | ||
| 163 | void setlayout(const char *arg); | 164 | void setlayout(const char *arg); |
| 164 | void setup(void); | 165 | void setup(void); |
| 165 | void spawn(const char *arg); | 166 | void spawn(const char *arg); |
| @@ -220,6 +221,7 @@ Display *dpy; | |||
| 220 | DC dc = {0}; | 221 | DC dc = {0}; |
| 221 | Layout *lt = NULL; | 222 | Layout *lt = NULL; |
| 222 | Window root, barwin; | 223 | Window root, barwin; |
| 224 | void (*setgeoms)(void) = setdefaultgeoms; | ||
| 223 | 225 | ||
| 224 | /* configuration, allows nested code to access above variables */ | 226 | /* configuration, allows nested code to access above variables */ |
| 225 | #include "config.h" | 227 | #include "config.h" |
| @@ -404,11 +406,7 @@ configurenotify(XEvent *e) { | |||
| 404 | XConfigureEvent *ev = &e->xconfigure; | 406 | XConfigureEvent *ev = &e->xconfigure; |
| 405 | 407 | ||
| 406 | if(ev->window == root && (ev->width != sw || ev->height != sh)) { | 408 | if(ev->window == root && (ev->width != sw || ev->height != sh)) { |
| 407 | sw = ev->width; | 409 | setgeoms(); |
| 408 | sh = ev->height; | ||
| 409 | XFreePixmap(dpy, dc.drawable); | ||
| 410 | dc.drawable = XCreatePixmap(dpy, root, bw, bh, DefaultDepth(dpy, screen)); | ||
| 411 | XMoveResizeWindow(dpy, barwin, bx, by, bw, bh); | ||
| 412 | arrange(); | 410 | arrange(); |
| 413 | } | 411 | } |
| 414 | } | 412 | } |
| @@ -1379,6 +1377,51 @@ setclientstate(Client *c, long state) { | |||
| 1379 | } | 1377 | } |
| 1380 | 1378 | ||
| 1381 | void | 1379 | void |
| 1380 | setdefaultgeoms(void) { | ||
| 1381 | |||
| 1382 | /* screen dimensions */ | ||
| 1383 | sx = 0; | ||
| 1384 | sy = 0; | ||
| 1385 | sw = DisplayWidth(dpy, screen); | ||
| 1386 | sh = DisplayHeight(dpy, screen); | ||
| 1387 | |||
| 1388 | /* bar position */ | ||
| 1389 | bx = sx; | ||
| 1390 | by = sy; | ||
| 1391 | bw = sw; | ||
| 1392 | bh = dc.font.height + 2; | ||
| 1393 | |||
| 1394 | /* window area */ | ||
| 1395 | wx = sx; | ||
| 1396 | wy = sy + bh; | ||
| 1397 | ww = sw; | ||
| 1398 | wh = sh - bh; | ||
| 1399 | |||
| 1400 | /* master area */ | ||
| 1401 | mx = wx; | ||
| 1402 | my = wy; | ||
| 1403 | mw = ((float)sw) * 0.55; | ||
| 1404 | mh = wh; | ||
| 1405 | |||
| 1406 | /* tile area */ | ||
| 1407 | tx = wx; | ||
| 1408 | ty = wy; | ||
| 1409 | tw = ww - mw; | ||
| 1410 | th = wh; | ||
| 1411 | |||
| 1412 | /* monocle area */ | ||
| 1413 | mox = wx; | ||
| 1414 | moy = wy; | ||
| 1415 | mow = ww; | ||
| 1416 | moh = wh; | ||
| 1417 | |||
| 1418 | if(dc.drawable != 0) | ||
| 1419 | XFreePixmap(dpy, dc.drawable); | ||
| 1420 | dc.drawable = XCreatePixmap(dpy, root, bw, bh, DefaultDepth(dpy, screen)); | ||
| 1421 | XMoveResizeWindow(dpy, barwin, bx, by, bw, bh); | ||
| 1422 | } | ||
| 1423 | |||
| 1424 | void | ||
| 1382 | setlayout(const char *arg) { | 1425 | setlayout(const char *arg) { |
| 1383 | static Layout *revert = 0; | 1426 | static Layout *revert = 0; |
| 1384 | unsigned int i; | 1427 | unsigned int i; |
| @@ -1410,10 +1453,10 @@ setup(void) { | |||
| 1410 | /* init screen */ | 1453 | /* init screen */ |
| 1411 | screen = DefaultScreen(dpy); | 1454 | screen = DefaultScreen(dpy); |
| 1412 | root = RootWindow(dpy, screen); | 1455 | root = RootWindow(dpy, screen); |
| 1413 | sx = 0; | 1456 | initfont(FONT); |
| 1414 | sy = 0; | 1457 | |
| 1415 | sw = DisplayWidth(dpy, screen); | 1458 | /* apply default geometries */ |
| 1416 | sh = DisplayHeight(dpy, screen); | 1459 | setgeoms(); |
| 1417 | 1460 | ||
| 1418 | /* init atoms */ | 1461 | /* init atoms */ |
| 1419 | wmatom[WMProtocols] = XInternAtom(dpy, "WM_PROTOCOLS", False); | 1462 | wmatom[WMProtocols] = XInternAtom(dpy, "WM_PROTOCOLS", False); |
| @@ -1436,7 +1479,7 @@ setup(void) { | |||
| 1436 | dc.sel[ColBG] = getcolor(SELBGCOLOR); | 1479 | dc.sel[ColBG] = getcolor(SELBGCOLOR); |
| 1437 | dc.sel[ColFG] = getcolor(SELFGCOLOR); | 1480 | dc.sel[ColFG] = getcolor(SELFGCOLOR); |
| 1438 | initfont(FONT); | 1481 | initfont(FONT); |
| 1439 | dc.h = bh = dc.font.height + 2; | 1482 | dc.h = bh; |
| 1440 | dc.drawable = XCreatePixmap(dpy, root, DisplayWidth(dpy, screen), bh, DefaultDepth(dpy, screen)); | 1483 | dc.drawable = XCreatePixmap(dpy, root, DisplayWidth(dpy, screen), bh, DefaultDepth(dpy, screen)); |
| 1441 | dc.gc = XCreateGC(dpy, root, 0, 0); | 1484 | dc.gc = XCreateGC(dpy, root, 0, 0); |
| 1442 | XSetLineAttributes(dpy, dc.gc, 1, LineSolid, CapButt, JoinMiter); | 1485 | XSetLineAttributes(dpy, dc.gc, 1, LineSolid, CapButt, JoinMiter); |
| @@ -1451,21 +1494,6 @@ setup(void) { | |||
| 1451 | /* init layouts */ | 1494 | /* init layouts */ |
| 1452 | lt = &layouts[0]; | 1495 | lt = &layouts[0]; |
| 1453 | 1496 | ||
| 1454 | /* bar position */ | ||
| 1455 | bx = BX; by = BY; bw = BW; | ||
| 1456 | |||
| 1457 | /* window area */ | ||
| 1458 | wx = WX; wy = WY; ww = WW; wh = WH; | ||
| 1459 | |||
| 1460 | /* master area */ | ||
| 1461 | mx = MX; my = MY; mw = MW; mh = MH; | ||
| 1462 | |||
| 1463 | /* tile area */ | ||
| 1464 | tx = TX; ty = TY; tw = TW; th = TH; | ||
| 1465 | |||
| 1466 | /* monocle area */ | ||
| 1467 | mox = MOX; moy = MOY; mow = MOW; moh = MOH; | ||
| 1468 | |||
| 1469 | /* init bar */ | 1497 | /* init bar */ |
| 1470 | for(blw = i = 0; i < LENGTH(layouts); i++) { | 1498 | for(blw = i = 0; i < LENGTH(layouts); i++) { |
| 1471 | i = textw(layouts[i].symbol); | 1499 | i = textw(layouts[i].symbol); |
