Compare commits

...

142 Commits
2.0 ... 3.1

Author SHA1 Message Date
9715ba82aa removed erealloc (not used) 2007-01-16 11:35:56 +01:00
3c35b90dd3 removed unnecessary bx, by, bw variables 2007-01-16 11:33:42 +01:00
1d63030665 s/444/555/g - enlightened selected background 2007-01-16 11:28:17 +01:00
6a5b41203e removed firefox rule from default.h 2007-01-16 11:26:15 +01:00
fbd310972d applied new default colors 2007-01-16 11:25:10 +01:00
3059c9c507 applied sanders patch of my config 2007-01-16 11:12:34 +01:00
3b18f17d4d Jukka, thanks for being faster than me! 2007-01-15 19:01:57 +01:00
72faa1919e changed restack, to fix undrawed tag indicators 2007-01-15 12:07:18 +01:00
f8181f64e2 removed drawclient and drawall (they performed useless operations/consumed useless cpu cycles) 2007-01-15 12:04:25 +01:00
0045ad87df implemented new color scheme accordingly to Sanders proposal 2007-01-14 22:37:34 +01:00
ceea528eff removed mode label stuff 2007-01-14 22:32:26 +01:00
6c5dc7017c removed client title bar 2007-01-14 22:27:29 +01:00
ae0b4fdd92 added missing space 2007-01-12 21:56:01 +01:00
b3cea4d388 nah the last change feels bad 2007-01-12 13:06:15 +01:00
d296081321 changed incnmaster shortcuts in config.arg.h 2007-01-12 12:48:51 +01:00
177ed7e5de Added tag 3.0 for changeset 76b58d21ea98 2007-01-12 12:37:12 +01:00
f679125206 removing to allow nmaster=0 2007-01-12 12:15:06 +01:00
58beead14d this looks better now ;) 2007-01-11 16:38:45 +01:00
e1811c37ca switching to arabic tags 2007-01-11 16:03:06 +01:00
a24a6701c8 small fix of initial numlockmask value 2007-01-11 15:51:15 +01:00
d108cfa7fc allowing nmaster=0 (I think that's a straight idea) 2007-01-11 13:43:38 +01:00
92cb5ebb7c added Button{4,5} description to dwm.1 2007-01-10 12:56:49 +01:00
653826572d added comment to %u in config.default.h, added Button{4.5} support on mode label 2007-01-10 12:54:23 +01:00
5a5851bac2 reorganized 2007-01-08 17:36:56 +01:00
1d4a24dae0 implemented nmaster appearance in mode label (using %u) 2007-01-08 17:33:24 +01:00
a768ea93fd Added tag 2.9 for changeset 3a5910fac3cc 2007-01-08 13:01:37 +01:00
c95fe6e24b I received Sander's complain just in time ;) 2007-01-08 12:56:35 +01:00
c75168186b changed status fg 2007-01-08 12:43:10 +01:00
3a96c9a8d5 fofofo 2007-01-08 12:18:49 +01:00
1617b95598 extended default tags to 1-9 2007-01-08 12:12:02 +01:00
726ae5bf6d small grammar fix of dwm.1 2007-01-07 19:24:21 +01:00
3e11b38349 changed a term in dwm.1 2007-01-07 14:38:41 +01:00
16ed879524 using shorter tags, using mon instead of cert 2007-01-05 22:27:26 +01:00
20d7b5d058 roman numerals suck badly, reverting 2007-01-05 22:22:18 +01:00
11a08b9cfc switching to roman tags, I need more tags 2007-01-05 22:13:44 +01:00
c2b753d917 I inc/decrease on the fly, feels better 2007-01-05 22:03:09 +01:00
6c767072a3 allowing swap() for first master client 2007-01-05 22:00:15 +01:00
e9cfae7aba prevent pop() if first sel == nexttiled(clients) 2007-01-05 21:56:57 +01:00
7ac0de8350 removed swap(), implemented pop for everything 2007-01-05 21:55:43 +01:00
0b7c0f10ee preserving c1->snext and c2->snext in swap() as well. 2007-01-05 21:52:17 +01:00
51f6405b0d fixing some minor issues 2007-01-05 16:35:45 +01:00
6096f8a113 removed the term clients from dwm.1 2007-01-05 15:37:10 +01:00
d939f301fa adding some prevention that master clients get smaller than bh 2007-01-05 15:16:39 +01:00
8c4623da80 changed shortcuts to M-i and M-d 2007-01-05 15:11:01 +01:00
0faaba04a5 allowing zoom within master area as well 2007-01-05 15:08:25 +01:00
ec7a5ffff1 changed plus key to MODKEY-Shift-plus (US-layout restrictions ;) 2007-01-05 15:04:49 +01:00
98afb7b9d0 I prefer two master windows by default 2007-01-05 14:49:18 +01:00
06bae9dfb7 added MODKEY-{plus,minus} shortcuts (increasing/decreasing master clients) 2007-01-05 14:48:16 +01:00
0b80d1842d experimental version which allows master clients being increased/decreased 2007-01-05 12:50:39 +01:00
d7ec23a5db fixed comment of drawclient() 2007-01-04 16:45:28 +01:00
2cf8ef9520 switching bakc to my previous color favorit 2007-01-04 14:51:43 +01:00
184471b4bb renamed drawtitle into drawclient 2007-01-04 14:17:25 +01:00
21898c6049 using more thinkpad compliant colors 2007-01-02 16:29:01 +01:00
6a9300e815 changed arg's color scheme 2007-01-02 16:25:01 +01:00
ac24f132db corrections 2007-01-02 15:44:19 +01:00
cb4aa5bc35 next version will contain updated copyright notice 2007-01-02 15:37:58 +01:00
beac539f31 Added tag 2.8 for changeset 107719a9ce3bd0c79f9f1f626596eb338a276561 2007-01-02 14:53:02 +01:00
b5d297f02f fixed cleanup, using clients instead of sel 2007-01-02 14:40:18 +01:00
9056d7ea88 changed comment of updatesizehints 2007-01-02 12:28:02 +01:00
ebd17e4827 renamed updatesize into updatesizehints (thx to Sander for this hint) 2007-01-01 19:10:31 +01:00
7e59c89250 small simplification to dotile() (thx to Ross for this hint) 2006-12-20 12:07:05 +01:00
9e4e4d9022 migrated arg's config.h to new dmenu command line options 2006-12-19 11:38:08 +01:00
71fd06f843 added Solaris hints 2006-12-18 14:39:34 +01:00
58e6866d86 Added tag 2.7 for changeset 21951c0dfbae5af68ed77821a4d87253ee91803f 2006-12-14 08:50:49 +01:00
c7da124149 applied Sanders patch 2006-12-13 14:15:38 +01:00
21bd90d7d3 fixed man page, status bar displays EOF instead of "broken pipe" 2006-12-13 13:53:10 +01:00
c8f96b5b4c added the java odyssee to CAVEATS section 2006-12-13 13:42:17 +01:00
ded60365d4 removed Client->grav 2006-12-12 19:14:38 +01:00
629647dfee removed gravitate for the moment 2006-12-11 16:45:02 +01:00
4ca3d861f0 disabling configure() during resize 2006-12-11 09:42:16 +01:00
069e7a6e24 made gravitate effectless, waiting for complains ;) 2006-12-11 08:31:30 +01:00
ac6e34ea06 fixed diagnostic error message 2006-12-08 11:11:52 +01:00
a308b7507a removed the hardcoded fixed fallback, it is useless in non-Latin1 environments 2006-12-08 10:40:09 +01:00
630e7ff26f we don't use the term clients anymore, windows is the better term 2006-12-07 16:38:57 +01:00
3764ab471b Added tag 2.6 for changeset 5308dd22b6ee8e3218c81d9e7e4125f235bb5778 2006-12-07 14:55:29 +01:00
a3319c6f8e found compromise for fonts 2006-12-07 14:39:31 +01:00
66c699a701 nah, people should define 'fixed' to be compatible with their locale 2006-12-07 12:03:15 +01:00
aaf1e44da9 using a UTF-8 capable fixed font 2006-12-07 11:55:04 +01:00
1ef2307ec4 switching to uxterm again, I get kretze from this urxvt crap 2006-12-07 10:43:34 +01:00
d42c3ba2dc with this patch everything works fine for me 2006-12-07 10:02:46 +01:00
4b06155873 don't use Xlocale crap, let's use locale.h instead 2006-12-07 09:49:45 +01:00
857d825eeb using the portable Xmb+UTF-8 way of life, will see if this works well... 2006-12-07 09:47:55 +01:00
6b345353e3 improved the memory leak prevention 2006-12-06 11:19:06 +01:00
ab3b3a8f61 making terminus more explicit a regular font (otherwise olique font might be used in some setups like mine). 2006-12-05 14:21:18 +01:00
71b82fb1f6 also setting LC_CTYPE only 2006-12-05 13:31:29 +01:00
9bd9ea423e enforcing using fontsets even if they are incomplete for some encodings 2006-12-05 10:30:31 +01:00
99964398e7 Added tag 2.5.1 for changeset c7f84f23ec5aef29988dcdc4ec22a7352ee8f58e 2006-12-04 21:01:14 +01:00
7009ebfa69 hotfix of a serious crashing bug 2006-12-04 21:00:26 +01:00
760e23dd3a Added tag 2.5 for changeset dcbbfabc8ecc5f33a6cc950584de87da1a368045 2006-12-04 15:39:43 +01:00
c53d9d516a applied Manuel's regex patch 2006-12-03 11:21:25 +01:00
7739e6b466 made squares equally sized, and 1px bigger 2006-12-01 17:55:46 +01:00
4881857458 if client is focused, the emptysquare don't needs to be drawed 2006-12-01 17:51:05 +01:00
c73d5cb7b6 and the winner is 2006-12-01 17:45:27 +01:00
6458803d21 sander1 proposal 2006-12-01 17:36:37 +01:00
6e72d781f7 dood 2006-12-01 16:55:42 +01:00
4e926a9ef2 darkening the fg colors somewhat 2006-12-01 15:50:22 +01:00
4ba3cfaee9 less obtrusive indicator (only a top line) 2006-12-01 15:03:42 +01:00
e655e8a7d5 final2 indicator 2006-12-01 12:52:16 +01:00
c34e4e4b39 removing the -1 on final indicators, looks cleaner 2006-12-01 12:39:13 +01:00
a678ee6365 final indicators 2006-12-01 12:25:23 +01:00
49f0ee329d changed things like I described in last mail 2006-12-01 10:16:10 +01:00
0c9d9a3d94 improved tag indicator 2006-12-01 09:52:15 +01:00
89e1acb0bb removed viewall signature from dwm.h 2006-11-30 17:01:39 +01:00
c2ed26b711 next version will be 2.5 2006-11-30 15:51:26 +01:00
42fd392e05 removed viewall(), replaced with view(-1); added tag(-1) to tag a client with all tags (new key combo MODKEY-Shift-0) 2006-11-30 15:27:43 +01:00
e06447ee88 Added tag 2.4 for changeset 32b246925086910d63147483160281a91a47479f 2006-11-30 09:19:52 +01:00
683dabe5e6 extended dwm.1 with last change 2006-11-28 17:36:00 +01:00
3aff96177c togglefloat should only work in dotile mode (thanks to Sander for this hint) 2006-11-28 17:35:31 +01:00
0a915eba8f applied Alex Elide's tricky patch, thanks! 2006-11-27 17:51:50 +01:00
19dcbc5717 returning to old Key struct 2006-11-27 17:49:58 +01:00
d2a4952956 applied Szabolcs Nagy's patch (thank you!) 2006-11-27 17:46:02 +01:00
0c97b21b61 applied patch by Jukka 2006-11-27 17:30:06 +01:00
19390b1a91 changing Key.func into Key.func[NFUNCS], this allows sequences execution of functions per keypress (avoids implementing useless masterfunctions which call atomic ones) 2006-11-27 13:21:38 +01:00
8dc86051df added man page entry 2006-11-27 11:05:47 +01:00
46d5f9d1bf added togglefloat to hg tip (i consider this useful for some cases), using MODKEY-Shift-space as shortcut 2006-11-27 10:57:37 +01:00
35e96b8deb applied Jukka's patch preventing some cornercases and making the EOF error message correct 2006-11-27 10:29:47 +01:00
2210ea7e3b applied yet another proposal of Manuel 2006-11-26 15:43:16 +01:00
61a1910f91 applied Jukka's sizeof K&R compliance patch, applied Manuels' last-line printage proposal for stdin reading. 2006-11-26 14:26:53 +01:00
27ef73507b applied Jukka's stdinread patch 2006-11-26 13:31:36 +01:00
2b35fb643e next version will be 2.4 2006-11-25 19:26:31 +01:00
478f6f95f1 applied Manuels patch (thanks to Manuel!) 2006-11-25 19:26:16 +01:00
44411d2d48 small fix of man page 2006-11-24 17:02:41 +01:00
a2175cf71a Added tag 2.3 for changeset 719b37b37b0df829d7cf017ac70e353088fe5849 2006-11-24 15:46:32 +01:00
4606d218c3 using the term 'indicated' instead of 'higlighted' 2006-11-23 16:00:16 +01:00
d37d0f24e6 updated man page with the bottom right corner indicator 2006-11-23 15:59:16 +01:00
321e8d51ed fififif 2006-11-22 16:17:50 +01:00
78f4b51757 added a similiar patch to Daves solution to indicate if there are clients with a specific tag 2006-11-22 14:57:09 +01:00
7d168a2621 returning to old bar colorization behavior, like sander proposed for consistency reasons 2006-11-21 15:03:08 +01:00
931e712eac applied Gottox patches 2006-11-21 14:49:13 +01:00
4ec04209e0 using iso10646 explicitely in arg's config.h 2006-11-21 12:17:47 +01:00
82ddba88a2 Added tag 2.2 for changeset 7e92f58754ae6edb3225f26d754bd89c1ff458cf 2006-11-21 09:41:33 +01:00
52a8cc8d46 nah reverting to my prev style, that's really the best 2006-11-18 21:33:33 +01:00
d175df8aa3 applying aluminium style for arg's config.h 2006-11-18 21:26:53 +01:00
b003a35fde applied Gottox' windowarea patch 2006-11-16 14:40:57 +01:00
df1a0f9445 using a more blue-ish color... 2006-11-08 17:16:38 +01:00
5b07b85838 making the selected color more lightning 2006-11-08 17:10:51 +01:00
f320cd203b next release will be 2.2 2006-11-03 09:22:40 +01:00
f78c16f8c6 applied Jukkas patch 2006-11-03 08:29:39 +01:00
0c5f47e720 Added tag 2.1 for changeset a2c465098a3b972bbed00feda9804b6aae1e9531 2006-11-02 10:18:22 +01:00
4b5b3d90af renamed resizecol into resizemaster 2006-10-31 12:07:32 +01:00
2cce4b95cd applied Gottox patch to simplify the resizing of col, instead of resizing the current area, it only resizes the master area in the future (seems more predictable) 2006-10-31 12:06:38 +01:00
8e6eb52196 Added tag 2.0 for changeset 12deea36603da407e3f32640048846a3bd74a9ec 2006-10-31 09:02:42 +01:00
15 changed files with 357 additions and 422 deletions

12
.hgtags
View File

@ -18,3 +18,15 @@ ad3fa2d185426c51fd5deceae809770363f8d33c 1.6
d5ad819f2a66a40fa75dd2e44429f3bfc884d07b 1.7.1
c71952fa3c7ca848ec38a6923b5c6d0e18fff431 1.8
a5567a0d30112822db2627a04a2e7aa3b6c38148 1.9
12deea36603da407e3f32640048846a3bd74a9ec 2.0
a2c465098a3b972bbed00feda9804b6aae1e9531 2.1
7e92f58754ae6edb3225f26d754bd89c1ff458cf 2.2
719b37b37b0df829d7cf017ac70e353088fe5849 2.3
32b246925086910d63147483160281a91a47479f 2.4
dcbbfabc8ecc5f33a6cc950584de87da1a368045 2.5
c7f84f23ec5aef29988dcdc4ec22a7352ee8f58e 2.5.1
5308dd22b6ee8e3218c81d9e7e4125f235bb5778 2.6
21951c0dfbae5af68ed77821a4d87253ee91803f 2.7
107719a9ce3bd0c79f9f1f626596eb338a276561 2.8
3a5910fac3ccb522a98aeeba7af7008530b25092 2.9
76b58d21ea98257c05565a3b9c850b9b26a32968 3.0

View File

@ -1,7 +1,7 @@
MIT/X Consortium License
(C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
(C)opyright MMVI Sander van Dijk <a dot h dot vandijk at gmail dot com>
(C)opyright MMVI-MMVII Anselm R. Garbe <garbeam at gmail dot com>
(C)opyright MMVI-MMVII Sander van Dijk <a dot h dot vandijk at gmail dot com>
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),

View File

@ -1,5 +1,5 @@
# dwm - dynamic window manager
# (C)opyright MMVI Anselm R. Garbe
# (C)opyright MMVII Anselm R. Garbe
include config.mk

121
client.c
View File

@ -1,4 +1,4 @@
/* (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
/* (C)opyright MMVI-MMVII Anselm R. Garbe <garbeam at gmail dot com>
* See LICENSE file for license details.
*/
#include "dwm.h"
@ -60,12 +60,6 @@ xerrordummy(Display *dsply, XErrorEvent *ee) {
/* extern functions */
void
ban(Client *c) {
XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
XMoveWindow(dpy, c->twin, c->tx + 2 * sw, c->ty);
}
void
configure(Client *c) {
XEvent synev;
@ -96,7 +90,7 @@ focus(Client *c) {
sel = c;
if(old) {
grabbuttons(old, False);
drawtitle(old);
XSetWindowBorder(dpy, old->win, dc.norm[ColBorder]);
}
}
if(c) {
@ -104,11 +98,12 @@ focus(Client *c) {
c->snext = stack;
stack = c;
grabbuttons(c, True);
drawtitle(c);
XSetWindowBorder(dpy, c->win, dc.sel[ColBorder]);
XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime);
}
else
XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
drawstatus();
}
Client *
@ -121,68 +116,6 @@ getclient(Window w) {
return NULL;
}
Client *
getctitle(Window w) {
Client *c;
for(c = clients; c; c = c->next)
if(c->twin == w)
return c;
return NULL;
}
void
gravitate(Client *c, Bool invert) {
int dx = 0, dy = 0;
switch(c->grav) {
default:
break;
case StaticGravity:
case NorthWestGravity:
case NorthGravity:
case NorthEastGravity:
dy = c->border;
break;
case EastGravity:
case CenterGravity:
case WestGravity:
dy = -(c->h / 2) + c->border;
break;
case SouthEastGravity:
case SouthGravity:
case SouthWestGravity:
dy = -(c->h);
break;
}
switch (c->grav) {
default:
break;
case StaticGravity:
case NorthWestGravity:
case WestGravity:
case SouthWestGravity:
dx = c->border;
break;
case NorthGravity:
case CenterGravity:
case SouthGravity:
dx = -(c->w / 2) + c->border;
break;
case NorthEastGravity:
case EastGravity:
case SouthEastGravity:
dx = -(c->w + c->border);
break;
}
if(invert) {
dx = -dx;
dy = -dy;
}
c->x += dx;
c->y += dy;
}
void
killclient(Arg *arg) {
if(!sel)
@ -197,18 +130,16 @@ void
manage(Window w, XWindowAttributes *wa) {
Client *c;
Window trans;
XSetWindowAttributes twa;
c = emallocz(sizeof(Client));
c->tags = emallocz(ntags * sizeof(Bool));
c->win = w;
c->border = 0;
c->x = c->tx = wa->x;
c->y = c->ty = wa->y;
c->w = c->tw = wa->width;
c->x = wa->x;
c->y = wa->y;
c->w = wa->width;
c->h = wa->height;
c->th = bh;
updatesize(c);
updatesizehints(c);
if(c->x + c->w + 2 * BORDERPX > sw)
c->x = sw - c->w - 2 * BORDERPX;
if(c->x < sx)
@ -221,27 +152,18 @@ manage(Window w, XWindowAttributes *wa) {
XSelectInput(dpy, c->win,
StructureNotifyMask | PropertyChangeMask | EnterWindowMask);
XGetTransientForHint(dpy, c->win, &trans);
twa.override_redirect = 1;
twa.background_pixmap = ParentRelative;
twa.event_mask = ExposureMask | EnterWindowMask;
c->twin = XCreateWindow(dpy, root, c->tx, c->ty, c->tw, c->th,
0, DefaultDepth(dpy, screen), CopyFromParent,
DefaultVisual(dpy, screen),
CWOverrideRedirect | CWBackPixmap | CWEventMask, &twa);
grabbuttons(c, False);
updatetitle(c);
settags(c, getclient(trans));
if(!c->isfloat)
c->isfloat = trans || c->isfixed;
resizetitle(c);
if(clients)
clients->prev = c;
c->next = clients;
c->snext = stack;
stack = clients = c;
ban(c);
XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
XMapWindow(dpy, c->win);
XMapWindow(dpy, c->twin);
if(isvisible(c))
focus(c);
arrange();
@ -280,7 +202,6 @@ resize(Client *c, Bool sizehints, Corner sticky) {
c->x = sw - c->w;
if(c->y > sh)
c->y = sh - c->h;
resizetitle(c);
wc.x = c->x;
wc.y = c->y;
wc.width = c->w;
@ -295,20 +216,7 @@ resize(Client *c, Bool sizehints, Corner sticky) {
}
void
resizetitle(Client *c) {
c->tw = textw(c->name);
if(c->tw > c->w)
c->tw = c->w + 2 * BORDERPX;
c->tx = c->x + c->w - c->tw + 2 * BORDERPX;
c->ty = c->y;
if(isvisible(c))
XMoveResizeWindow(dpy, c->twin, c->tx, c->ty, c->tw, c->th);
else
XMoveResizeWindow(dpy, c->twin, c->tx + 2 * sw, c->ty, c->tw, c->th);
}
void
updatesize(Client *c) {
updatesizehints(Client *c) {
long msize;
XSizeHints size;
@ -341,10 +249,6 @@ updatesize(Client *c) {
c->minw = c->minh = 0;
c->isfixed = (c->maxw && c->minw && c->maxh && c->minh &&
c->maxw == c->minw && c->maxh == c->minh);
if(c->flags & PWinGravity)
c->grav = size.win_gravity;
else
c->grav = NorthWestGravity;
}
void
@ -361,12 +265,12 @@ updatetitle(Client *c) {
if(!name.nitems)
return;
if(name.encoding == XA_STRING)
strncpy(c->name, (char *)name.value, sizeof(c->name));
strncpy(c->name, (char *)name.value, sizeof c->name);
else {
if(XmbTextPropertyToTextList(dpy, &name, &list, &n) >= Success
&& n > 0 && *list)
{
strncpy(c->name, *list, sizeof(c->name));
strncpy(c->name, *list, sizeof c->name);
XFreeStringList(list);
}
}
@ -387,7 +291,6 @@ unmanage(Client *c) {
focus(nc);
}
XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
XDestroyWindow(dpy, c->twin);
free(c->tags);
free(c);
XSync(dpy, False);

View File

@ -1,66 +1,91 @@
/* (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
/* (C)opyright MMVI-MMVII Anselm R. Garbe <garbeam at gmail dot com>
* See LICENSE file for license details.
*/
#define TAGS \
const char *tags[] = { "dev", "work", "net", "fnord", NULL };
const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9", NULL };
#define DEFMODE dotile /* dofloat */
#define FLOATSYMBOL "><>"
#define TILESYMBOL "[]="
#define FONT "-*-terminus-medium-*-*-*-14-*-*-*-*-*-*-*"
#define NORMBGCOLOR "#333333"
#define NORMFGCOLOR "#dddddd"
#define SELBGCOLOR "#333366"
#define SELFGCOLOR "#eeeeee"
#define STATUSBGCOLOR "#222222"
#define STATUSFGCOLOR "#9999cc"
#define FONT "-*-terminus-medium-r-*-*-14-*-*-*-*-*-*-*"
#define NORMBORDERCOLOR "#333"
#define NORMBGCOLOR "#222"
#define NORMFGCOLOR "#ccc"
#define SELBORDERCOLOR "#9cf"
#define SELBGCOLOR "#555"
#define SELFGCOLOR "#fff"
#define MASTER 600 /* per thousand */
#define MASTER 600 /* per thousand */
#define MODKEY Mod1Mask
#define SNAP 40 /* pixel */
#define NMASTER 1 /* clients in master area */
#define SNAP 40 /* pixel */
#define KEYS \
static Key key[] = { \
/* modifier key function arguments */ \
/* modifier key function argument */ \
{ MODKEY|ShiftMask, XK_Return, spawn, \
{ .cmd = "exec urxvtc -tr -bg black -fg '#eeeeee' -cr '#eeeeee' +sb -fn '"FONT"'" } }, \
{ .cmd = "exec uxterm -bg '#222' -fg '#eee' -cr '#eee' +sb -fn '"FONT"'" } }, \
{ MODKEY, XK_p, spawn, \
{ .cmd = "exe=\"$(lsx `echo $PATH | sed 's/:/ /g'` | sort -u " \
" | dmenu -font '"FONT"' -normbg '"NORMBGCOLOR"' -normfg '"NORMFGCOLOR"' " \
"-selbg '"SELBGCOLOR"' -selfg '"SELFGCOLOR"')\" && exec $exe" } }, \
" | dmenu -fn '"FONT"' -nb '"NORMBGCOLOR"' -nf '"NORMFGCOLOR"' " \
"-sb '"SELBGCOLOR"' -sf '"SELFGCOLOR"')\" && exec $exe" } }, \
{ MODKEY, XK_j, focusnext, { 0 } }, \
{ MODKEY, XK_k, focusprev, { 0 } }, \
{ MODKEY, XK_Return, zoom, { 0 } }, \
{ MODKEY, XK_g, resizecol, { .i = 15 } }, \
{ MODKEY, XK_s, resizecol, { .i = -15 } }, \
{ MODKEY, XK_g, resizemaster, { .i = 15 } }, \
{ MODKEY, XK_s, resizemaster, { .i = -15 } }, \
{ MODKEY, XK_i, incnmaster, { .i = 1 } }, \
{ MODKEY, XK_d, incnmaster, { .i = -1 } }, \
{ MODKEY|ShiftMask, XK_0, tag, { .i = -1 } }, \
{ MODKEY|ShiftMask, XK_1, tag, { .i = 0 } }, \
{ MODKEY|ShiftMask, XK_2, tag, { .i = 1 } }, \
{ MODKEY|ShiftMask, XK_3, tag, { .i = 2 } }, \
{ MODKEY|ShiftMask, XK_4, tag, { .i = 3 } }, \
{ MODKEY|ShiftMask, XK_5, tag, { .i = 4 } }, \
{ MODKEY|ShiftMask, XK_6, tag, { .i = 5 } }, \
{ MODKEY|ShiftMask, XK_7, tag, { .i = 6 } }, \
{ MODKEY|ShiftMask, XK_8, tag, { .i = 7 } }, \
{ MODKEY|ShiftMask, XK_9, tag, { .i = 8 } }, \
{ MODKEY|ControlMask|ShiftMask, XK_1, toggletag, { .i = 0 } }, \
{ MODKEY|ControlMask|ShiftMask, XK_2, toggletag, { .i = 1 } }, \
{ MODKEY|ControlMask|ShiftMask, XK_3, toggletag, { .i = 2 } }, \
{ MODKEY|ControlMask|ShiftMask, XK_4, toggletag, { .i = 3 } }, \
{ MODKEY|ControlMask|ShiftMask, XK_5, toggletag, { .i = 4 } }, \
{ MODKEY|ControlMask|ShiftMask, XK_6, toggletag, { .i = 5 } }, \
{ MODKEY|ControlMask|ShiftMask, XK_7, toggletag, { .i = 6 } }, \
{ MODKEY|ControlMask|ShiftMask, XK_8, toggletag, { .i = 7 } }, \
{ MODKEY|ControlMask|ShiftMask, XK_9, toggletag, { .i = 8 } }, \
{ MODKEY|ShiftMask, XK_c, killclient, { 0 } }, \
{ MODKEY, XK_space, togglemode, { 0 } }, \
{ MODKEY, XK_0, viewall, { 0 } }, \
{ MODKEY|ShiftMask, XK_space, togglefloat, { 0 } }, \
{ MODKEY, XK_0, view, { .i = -1 } }, \
{ MODKEY, XK_1, view, { .i = 0 } }, \
{ MODKEY, XK_2, view, { .i = 1 } }, \
{ MODKEY, XK_3, view, { .i = 2 } }, \
{ MODKEY, XK_4, view, { .i = 3 } }, \
{ MODKEY, XK_5, view, { .i = 4 } }, \
{ MODKEY, XK_6, view, { .i = 5 } }, \
{ MODKEY, XK_7, view, { .i = 6 } }, \
{ MODKEY, XK_8, view, { .i = 7 } }, \
{ MODKEY, XK_9, view, { .i = 8 } }, \
{ MODKEY|ControlMask, XK_1, toggleview, { .i = 0 } }, \
{ MODKEY|ControlMask, XK_2, toggleview, { .i = 1 } }, \
{ MODKEY|ControlMask, XK_3, toggleview, { .i = 2 } }, \
{ MODKEY|ControlMask, XK_4, toggleview, { .i = 3 } }, \
{ MODKEY|ControlMask, XK_5, toggleview, { .i = 4 } }, \
{ MODKEY|ControlMask, XK_6, toggleview, { .i = 5 } }, \
{ MODKEY|ControlMask, XK_7, toggleview, { .i = 6 } }, \
{ MODKEY|ControlMask, XK_8, toggleview, { .i = 7 } }, \
{ MODKEY|ControlMask, XK_9, toggleview, { .i = 8 } }, \
{ MODKEY|ShiftMask, XK_q, quit, { 0 } }, \
};
#define RULES \
static Rule rule[] = { \
/* class:instance:title regex tags regex isfloat */ \
{ "Firefox.*", "net", False }, \
{ "Firefox.*", "3", False }, \
{ "Gimp.*", NULL, True }, \
{ "MPlayer.*", NULL, True }, \
{ "Acroread.*", NULL, True }, \

View File

@ -1,58 +1,79 @@
/* (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
/* (C)opyright MMVI-MMVII Anselm R. Garbe <garbeam at gmail dot com>
* See LICENSE file for license details.
*/
#define TAGS \
const char *tags[] = { "1", "2", "3", "4", "5", NULL };
const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9", NULL };
#define DEFMODE dotile /* dofloat */
#define DEFMODE dotile /* dofloat */
#define FLOATSYMBOL "><>"
#define TILESYMBOL "[]="
#define FONT "fixed"
#define NORMBGCOLOR "#333366"
#define NORMFGCOLOR "#cccccc"
#define SELBGCOLOR "#666699"
#define SELFGCOLOR "#eeeeee"
#define STATUSBGCOLOR "#dddddd"
#define STATUSFGCOLOR "#222222"
#define FONT "-*-fixed-medium-r-normal-*-13-*-*-*-*-*-*-*"
#define NORMBORDERCOLOR "#dddddd"
#define NORMBGCOLOR "#eeeeee"
#define NORMFGCOLOR "#222222"
#define SELBORDERCOLOR "#ff0000"
#define SELBGCOLOR "#006699"
#define SELFGCOLOR "#ffffff"
#define MASTER 600 /* per thousand */
#define MASTER 600 /* per thousand */
#define MODKEY Mod1Mask
#define SNAP 20 /* pixel */
#define NMASTER 1 /* clients in master area */
#define SNAP 20 /* pixel */
#define KEYS \
static Key key[] = { \
/* modifier key function arguments */ \
/* modifier key function argument */ \
{ MODKEY|ShiftMask, XK_Return, spawn, { .cmd = "exec xterm" } }, \
{ MODKEY, XK_Tab, focusnext, { 0 } }, \
{ MODKEY|ShiftMask, XK_Tab, focusprev, { 0 } }, \
{ MODKEY, XK_Return, zoom, { 0 } }, \
{ MODKEY, XK_g, resizecol, { .i = 15 } }, \
{ MODKEY, XK_s, resizecol, { .i = -15 } }, \
{ MODKEY, XK_g, resizemaster, { .i = 15 } }, \
{ MODKEY, XK_s, resizemaster, { .i = -15 } }, \
{ MODKEY, XK_i, incnmaster, { .i = 1 } }, \
{ MODKEY, XK_d, incnmaster, { .i = -1 } }, \
{ MODKEY|ShiftMask, XK_0, tag, { .i = -1 } }, \
{ MODKEY|ShiftMask, XK_1, tag, { .i = 0 } }, \
{ MODKEY|ShiftMask, XK_2, tag, { .i = 1 } }, \
{ MODKEY|ShiftMask, XK_3, tag, { .i = 2 } }, \
{ MODKEY|ShiftMask, XK_4, tag, { .i = 3 } }, \
{ MODKEY|ShiftMask, XK_5, tag, { .i = 4 } }, \
{ MODKEY|ShiftMask, XK_6, tag, { .i = 5 } }, \
{ MODKEY|ShiftMask, XK_7, tag, { .i = 6 } }, \
{ MODKEY|ShiftMask, XK_8, tag, { .i = 7 } }, \
{ MODKEY|ShiftMask, XK_9, tag, { .i = 8 } }, \
{ MODKEY|ControlMask|ShiftMask, XK_1, toggletag, { .i = 0 } }, \
{ MODKEY|ControlMask|ShiftMask, XK_2, toggletag, { .i = 1 } }, \
{ MODKEY|ControlMask|ShiftMask, XK_3, toggletag, { .i = 2 } }, \
{ MODKEY|ControlMask|ShiftMask, XK_4, toggletag, { .i = 3 } }, \
{ MODKEY|ControlMask|ShiftMask, XK_5, toggletag, { .i = 4 } }, \
{ MODKEY|ControlMask|ShiftMask, XK_6, toggletag, { .i = 5 } }, \
{ MODKEY|ControlMask|ShiftMask, XK_7, toggletag, { .i = 6 } }, \
{ MODKEY|ControlMask|ShiftMask, XK_8, toggletag, { .i = 7 } }, \
{ MODKEY|ControlMask|ShiftMask, XK_9, toggletag, { .i = 8 } }, \
{ MODKEY|ShiftMask, XK_c, killclient, { 0 } }, \
{ MODKEY, XK_space, togglemode, { 0 } }, \
{ MODKEY, XK_0, viewall, { 0 } }, \
{ MODKEY|ShiftMask, XK_space, togglefloat, { 0 } }, \
{ MODKEY, XK_0, view, { .i = -1 } }, \
{ MODKEY, XK_1, view, { .i = 0 } }, \
{ MODKEY, XK_2, view, { .i = 1 } }, \
{ MODKEY, XK_3, view, { .i = 2 } }, \
{ MODKEY, XK_4, view, { .i = 3 } }, \
{ MODKEY, XK_5, view, { .i = 4 } }, \
{ MODKEY, XK_6, view, { .i = 5 } }, \
{ MODKEY, XK_7, view, { .i = 6 } }, \
{ MODKEY, XK_8, view, { .i = 7 } }, \
{ MODKEY, XK_9, view, { .i = 8 } }, \
{ MODKEY|ControlMask, XK_1, toggleview, { .i = 0 } }, \
{ MODKEY|ControlMask, XK_2, toggleview, { .i = 1 } }, \
{ MODKEY|ControlMask, XK_3, toggleview, { .i = 2 } }, \
{ MODKEY|ControlMask, XK_4, toggleview, { .i = 3 } }, \
{ MODKEY|ControlMask, XK_5, toggleview, { .i = 4 } }, \
{ MODKEY|ControlMask, XK_6, toggleview, { .i = 5 } }, \
{ MODKEY|ControlMask, XK_7, toggleview, { .i = 6 } }, \
{ MODKEY|ControlMask, XK_8, toggleview, { .i = 7 } }, \
{ MODKEY|ControlMask, XK_9, toggleview, { .i = 8 } }, \
{ MODKEY|ShiftMask, XK_q, quit, { 0 } }, \
};
@ -61,6 +82,5 @@ static Key key[] = { \
#define RULES \
static Rule rule[] = { \
/* class:instance:title regex tags regex isfloat */ \
{ "Firefox.*", "2", False }, \
{ "Gimp.*", NULL, True }, \
};

View File

@ -1,5 +1,5 @@
# dwm version
VERSION = 2.0
VERSION = 3.1
# Customize below to fit your system
@ -20,6 +20,11 @@ LDFLAGS = ${LIBS}
#CFLAGS = -g -Wall -O2 ${INCS} -DVERSION=\"${VERSION}\"
#LDFLAGS = -g ${LIBS}
# Solaris
#CFLAGS = -fast ${INCS} -DVERSION=\"${VERSION}\"
#LDFLAGS = ${LIBS}
#CFLAGS += -xtarget=ultra
# compiler and linker
CC = cc
LD = ${CC}

101
draw.c
View File

@ -1,13 +1,22 @@
/* (C)opyright MMIV-MMVI Anselm R. Garbe <garbeam at gmail dot com>
/* (C)opyright MMIV-MMVII Anselm R. Garbe <garbeam at gmail dot com>
* See LICENSE file for license details.
*/
#include "dwm.h"
#include <stdio.h>
#include <string.h>
#include <X11/Xlocale.h>
/* static */
static Bool
isoccupied(unsigned int t)
{
Client *c;
for(c = clients; c; c = c->next)
if(c->tags[t])
return True;
return False;
}
static unsigned int
textnw(const char *text, unsigned int len) {
XRectangle r;
@ -20,12 +29,13 @@ textnw(const char *text, unsigned int len) {
}
static void
drawtext(const char *text, unsigned long col[ColLast], Bool highlight) {
drawtext(const char *text, unsigned long col[ColLast], Bool filledsquare, Bool emptysquare) {
int x, y, w, h;
static char buf[256];
unsigned int len, olen;
XGCValues gcv;
XRectangle r = { dc.x, dc.y, dc.w, dc.h };
XPoint pt[5];
XSetForeground(dpy, dc.gc, col[ColBG]);
XFillRectangles(dpy, dc.drawable, dc.gc, &r, 1);
@ -33,8 +43,8 @@ drawtext(const char *text, unsigned long col[ColLast], Bool highlight) {
return;
w = 0;
olen = len = strlen(text);
if(len >= sizeof(buf))
len = sizeof(buf) - 1;
if(len >= sizeof buf)
len = sizeof buf - 1;
memcpy(buf, text, len);
buf[len] = 0;
h = dc.font.ascent + dc.font.descent;
@ -63,25 +73,30 @@ drawtext(const char *text, unsigned long col[ColLast], Bool highlight) {
XChangeGC(dpy, dc.gc, GCForeground | GCFont, &gcv);
XDrawString(dpy, dc.drawable, dc.gc, x, y, buf, len);
}
if(highlight) {
r.x = dc.x + 2;
r.y = dc.y + 2;
r.width = r.height = (h + 2) / 4;
x = (h + 2) / 4;
if(filledsquare) {
r.x = dc.x + 1;
r.y = dc.y + 1;
r.width = r.height = x + 1;
XFillRectangles(dpy, dc.drawable, dc.gc, &r, 1);
}
else if(emptysquare) {
pt[0].x = dc.x + 1;
pt[0].y = dc.y + 1;
pt[1].x = x;
pt[1].y = 0;
pt[2].x = 0;
pt[2].y = x;
pt[3].x = -x;
pt[3].y = 0;
pt[4].x = 0;
pt[4].y = -x;
XDrawLines(dpy, dc.drawable, dc.gc, pt, 5, CoordModePrevious);
}
}
/* extern */
void
drawall(void) {
Client *c;
for(c = clients; c; c = getnext(c->next))
drawtitle(c);
drawstatus();
}
void
drawstatus(void) {
int i, x;
@ -90,46 +105,26 @@ drawstatus(void) {
for(i = 0; i < ntags; i++) {
dc.w = textw(tags[i]);
if(seltag[i])
drawtext(tags[i], dc.sel, sel && sel->tags[i]);
drawtext(tags[i], dc.sel, sel && sel->tags[i], isoccupied(i));
else
drawtext(tags[i], dc.norm, sel && sel->tags[i]);
drawtext(tags[i], dc.norm, sel && sel->tags[i], isoccupied(i));
dc.x += dc.w;
}
dc.w = bmw;
drawtext(arrange == dofloat ? FLOATSYMBOL : TILESYMBOL, dc.status, False);
drawtext(arrange == dofloat ? FLOATSYMBOL : TILESYMBOL, dc.norm, False, False);
x = dc.x + dc.w;
dc.w = textw(stext);
dc.x = bx + bw - dc.w;
dc.x = sw - dc.w;
if(dc.x < x) {
dc.x = x;
dc.w = bw - x;
dc.w = sw - x;
}
drawtext(stext, dc.status, False);
drawtext(stext, dc.norm, False, False);
if((dc.w = dc.x - x) > bh) {
dc.x = x;
if(sel)
drawtext(sel->name, dc.sel, False);
else
drawtext(NULL, dc.norm, False);
drawtext(sel ? sel->name : NULL, sel ? dc.sel : dc.norm, False, False);
}
XCopyArea(dpy, dc.drawable, barwin, dc.gc, 0, 0, bw, bh, 0, 0);
XSync(dpy, False);
}
void
drawtitle(Client *c) {
if(c == sel && issel) {
drawstatus();
XUnmapWindow(dpy, c->twin);
XSetWindowBorder(dpy, c->win, dc.sel[ColBG]);
return;
}
XSetWindowBorder(dpy, c->win, dc.norm[ColBG]);
XMapWindow(dpy, c->twin);
dc.x = dc.y = 0;
dc.w = c->tw;
drawtext(c->name, dc.norm, False);
XCopyArea(dpy, dc.drawable, c->twin, dc.gc, 0, 0, c->tw, c->th, 0, 0);
XCopyArea(dpy, dc.drawable, barwin, dc.gc, 0, 0, sw, bh, 0, 0);
XSync(dpy, False);
}
@ -145,11 +140,10 @@ getcolor(const char *colstr) {
void
setfont(const char *fontstr) {
char **missing, *def;
char *def, **missing;
int i, n;
missing = NULL;
setlocale(LC_ALL, "");
if(dc.font.set)
XFreeFontSet(dpy, dc.font.set);
dc.font.set = XCreateFontSet(dpy, fontstr, &missing, &n, &def);
@ -157,10 +151,6 @@ setfont(const char *fontstr) {
while(n--)
fprintf(stderr, "missing fontset: %s\n", missing[n]);
XFreeStringList(missing);
if(dc.font.set) {
XFreeFontSet(dpy, dc.font.set);
dc.font.set = NULL;
}
}
if(dc.font.set) {
XFontSetExtents *font_extents;
@ -181,11 +171,8 @@ setfont(const char *fontstr) {
if(dc.font.xfont)
XFreeFont(dpy, dc.font.xfont);
dc.font.xfont = NULL;
dc.font.xfont = XLoadQueryFont(dpy, fontstr);
if (!dc.font.xfont)
dc.font.xfont = XLoadQueryFont(dpy, "fixed");
if (!dc.font.xfont)
eprint("error, cannot init 'fixed' font\n");
if(!(dc.font.xfont = XLoadQueryFont(dpy, fontstr)))
eprint("error, cannot load font: '%s'\n", fontstr);
dc.font.ascent = dc.font.xfont->ascent;
dc.font.descent = dc.font.xfont->descent;
}

47
dwm.1
View File

@ -10,21 +10,22 @@ floating modes. Either mode can be applied dynamically, optimizing the
environment for the application in use and the task performed.
.P
In tiling mode windows are managed in a master and stacking area. The master
area contains the window which currently needs most attention, whereas the
area contains the windows which currently need most attention, whereas the
stacking area contains all other windows. In floating mode windows can be
resized and moved freely. Dialog windows are always managed floating,
regardless of the mode selected.
regardless of the mode applied.
.P
Windows are grouped by tags. Each window can be tagged with one or multiple
tags. Selecting certain tags displays all windows with these tags.
.P
dwm contains a small status bar which displays all available tags, the mode,
the title of the focused window, and the text read from standard input. The
selected tags are highlighted with a different color, the tags of the focused
window are highlighted with a small point.
selected tags are indicated with a different color. The tags of the focused
window are indicated with a filled square in the top left corner. The tags
which are applied to one or more windows are indicated with an empty square in
the top left corner.
.P
dwm draws a 1-pixel border around windows to indicate the focus state.
Unfocused windows contain a small bar in front of them displaying their title.
.SH OPTIONS
.TP
.B \-v
@ -42,6 +43,12 @@ label toggles between tiling and floating mode.
.B Button3
click on a tag label adds/removes all windows with that tag to/from the view.
.TP
.B Button4
click on the mode label increases the number of windows in the master area (tiling mode only).
.TP
.B Button5
click on the mode label decreases the number of windows in the master area (tiling mode only).
.TP
.B Mod1-Button1
click on a tag label applies that tag to the focused window.
.TP
@ -63,16 +70,25 @@ Focus previous window.
Zooms/cycles current window to/from master area (tiling mode), toggles maximization current window (floating mode).
.TP
.B Mod1-g
Grow current area (tiling mode only).
Grow master area (tiling mode only).
.TP
.B Mod1-s
Shrink current area (tiling mode only).
Shrink master area (tiling mode only).
.TP
.B Mod1-i
Increase the number of windows in the master area (tiling mode only).
.TP
.B Mod1-d
Decrease the number of windows in the master area (tiling mode only).
.TP
.B Mod1-Shift-[1..n]
Apply
.RB nth
tag to current window.
.TP
.B Mod1-Shift-0
Apply all tags to current window.
.TP
.B Mod1-Control-Shift-[1..n]
Add/remove
.B nth
@ -84,6 +100,9 @@ Close focused window.
.B Mod1-space
Toggle between tiling and floating mode (affects all windows).
.TP
.B Mod1-Shift-space
Toggle focused window between floating and non-floating state (tiling mode only).
.TP
.B Mod1-[1..n]
View all windows with
.BR nth
@ -114,9 +133,17 @@ dwm is customized by creating a custom config.h and (re)compiling the source
code. This keeps it fast, secure and simple.
.SH CAVEATS
The status bar may display
.BR "broken pipe"
when dwm has been started by
.BR "EOF"
when dwm has been started by an X session manager like
.BR xdm (1),
because it closes standard output before executing dwm.
because those close standard output before executing dwm.
.P
Java applications which use the XToolkit/XAWT backend may draw grey windows
only. The XToolkit/XAWT backend breaks ICCCM-compliance in recent JDK 1.5 and early
JDK 1.6 versions, because it assumes a reparenting window manager. As a workaround
you can use JDK 1.4 (which doesn't contain the XToolkit/XAWT backend) or you
can set the following environment variable (to use the older Motif
backend instead):
.BR AWT_TOOLKIT=MToolkit .
.SH SEE ALSO
.BR dmenu (1)

32
dwm.h
View File

@ -1,4 +1,4 @@
/* (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
/* (C)opyright MMVI-MMVII Anselm R. Garbe <garbeam at gmail dot com>
* See LICENSE file for license details.
*
* dynamic window manager is designed like any other X client as well. It is
@ -43,7 +43,7 @@
enum { NetSupported, NetWMName, NetLast }; /* EWMH atoms */
enum { WMProtocols, WMDelete, WMLast }; /* default atoms */
enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
enum { ColFG, ColBG, ColLast }; /* color */
enum { ColBorder, ColFG, ColBG, ColLast }; /* color */
typedef enum {
TopLeft, TopRight, BotLeft, BotRight
@ -66,7 +66,6 @@ typedef struct {
int x, y, w, h;
unsigned long norm[ColLast];
unsigned long sel[ColLast];
unsigned long status[ColLast];
Drawable drawable;
Fnt font;
GC gc;
@ -78,25 +77,24 @@ struct Client {
int proto;
int x, y, w, h;
int rx, ry, rw, rh; /* revert geometry */
int tx, ty, tw, th; /* title window geometry */
int basew, baseh, incw, inch, maxw, maxh, minw, minh;
int grav;
long flags;
unsigned int border, weight;
unsigned int border;
Bool isfloat, isfixed, ismax;
Bool *tags;
Client *next;
Client *prev;
Client *snext;
Window win;
Window twin;
};
extern const char *tags[]; /* all tags */
extern char stext[1024]; /* status text */
extern int bx, by, bw, bh, bmw; /* bar geometry, bar mode label width */
extern char stext[256]; /* status text */
extern int bh, bmw; /* bar height, bar mode label width */
extern int screen, sx, sy, sw, sh; /* screen geometry */
extern unsigned int master, ntags, numlockmask; /* master percent, number of tags, dynamic lock mask */
extern int wax, way, wah, waw; /* windowarea geometry */
extern unsigned int master, nmaster; /* master percent, number of master clients */
extern unsigned int ntags, numlockmask; /* number of tags, dynamic lock mask */
extern void (*handler[LASTEvent])(XEvent *); /* event handler */
extern void (*arrange)(void); /* arrange function, indicates mode */
extern Atom wmatom[WMLast], netatom[NetLast];
@ -108,24 +106,18 @@ extern Display *dpy;
extern Window root, barwin;
/* client.c */
extern void ban(Client *c); /* ban c from screen */
extern void configure(Client *c); /* send synthetic configure event */
extern void focus(Client *c); /* focus c, c may be NULL */
extern Client *getclient(Window w); /* return client of w */
extern Client *getctitle(Window w); /* return client of title window */
extern void gravitate(Client *c, Bool invert); /* gravitate c */
extern void killclient(Arg *arg); /* kill c nicely */
extern void manage(Window w, XWindowAttributes *wa); /* manage new client */
extern void resize(Client *c, Bool sizehints, Corner sticky); /* resize c*/
extern void resizetitle(Client *c); /* resizes c->twin correctly */
extern void updatesize(Client *c); /* update the size structs of c */
extern void updatesizehints(Client *c); /* update the size hint variables of c */
extern void updatetitle(Client *c); /* update the name of c */
extern void unmanage(Client *c); /* destroy c */
/* draw.c */
extern void drawall(void); /* draw all visible client titles and the bar */
extern void drawstatus(void); /* draw the bar */
extern void drawtitle(Client *c); /* draw title of c */
extern unsigned long getcolor(const char *colstr); /* return color of colstr */
extern void setfont(const char *fontstr); /* set the font for DC */
extern unsigned int textw(const char *text); /* return the width of text in px*/
@ -151,7 +143,6 @@ extern void toggletag(Arg *arg); /* toggles c tags with arg's index */
/* util.c */
extern void *emallocz(unsigned int size); /* allocates zero-initialized memory, exits on error */
extern void eprint(const char *errstr, ...); /* prints errstr and exits with 1 */
extern void *erealloc(void *ptr, unsigned int size); /* reallocates memory, exits on error */
extern void spawn(Arg *arg); /* forks a new subprocess with to arg's cmd */
/* view.c */
@ -160,11 +151,12 @@ extern void dofloat(void); /* arranges all windows floating */
extern void dotile(void); /* arranges all windows tiled */
extern void focusnext(Arg *arg); /* focuses next visible client, arg is ignored */
extern void focusprev(Arg *arg); /* focuses previous visible client, arg is ignored */
extern void incnmaster(Arg *arg); /* increments nmaster with arg's index value */
extern Bool isvisible(Client *c); /* returns True if client is visible */
extern void resizecol(Arg *arg); /* resizes the master percent with arg's index value */
extern void resizemaster(Arg *arg); /* resizes the master percent with arg's index value */
extern void restack(void); /* restores z layers of all clients */
extern void togglefloat(Arg *arg); /* toggles focusesd client between floating/non-floating state */
extern void togglemode(Arg *arg); /* toggles global arrange function (dotile/dofloat) */
extern void toggleview(Arg *arg); /* toggles the tag with arg's index (in)visible */
extern void view(Arg *arg); /* views the tag with arg's index */
extern void viewall(Arg *arg); /* views all tags, arg is ignored */
extern void zoom(Arg *arg); /* zooms the focused client to master area, arg is ignored */

59
event.c
View File

@ -1,4 +1,4 @@
/* (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
/* (C)opyright MMVI-MMVII Anselm R. Garbe <garbeam at gmail dot com>
* See LICENSE file for license details.
*/
#include "dwm.h"
@ -48,14 +48,14 @@ movemouse(Client *c) {
XSync(dpy, False);
c->x = ocx + (ev.xmotion.x - x1);
c->y = ocy + (ev.xmotion.y - y1);
if(abs(sx + c->x) < SNAP)
c->x = sx;
else if(abs((sx + sw) - (c->x + c->w)) < SNAP)
c->x = sw - c->w - 2 * BORDERPX;
if(abs((sy + bh) - c->y) < SNAP)
c->y = sy + bh;
else if(abs((sy + sh) - (c->y + c->h)) < SNAP)
c->y = sh - c->h - 2 * BORDERPX;
if(abs(wax + c->x) < SNAP)
c->x = wax;
else if(abs((wax + waw) - (c->x + c->w)) < SNAP)
c->x = wax + waw - c->w - 2 * BORDERPX;
if(abs(way - c->y) < SNAP)
c->y = way;
else if(abs((way + wah) - (c->y + c->h)) < SNAP)
c->y = way + wah - c->h - 2 * BORDERPX;
resize(c, False, TopLeft);
break;
}
@ -131,8 +131,20 @@ buttonpress(XEvent *e) {
return;
}
}
if((ev->x < x + bmw) && (ev->button == Button1))
togglemode(NULL);
if(ev->x < x + bmw)
switch(ev->button) {
case Button1:
togglemode(NULL);
break;
case Button4:
a.i = 1;
incnmaster(&a);
break;
case Button5:
a.i = -1;
incnmaster(&a);
break;
}
}
else if((c = getclient(ev->window))) {
focus(c);
@ -161,7 +173,6 @@ configurerequest(XEvent *e) {
if((c = getclient(ev->window))) {
c->ismax = False;
gravitate(c, True);
if(ev->value_mask & CWX)
c->x = ev->x;
if(ev->value_mask & CWY)
@ -172,7 +183,6 @@ configurerequest(XEvent *e) {
c->h = ev->height;
if(ev->value_mask & CWBorderWidth)
c->border = ev->border_width;
gravitate(c, False);
wc.x = c->x;
wc.y = c->y;
wc.width = c->w;
@ -186,7 +196,7 @@ configurerequest(XEvent *e) {
if(c->isfloat) {
resize(c, False, TopLeft);
if(!isvisible(c))
ban(c);
XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
}
else
arrange();
@ -220,31 +230,27 @@ enternotify(XEvent *e) {
if(ev->mode != NotifyNormal || ev->detail == NotifyInferior)
return;
if(((c = getclient(ev->window)) || (c = getctitle(ev->window))) && isvisible(c))
if((c = getclient(ev->window)) && isvisible(c))
focus(c);
else if(ev->window == root) {
issel = True;
XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
drawall();
}
}
static void
expose(XEvent *e) {
Client *c;
XExposeEvent *ev = &e->xexpose;
if(ev->count == 0) {
if(barwin == ev->window)
drawstatus();
else if((c = getctitle(ev->window)))
drawtitle(c);
}
}
static void
keypress(XEvent *e) {
static unsigned int len = sizeof(key) / sizeof(key[0]);
static unsigned int len = sizeof key / sizeof key[0];
unsigned int i;
KeySym keysym;
XKeyEvent *ev = &e->xkey;
@ -256,7 +262,6 @@ keypress(XEvent *e) {
{
if(key[i].func)
key[i].func(&key[i].arg);
return;
}
}
}
@ -265,10 +270,8 @@ static void
leavenotify(XEvent *e) {
XCrossingEvent *ev = &e->xcrossing;
if((ev->window == root) && !ev->same_screen) {
if((ev->window == root) && !ev->same_screen)
issel = False;
drawall();
}
}
static void
@ -317,13 +320,13 @@ propertynotify(XEvent *e) {
arrange();
break;
case XA_WM_NORMAL_HINTS:
updatesize(c);
updatesizehints(c);
break;
}
if(ev->atom == XA_WM_NAME || ev->atom == netatom[NetWMName]) {
updatetitle(c);
resizetitle(c);
drawtitle(c);
if(c == sel)
drawstatus();
}
}
}
@ -355,7 +358,7 @@ void (*handler[LASTEvent]) (XEvent *) = {
void
grabkeys(void) {
static unsigned int len = sizeof(key) / sizeof(key[0]);
static unsigned int len = sizeof key / sizeof key[0];
unsigned int i;
KeyCode code;

81
main.c
View File

@ -1,9 +1,10 @@
/* (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
/* (C)opyright MMVI-MMVII Anselm R. Garbe <garbeam at gmail dot com>
* See LICENSE file for license details.
*/
#include "dwm.h"
#include <errno.h>
#include <locale.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -16,10 +17,10 @@
/* extern */
char stext[1024];
char stext[256];
Bool *seltag;
int bx, by, bw, bh, bmw, masterd, screen, sx, sy, sw, sh;
unsigned int master, ntags, numlockmask;
int bh, bmw, screen, sx, sy, sw, sh, wax, way, waw, wah;
unsigned int master, nmaster, ntags, numlockmask;
Atom wmatom[WMLast], netatom[NetLast];
Bool running = True;
Bool issel = True;
@ -39,9 +40,9 @@ static Bool otherwm, readin;
static void
cleanup(void) {
close(STDIN_FILENO);
while(sel) {
resize(sel, True, TopLeft);
unmanage(sel);
while(stack) {
resize(stack, True, TopLeft);
unmanage(stack);
}
if(dc.font.set)
XFreeFontSet(dpy, dc.font.set);
@ -51,6 +52,9 @@ cleanup(void) {
XFreePixmap(dpy, dc.drawable);
XFreeGC(dpy, dc.gc);
XDestroyWindow(dpy, barwin);
XFreeCursor(dpy, cursor[CurNormal]);
XFreeCursor(dpy, cursor[CurResize]);
XFreeCursor(dpy, cursor[CurMove]);
XSetInputFocus(dpy, PointerRoot, RevertToPointerRoot, CurrentTime);
XSync(dpy, False);
free(seltag);
@ -97,6 +101,7 @@ setup(void) {
cursor[CurResize] = XCreateFontCursor(dpy, XC_sizing);
cursor[CurMove] = XCreateFontCursor(dpy, XC_fleur);
/* init modifier map */
numlockmask = 0;
modmap = XGetModifierMapping(dpy);
for (i = 0; i < 8; i++) {
for (j = 0; j < modmap->max_keypermod; j++) {
@ -104,7 +109,7 @@ setup(void) {
numlockmask = (1 << i);
}
}
XFree(modmap);
XFreeModifiermap(modmap);
/* select for events */
wa.event_mask = SubstructureRedirectMask | SubstructureNotifyMask
| EnterWindowMask | LeaveWindowMask;
@ -116,32 +121,36 @@ setup(void) {
seltag = emallocz(sizeof(Bool) * ntags);
seltag[0] = True;
/* style */
dc.norm[ColBorder] = getcolor(NORMBORDERCOLOR);
dc.norm[ColBG] = getcolor(NORMBGCOLOR);
dc.norm[ColFG] = getcolor(NORMFGCOLOR);
dc.sel[ColBorder] = getcolor(SELBORDERCOLOR);
dc.sel[ColBG] = getcolor(SELBGCOLOR);
dc.sel[ColFG] = getcolor(SELFGCOLOR);
dc.status[ColBG] = getcolor(STATUSBGCOLOR);
dc.status[ColFG] = getcolor(STATUSFGCOLOR);
setfont(FONT);
/* geometry */
bmw = textw(TILESYMBOL) > textw(FLOATSYMBOL) ? textw(TILESYMBOL) : textw(FLOATSYMBOL);
sx = sy = 0;
sw = DisplayWidth(dpy, screen);
sh = DisplayHeight(dpy, screen);
master = MASTER;
nmaster = NMASTER;
bmw = textw(TILESYMBOL) > textw(FLOATSYMBOL) ? textw(TILESYMBOL) : textw(FLOATSYMBOL);
/* bar */
bx = by = 0;
bw = sw;
dc.h = bh = dc.font.height + 2;
wa.override_redirect = 1;
wa.background_pixmap = ParentRelative;
wa.event_mask = ButtonPressMask | ExposureMask;
barwin = XCreateWindow(dpy, root, bx, by, bw, bh, 0, DefaultDepth(dpy, screen),
barwin = XCreateWindow(dpy, root, sx, sy, sw, bh, 0, DefaultDepth(dpy, screen),
CopyFromParent, DefaultVisual(dpy, screen),
CWOverrideRedirect | CWBackPixmap | CWEventMask, &wa);
XDefineCursor(dpy, barwin, cursor[CurNormal]);
XMapRaised(dpy, barwin);
strcpy(stext, "dwm-"VERSION);
/* windowarea */
wax = sx;
way = sy + bh;
wah = sh - bh;
waw = sw;
/* pixmap for everything */
dc.drawable = XCreatePixmap(dpy, root, sw, bh, DefaultDepth(dpy, screen));
dc.gc = XCreateGC(dpy, root, 0, 0);
@ -221,15 +230,17 @@ xerror(Display *dpy, XErrorEvent *ee) {
int
main(int argc, char *argv[]) {
char *p;
int r, xfd;
fd_set rd;
if(argc == 2 && !strncmp("-v", argv[1], 3)) {
fputs("dwm-"VERSION", (C)opyright MMVI Anselm R. Garbe\n", stdout);
fputs("dwm-"VERSION", (C)opyright MMVI-MMVII Anselm R. Garbe\n", stdout);
exit(EXIT_SUCCESS);
}
else if(argc != 1)
eprint("usage: dwm [-v]\n");
setlocale(LC_CTYPE, "");
dpy = XOpenDisplay(0);
if(!dpy)
eprint("dwm: cannot open display\n");
@ -261,22 +272,32 @@ main(int argc, char *argv[]) {
if(readin)
FD_SET(STDIN_FILENO, &rd);
FD_SET(xfd, &rd);
r = select(xfd + 1, &rd, NULL, NULL, NULL);
if((r == -1) && (errno == EINTR))
continue;
if(r > 0) {
if(readin && FD_ISSET(STDIN_FILENO, &rd)) {
readin = NULL != fgets(stext, sizeof(stext), stdin);
if(readin)
stext[strlen(stext) - 1] = 0;
else
strcpy(stext, "broken pipe");
drawstatus();
}
}
else if(r < 0)
if(select(xfd + 1, &rd, NULL, NULL, NULL) == -1) {
if(errno == EINTR)
continue;
eprint("select failed\n");
procevent();
}
if(FD_ISSET(STDIN_FILENO, &rd)) {
switch(r = read(STDIN_FILENO, stext, sizeof stext - 1)) {
case -1:
strncpy(stext, strerror(errno), sizeof stext - 1);
stext[sizeof stext - 1] = '\0';
readin = False;
break;
case 0:
strncpy(stext, "EOF", 4);
readin = False;
break;
default:
for(stext[r] = '\0', p = stext + strlen(stext) - 1; p >= stext && *p == '\n'; *p-- = '\0');
for(p = stext + strlen(stext) - 1; p >= stext && *p != '\n'; --p);
if(p > stext)
strncpy(stext, p + 1, sizeof stext);
}
drawstatus();
}
if(FD_ISSET(xfd, &rd))
procevent();
}
cleanup();
XCloseDisplay(dpy);

20
tag.c
View File

@ -1,4 +1,4 @@
/* (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
/* (C)opyright MMVI-MMVII Anselm R. Garbe <garbeam at gmail dot com>
* See LICENSE file for license details.
*/
#include "dwm.h"
@ -50,19 +50,19 @@ initrregs(void) {
if(rreg)
return;
len = sizeof(rule) / sizeof(rule[0]);
len = sizeof rule / sizeof rule[0];
rreg = emallocz(len * sizeof(RReg));
for(i = 0; i < len; i++) {
if(rule[i].clpattern) {
reg = emallocz(sizeof(regex_t));
if(regcomp(reg, rule[i].clpattern, 0))
if(regcomp(reg, rule[i].clpattern, REG_EXTENDED))
free(reg);
else
rreg[i].clregex = reg;
}
if(rule[i].tpattern) {
reg = emallocz(sizeof(regex_t));
if(regcomp(reg, rule[i].tpattern, 0))
if(regcomp(reg, rule[i].tpattern, REG_EXTENDED))
free(reg);
else
rreg[i].tregex = reg;
@ -83,10 +83,10 @@ settags(Client *c, Client *trans) {
c->tags[i] = trans->tags[i];
}
else if(XGetClassHint(dpy, c->win, &ch)) {
snprintf(prop, sizeof(prop), "%s:%s:%s",
snprintf(prop, sizeof prop, "%s:%s:%s",
ch.res_class ? ch.res_class : "",
ch.res_name ? ch.res_name : "", c->name);
for(i = 0; !matched && i < len; i++)
for(i = 0; i < len; i++)
if(rreg[i].clregex && !regexec(rreg[i].clregex, prop, 1, &tmp, 0)) {
c->isfloat = rule[i].isfloat;
for(j = 0; rreg[i].tregex && j < ntags; j++) {
@ -104,7 +104,6 @@ settags(Client *c, Client *trans) {
if(!matched)
for(i = 0; i < ntags; i++)
c->tags[i] = seltag[i];
for(c->weight = 0; c->weight < ntags && !c->tags[c->weight]; c->weight++);
}
void
@ -114,9 +113,9 @@ tag(Arg *arg) {
if(!sel)
return;
for(i = 0; i < ntags; i++)
sel->tags[i] = False;
sel->tags[arg->i] = True;
sel->weight = arg->i;
sel->tags[i] = (arg->i == -1) ? True : False;
if(arg->i >= 0 && arg->i < ntags)
sel->tags[arg->i] = True;
arrange();
}
@ -130,6 +129,5 @@ toggletag(Arg *arg) {
for(i = 0; i < ntags && !sel->tags[i]; i++);
if(i == ntags)
sel->tags[arg->i] = True;
sel->weight = (i == ntags) ? arg->i : i;
arrange();
}

11
util.c
View File

@ -1,4 +1,4 @@
/* (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
/* (C)opyright MMVI-MMVII Anselm R. Garbe <garbeam at gmail dot com>
* See LICENSE file for license details.
*/
#include "dwm.h"
@ -29,15 +29,6 @@ eprint(const char *errstr, ...) {
exit(EXIT_FAILURE);
}
void *
erealloc(void *ptr, unsigned int size) {
void *res = realloc(ptr, size);
if(!res)
eprint("fatal: could not malloc() %u bytes\n", size);
return res;
}
void
spawn(Arg *arg) {
static char *shell = NULL;

165
view.c
View File

@ -1,46 +1,17 @@
/* (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
/* (C)opyright MMVI-MMVII Anselm R. Garbe <garbeam at gmail dot com>
* See LICENSE file for license details.
*/
#include "dwm.h"
#include <stdio.h>
/* static */
static Client *
minclient(void) {
Client *c, *min;
if((clients && clients->isfloat) || arrange == dofloat)
return clients; /* don't touch floating order */
for(min = c = clients; c; c = c->next)
if(c->weight < min->weight)
min = c;
return min;
}
static Client *
nexttiled(Client *c) {
for(c = getnext(c); c && c->isfloat; c = getnext(c->next));
return c;
}
static void
reorder(void) {
Client *c, *newclients, *tail;
newclients = tail = NULL;
while((c = minclient())) {
detach(c);
if(tail) {
c->prev = tail;
tail->next = c;
tail = c;
}
else
tail = newclients = c;
}
clients = newclients;
}
static void
togglemax(Client *c) {
XEvent ev;
@ -49,10 +20,10 @@ togglemax(Client *c) {
return;
if((c->ismax = !c->ismax)) {
c->rx = c->x; c->x = sx;
c->ry = c->y; c->y = bh;
c->rw = c->w; c->w = sw - 2 * BORDERPX;
c->rh = c->h; c->h = sh - bh - 2 * BORDERPX;
c->rx = c->x; c->x = wax;
c->ry = c->y; c->y = way;
c->rw = c->w; c->w = waw - 2 * BORDERPX;
c->rh = c->h; c->h = wah - 2 * BORDERPX;
}
else {
c->x = c->rx;
@ -88,7 +59,7 @@ dofloat(void) {
resize(c, True, TopLeft);
}
else
ban(c);
XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
}
if(!sel || !isvisible(sel)) {
for(c = stack; c && !isvisible(c); c = c->snext);
@ -99,17 +70,16 @@ dofloat(void) {
void
dotile(void) {
unsigned int i, n, mpx, stackw, stackh, th;
unsigned int i, n, mw, mh, tw, th;
Client *c;
for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next))
n++;
mpx = (sw * master) / 1000;
stackw = sw - mpx;
stackh = sh - bh;
th = stackh;
if(n > 1)
th /= (n - 1);
/* window geoms */
mh = (n > nmaster) ? wah / nmaster : wah / (n > 0 ? n : 1);
mw = (n > nmaster) ? (waw * master) / 1000 : waw;
th = (n > nmaster) ? wah / (n - nmaster) : 0;
tw = waw - mw;
for(i = 0, c = clients; c; c = c->next)
if(isvisible(c)) {
@ -118,35 +88,28 @@ dotile(void) {
continue;
}
c->ismax = False;
c->x = sx;
c->y = sy + bh;
if(n == 1) { /* only 1 window */
c->w = sw - 2 * BORDERPX;
c->h = sh - 2 * BORDERPX - bh;
}
else if(i == 0) { /* master window */
c->w = mpx - 2 * BORDERPX;
c->h = sh - bh - 2 * BORDERPX;
c->x = wax;
c->y = way;
if(i < nmaster) {
c->y += i * mh;
c->w = mw - 2 * BORDERPX;
c->h = mh - 2 * BORDERPX;
}
else { /* tile window */
c->x += mpx;
c->w = stackw - 2 * BORDERPX;
c->x += mw;
c->w = tw - 2 * BORDERPX;
if(th > bh) {
c->y = sy + (i - 1) * th + bh;
if(i + 1 == n)
c->h = sh - c->y - 2 * BORDERPX;
else
c->h = th - 2 * BORDERPX;
c->y += (i - nmaster) * th;
c->h = th - 2 * BORDERPX;
}
else /* fallback if th < bh */
c->h = stackh - 2 * BORDERPX;
c->h = wah - 2 * BORDERPX;
}
resize(c, False, TopLeft);
i++;
}
else
ban(c);
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);
@ -184,6 +147,17 @@ focusprev(Arg *arg) {
}
}
void
incnmaster(Arg *arg) {
if((arrange == dofloat) || (nmaster + arg->i < 1) || (wah / (nmaster + arg->i) < bh))
return;
nmaster += arg->i;
if(sel)
arrange();
else
drawstatus();
}
Bool
isvisible(Client *c) {
unsigned int i;
@ -195,25 +169,14 @@ isvisible(Client *c) {
}
void
resizecol(Arg *arg) {
unsigned int n;
Client *c;
for(n = 0, c = clients; c; c = c->next)
if(isvisible(c) && !c->isfloat)
n++;
if(!sel || sel->isfloat || n < 2 || (arrange == dofloat))
return;
if(sel == getnext(clients)) {
resizemaster(Arg *arg) {
if(arg->i == 0)
master = MASTER;
else {
if(master + arg->i > 950 || master + arg->i < 50)
return;
master += arg->i;
}
else {
if(master - arg->i > 950 || master - arg->i < 50)
return;
master -= arg->i;
}
arrange();
}
@ -222,31 +185,32 @@ restack(void) {
Client *c;
XEvent ev;
if(!sel) {
drawstatus();
drawstatus();
if(!sel)
return;
}
if(sel->isfloat || arrange == dofloat) {
if(sel->isfloat || arrange == dofloat)
XRaiseWindow(dpy, sel->win);
XRaiseWindow(dpy, sel->twin);
}
if(arrange != dofloat) {
if(!sel->isfloat) {
XLowerWindow(dpy, sel->twin);
if(!sel->isfloat)
XLowerWindow(dpy, sel->win);
}
for(c = nexttiled(clients); c; c = nexttiled(c->next)) {
if(c == sel)
continue;
XLowerWindow(dpy, c->twin);
XLowerWindow(dpy, c->win);
}
}
drawall();
XSync(dpy, False);
while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
}
void
togglefloat(Arg *arg) {
if (!sel || arrange == dofloat)
return;
sel->isfloat = !sel->isfloat;
arrange();
}
void
togglemode(Arg *arg) {
arrange = (arrange == dofloat) ? dotile : dofloat;
@ -264,7 +228,6 @@ toggleview(Arg *arg) {
for(i = 0; i < ntags && !seltag[i]; i++);
if(i == ntags)
seltag[arg->i] = True; /* cannot toggle last view */
reorder();
arrange();
}
@ -273,19 +236,9 @@ view(Arg *arg) {
unsigned int i;
for(i = 0; i < ntags; i++)
seltag[i] = False;
seltag[arg->i] = True;
reorder();
arrange();
}
void
viewall(Arg *arg) {
unsigned int i;
for(i = 0; i < ntags; i++)
seltag[i] = True;
reorder();
seltag[i] = (arg->i == -1) ? True : False;
if(arg->i >= 0 && arg->i < ntags)
seltag[arg->i] = True;
arrange();
}
@ -300,11 +253,9 @@ zoom(Arg *arg) {
togglemax(sel);
return;
}
for(n = 0, c = clients; c; c = c->next)
if(isvisible(c) && !c->isfloat)
n++;
if(n < 2 || (arrange == dofloat))
return;
for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next))
n++;
if((c = sel) == nexttiled(clients))
if(!(c = nexttiled(c->next)))
return;