1
0
mirror of git://git.suckless.org/dwm synced 2025-08-01 12:42:12 -07:00

Compare commits

..

41 Commits
1.3 ... 1.5

Author SHA1 Message Date
Anselm R. Garbe
0925dd588c applied sanders patch of not manipulating sel 2006-09-08 08:19:54 +02:00
Anselm R. Garbe
6f20315dff really small changes to dwm.1 2006-09-08 07:40:16 +02:00
Anselm R. Garbe
2e68f22118 hotfix 2006-09-07 18:13:19 +02:00
Anselm R. Garbe
8aa860d270 simplified unmanage 2006-09-07 18:12:40 +02:00
Anselm R. Garbe
15abade272 using a global stack for focus recovery on arrange() - seems to work great 2006-09-07 17:53:40 +02:00
Anselm R. Garbe
7ab8c87281 made markups in dwm.1 more consistent 2006-09-07 09:26:01 +02:00
Anselm R. Garbe
4ff8f71643 small addition to dwm.1 2006-09-07 07:53:29 +02:00
Anselm R. Garbe
d22abeee86 this patch keeps track of global z-layer order of clients which are floating or if floating mode is enabled 2006-09-06 17:31:52 +02:00
Anselm R. Garbe
a33150eb4b no this is better 2006-09-06 15:36:42 +02:00
Anselm R. Garbe
fd00b3a186 does this preserve z order for anthony? 2006-09-06 15:30:28 +02:00
Anselm R. Garbe
e8389a4cc0 maybe this might work 2006-09-06 13:56:46 +02:00
Anselm R. Garbe
6078d756bc Added tag 1.4 for changeset 3cff9403766bf83a9fc2a0aef230115d68de2a8e 2006-09-06 12:19:07 +02:00
Anselm R. Garbe
57c49fe867 prepared dwm-1.4 update 2006-09-06 12:18:57 +02:00
Anselm R. Garbe
c60de1acd4 drawstatus even if no client exists 2006-09-06 12:10:43 +02:00
Anselm R. Garbe
69b738c097 sanders solution is convincing and elegant 2006-09-06 11:54:16 +02:00
Anselm R. Garbe
da0b2a2f31 seems to preserve floating client z-layer order (even with reorder() calls) 2006-09-06 11:46:35 +02:00
Anselm R. Garbe
2378a558a2 Added tag 1.4 for changeset a6b8994af16491220db0199623bd57d061e06143 2006-09-06 10:54:10 +02:00
Anselm R. Garbe
f18ed615ae small fix 2006-09-06 10:03:21 +02:00
Anselm R. Garbe
f6656fffb4 made args mode symbols the default ones (the default ones look too ugly) 2006-09-06 09:23:34 +02:00
Anselm R. Garbe
aaad7bfd15 moved transient_for tag inheritance to settags 2006-09-06 09:21:17 +02:00
Anselm R. Garbe
0915da8842 no, reodering floating clients definately breaks the manage() policy which attaches all clients zoomed (otherwise higher-weight clients couldn't be attached zoomed, which sucks) 2006-09-06 09:13:31 +02:00
Anselm R. Garbe
0d0e8bde13 no, ordering floating clients at the end seems better 2006-09-05 19:26:34 +02:00
Anselm R. Garbe
838a1ff950 fix 2006-09-05 18:43:15 +02:00
Anselm R. Garbe
e1315fd40c this makes sure the issue mentioned by sander 2006-09-05 18:04:22 +02:00
Anselm R. Garbe
52a3ab1042 fixing zoom 2006-09-05 17:10:48 +02:00
Anselm R. Garbe
a82e7b765e fixing two off-by-ones 2006-09-05 16:11:52 +02:00
Anselm R. Garbe
0ed0fa4d5b ach ich will auch Alt-s 2006-09-05 16:05:09 +02:00
Anselm R. Garbe
ec85fddb9a applied checking existance of >2 tiles patch (proposed by sander) to zoom and resizecol 2006-09-05 16:00:09 +02:00
Anselm R. Garbe
3a1343a245 renamed resizetile into resizecol 2006-09-05 13:52:23 +02:00
Anselm R. Garbe
9066ee2eb4 well ok, added Mod-s to default bindings (however, I don't need it) 2006-09-05 13:27:43 +02:00
Anselm R. Garbe
40bd21ce63 s/growcol/resizetile/g 2006-09-05 13:25:42 +02:00
Anselm R. Garbe
4633fbec61 right, multihead issue is not involved with growcol 2006-09-05 13:21:59 +02:00
Anselm R. Garbe
25060031a5 hotfix 2006-09-05 13:20:29 +02:00
Anselm R. Garbe
c7ae6334b7 applied a fix related to Sanders remark to growcol 2006-09-05 13:19:18 +02:00
Anselm R. Garbe
eac04882b4 sanders toggletag patch is much more elegant 2006-09-05 09:37:45 +02:00
Anselm R. Garbe
6499fc4f93 I really need column growing, now pushing upstream 2006-09-05 09:02:37 +02:00
Anselm R. Garbe
04f27a5438 don't access sel in restack without checking for NULL (multihead crashing bug) 2006-09-05 08:37:34 +02:00
Anselm R. Garbe
1b3903d6e9 fixing c->weight handling 2006-09-05 08:24:00 +02:00
Anselm R. Garbe
cc05093b0d removed some useless tags 2006-09-04 19:19:37 +02:00
Anselm R. Garbe
6436dd4438 after 1.3 2006-09-04 17:52:46 +02:00
Anselm R. Garbe
26c50c780e Added tag 1.3 for changeset f5f5cbf016a94b48a8fe9c47f0736e96d166d5d4 2006-09-04 17:52:16 +02:00
10 changed files with 148 additions and 163 deletions

View File

@@ -10,5 +10,5 @@ fae61afa861755636c4a1070694209ace8efbb6c 0.9
bbc98e77ae89a7c9232a5be0835f60ea00d8036e 1.0
44a55e6e46bf6c231780b09d919977d6f01083de 1.1
e3179ce2b90451d2807cd53b589d768412b8666b 1.2
6413ea66b1c2496cfc2173fe58df67cb965eb1da 1.3
dd44dc937e8b0a46abf1a15a333dba5304e4fe89 1.3
f5f5cbf016a94b48a8fe9c47f0736e96d166d5d4 1.3
3cff9403766bf83a9fc2a0aef230115d68de2a8e 1.4

View File

@@ -10,6 +10,14 @@
/* static functions */
static void
detachstack(Client *c)
{
Client **tc;
for(tc=&stack; *tc && *tc != c; tc=&(*tc)->snext);
*tc = c->snext;
}
static void
grabbuttons(Client *c, Bool focus)
{
@@ -99,6 +107,9 @@ focus(Client *c)
}
}
if(c) {
detachstack(c);
c->snext = stack;
stack = c;
grabbuttons(c, True);
drawtitle(c);
XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime);
@@ -198,8 +209,7 @@ killclient(Arg *arg)
void
manage(Window w, XWindowAttributes *wa)
{
unsigned int i;
Client *c, *tc;
Client *c;
Window trans;
XSetWindowAttributes twa;
@@ -238,11 +248,7 @@ manage(Window w, XWindowAttributes *wa)
CWOverrideRedirect | CWBackPixmap | CWEventMask, &twa);
grabbuttons(c, False);
if((tc = getclient(trans))) /* inherit tags */
for(i = 0; i < ntags; i++)
c->tags[i] = tc->tags[i];
else
settags(c);
settags(c, getclient(trans));
if(!c->isfloat)
c->isfloat = trans
|| (c->maxw && c->minw &&
@@ -251,7 +257,8 @@ manage(Window w, XWindowAttributes *wa)
if(clients)
clients->prev = c;
c->next = clients;
clients = c;
c->snext = stack;
stack = clients = c;
settitle(c);
ban(c);
@@ -407,19 +414,16 @@ togglemax(Arg *arg)
void
unmanage(Client *c)
{
Client *tc, *fc;
Window trans;
Client *nc;
XGrabServer(dpy);
XSetErrorHandler(xerrordummy);
detach(c);
detachstack(c);
if(sel == c) {
XGetTransientForHint(dpy, c->win, &trans);
if(trans && (tc = getclient(trans)) && isvisible(tc))
fc = tc;
else
fc = getnext(clients);
focus(fc);
for(nc = stack; nc && !isvisible(nc); nc = nc->snext);
focus(nc);
}
XUngrabButton(dpy, AnyButton, AnyModifier, c->win);

View File

@@ -34,6 +34,8 @@ static Key key[] = { \
{ MODKEY, XK_k, focusprev, { 0 } }, \
{ MODKEY, XK_Return, zoom, { 0 } }, \
{ MODKEY, XK_m, togglemax, { 0 } }, \
{ MODKEY, XK_g, resizecol, { .i = 20 } }, \
{ MODKEY, XK_s, resizecol, { .i = -20 } }, \
{ MODKEY|ShiftMask, XK_1, tag, { .i = 0 } }, \
{ MODKEY|ShiftMask, XK_2, tag, { .i = 1 } }, \
{ MODKEY|ShiftMask, XK_3, tag, { .i = 2 } }, \

View File

@@ -7,8 +7,8 @@
const char *tags[] = { "1", "2", "3", "4", "5", NULL };
#define DEFMODE dotile /* dofloat */
#define FLOATSYMBOL "~"
#define TILESYMBOL "#"
#define FLOATSYMBOL "><>"
#define TILESYMBOL "[]="
#define FONT "fixed"
#define SELBGCOLOR "#666699"
@@ -29,6 +29,8 @@ static Key key[] = { \
{ MODKEY|ShiftMask, XK_Tab, focusprev, { 0 } }, \
{ MODKEY, XK_Return, zoom, { 0 } }, \
{ MODKEY, XK_m, togglemax, { 0 } }, \
{ MODKEY, XK_g, resizecol, { .i = 20 } }, \
{ MODKEY, XK_s, resizecol, { .i = -20 } }, \
{ MODKEY|ShiftMask, XK_1, tag, { .i = 0 } }, \
{ MODKEY|ShiftMask, XK_2, tag, { .i = 1 } }, \
{ MODKEY|ShiftMask, XK_3, tag, { .i = 2 } }, \

View File

@@ -1,5 +1,5 @@
# dwm version
VERSION = 1.3
VERSION = 1.5
# Customize below to fit your system

132
dwm.1
View File

@@ -5,10 +5,9 @@ dwm \- dynamic window manager
.B dwm
.RB [ \-v ]
.SH DESCRIPTION
.B dwm
is a dynamic window manager for X. It manages windows in tiling and floating
modes. Either mode can be applied dynamically, optimizing the environment for
the application in use and the task performed.
dwm is a dynamic window manager for X. It manages windows in tiling and
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 column. The master
column contains the window which currently needs most attention, whereas the
@@ -17,16 +16,14 @@ resized and moved freely. Dialog windows are always managed floating,
regardless of the mode selected.
.P
Windows are grouped by tags. Each window can be tagged with one or multiple
tags. Selecting a certain tag for viewing will display all windows with that
tag.
tags. Selecting certain tags displays all windows with that tag.
.P
.B 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 tags of
the focused window are highlighted with a small point.
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.
.P
.B dwm
draws a 1-pixel border around windows to indicate the focus state.
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
@@ -39,30 +36,17 @@ prints version information to standard output, then exits.
is read and displayed in the status text area.
.TP
.B Button1
click on a tag label views all windows with that
.BR tag ,
click on the mode label toggles between
.B tiled
and
.B floating
mode.
click on a tag label to display all windows with that tag, click on the mode
label toggles between tiled and floating mode.
.TP
.B Button3
click on a tag label adds/removes all windows with that
.B tag
to/from the view.
click on a tag label adds/removes all windows with that tag to/from the view.
.TP
.B Mod1-Button1
click on a tag label applies that
.B tag
to the focused
.BR window .
click on a tag label applies that tag to the focused window.
.TP
.B Mod1-Button3
click on a tag label adds/removes that
.B tag
to/from the focused
.BR window .
click on a tag label adds/removes that tag to/from the focused window.
.SS Keyboard commands
.TP
.B Mod1-Shift-Return
@@ -70,102 +54,72 @@ Start
.BR xterm (1).
.TP
.B Mod1-Tab
Focus next
.BR window .
Focus next window.
.TP
.B Mod1-Shift-Tab
Focus previous
.BR window .
Focus previous window.
.TP
.B Mod1-Return
Zoom current
.B window
to the
.B master
column
.RB ( tiling
mode only).
Zoom current window to the master column (tiling mode only).
.TP
.B Mod1-m
Maximize current
.BR window .
Maximize current window.
.TP
.B Mod1-g
Grow current column (tiling mode only).
.TP
.B Mod1-s
Shrink current column (tiling mode only).
.TP
.B Mod1-Shift-[1..n]
Apply
.B nth tag
to current
.BR window .
.RB nth
tag to current window.
.TP
.B Mod1-Control-Shift-[1..n]
Add/remove
.B nth tag
to/from current
.BR window .
.B nth
tag to/from current window.
.TP
.B Mod1-Shift-c
Close focused
.B window.
Close focused window.
.TP
.B Mod1-space
Toggle between
.B tiled
and
.B floating
mode (affects
.BR "all windows" ).
Toggle between tiled and floating mode (affects all windows).
.TP
.B Mod1-[1..n]
View all windows with
.BR "tag n" .
.BR nth
tag.
.TP
.B Mod1-0
View all windows with any
.BR "tag" .
View all windows with any tag.
.TP
.B Mod1-Control-[1..n]
Add/remove all windows with
.B tag n
to/from the view.
.BR nth
tag to/from the view.
.TP
.B Mod1-Shift-q
Quit
.B dwm.
Quit dwm.
.SS Mouse commands
.TP
.B Mod1-Button1
Move current
.B window
while dragging
.RB ( floating
mode only).
Move current window while dragging (floating mode only).
.TP
.B Mod1-Button2
Zoom current
.B window
to the
.B master
column
.RB ( tiling
mode only).
Zoom current window to the master column (tiling mode only).
.TP
.B Mod1-Button3
Resize current
.B window
while dragging
.RB ( floating
mode only).
Resize current window while dragging (floating mode only).
.SH CUSTOMIZATION
.B dwm
is customized by creating a custom config.h and (re)compiling the source
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
.B broken pipe
when
.B dwm
has been started by
.BR "broken pipe"
when dwm has been started by
.BR xdm (1),
because it closes standard output before executing
.BR dwm .
because it closes standard output before executing dwm.
.SH SEE ALSO
.BR dmenu (1)

6
dwm.h
View File

@@ -61,6 +61,7 @@ struct Client {
Bool *tags;
Client *next;
Client *prev;
Client *snext;
Window win;
Window twin;
};
@@ -73,7 +74,7 @@ extern void (*handler[LASTEvent])(XEvent *);
extern void (*arrange)(Arg *);
extern Atom wmatom[WMLast], netatom[NetLast];
extern Bool running, issel, maximized, *seltag;
extern Client *clients, *sel;
extern Client *clients, *sel, *stack;
extern Cursor cursor[CurLast];
extern DC dc;
extern Display *dpy;
@@ -115,7 +116,7 @@ extern int xerror(Display *dsply, XErrorEvent *ee);
extern void initrregs();
extern Client *getnext(Client *c);
extern Client *getprev(Client *c);
extern void settags(Client *c);
extern void settags(Client *c, Client *trans);
extern void tag(Arg *arg);
extern void toggletag(Arg *arg);
@@ -132,6 +133,7 @@ extern void dotile(Arg *arg);
extern void focusnext(Arg *arg);
extern void focusprev(Arg *arg);
extern Bool isvisible(Client *c);
extern void resizecol(Arg *arg);
extern void restack();
extern void togglemode(Arg *arg);
extern void toggleview(Arg *arg);

2
main.c
View File

@@ -27,6 +27,7 @@ Bool issel = True;
Bool maximized = False;
Client *clients = NULL;
Client *sel = NULL;
Client *stack = NULL;
Cursor cursor[CurLast];
Display *dpy;
DC dc = {0};
@@ -55,6 +56,7 @@ cleanup()
XDestroyWindow(dpy, barwin);
XSetInputFocus(dpy, PointerRoot, RevertToPointerRoot, CurrentTime);
XSync(dpy, False);
free(seltag);
}
static void

15
tag.c
View File

@@ -76,15 +76,19 @@ initrregs()
}
void
settags(Client *c)
settags(Client *c, Client *trans)
{
char prop[512];
unsigned int i, j;
regmatch_t tmp;
Bool matched = False;
Bool matched = trans != NULL;
XClassHint ch;
if(XGetClassHint(dpy, c->win, &ch)) {
if(matched) {
for(i = 0; i < ntags; i++)
c->tags[i] = trans->tags[i];
}
else if(XGetClassHint(dpy, c->win, &ch)) {
snprintf(prop, sizeof(prop), "%s:%s:%s",
ch.res_class ? ch.res_class : "",
ch.res_name ? ch.res_name : "", c->name);
@@ -106,8 +110,7 @@ settags(Client *c)
if(!matched)
for(i = 0; i < ntags; i++)
c->tags[i] = seltag[i];
for(i = 0; i < ntags && !c->tags[i]; i++);
c->weight = i;
for(c->weight = 0; c->weight < ntags && !c->tags[c->weight]; c->weight++);
}
void
@@ -121,6 +124,7 @@ tag(Arg *arg)
for(i = 0; i < ntags; i++)
sel->tags[i] = False;
sel->tags[arg->i] = True;
sel->weight = arg->i;
arrange(NULL);
}
@@ -136,5 +140,6 @@ 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(NULL);
}

106
view.c
View File

@@ -12,13 +12,14 @@ minclient()
{
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 void
reorder()
{
@@ -38,6 +39,13 @@ reorder()
clients = newclients;
}
static Client *
nexttiled(Client *c)
{
for(c = getnext(c); c && c->isfloat; c = getnext(c->next));
return c;
}
/* extern */
void (*arrange)(Arg *) = DEFMODE;
@@ -68,8 +76,10 @@ dofloat(Arg *arg)
else
ban(c);
}
if(!sel || !isvisible(sel))
focus(getnext(clients));
if(!sel || !isvisible(sel)) {
for(c = stack; c && !isvisible(c); c = c->snext);
focus(c);
}
restack();
}
@@ -130,8 +140,10 @@ dotile(Arg *arg)
else
ban(c);
}
if(!sel || !isvisible(sel))
focus(getnext(clients));
if(!sel || !isvisible(sel)) {
for(c = stack; c && !isvisible(c); c = c->snext);
focus(c);
}
restack();
}
@@ -180,53 +192,50 @@ isvisible(Client *c)
return False;
}
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 != dotile) || maximized)
return;
if(sel == getnext(clients)) {
if(mw + arg->i > sw - 100 || mw + arg->i < 100)
return;
mw += arg->i;
}
else {
if(mw - arg->i > sw - 100 || mw - arg->i < 100)
return;
mw -= arg->i;
}
arrange(NULL);
}
void
restack()
{
static unsigned int nwins = 0;
static Window *wins = NULL;
unsigned int f, fi, m, mi, n;
Client *c;
XEvent ev;
for(f = 0, m = 0, c = clients; c; c = c->next)
if(isvisible(c)) {
if(c->isfloat || arrange == dofloat)
f++;
else
m++;
}
if(!(n = 2 * (f + m))) {
if(!sel) {
drawstatus();
return;
}
if(nwins < n) {
nwins = n;
wins = erealloc(wins, nwins * sizeof(Window));
}
fi = 0;
mi = 2 * f;
if(sel->isfloat || arrange == dofloat) {
wins[fi++] = sel->twin;
wins[fi++] = sel->win;
XRaiseWindow(dpy, sel->win);
XRaiseWindow(dpy, sel->twin);
}
else {
wins[mi++] = sel->twin;
wins[mi++] = sel->win;
}
for(c = clients; c; c = c->next)
if(isvisible(c) && c != sel) {
if(c->isfloat || arrange == dofloat) {
wins[fi++] = c->twin;
wins[fi++] = c->win;
}
else {
wins[mi++] = c->twin;
wins[mi++] = c->win;
}
if(arrange != dofloat)
for(c = nexttiled(clients); c; c = nexttiled(c->next)) {
XLowerWindow(dpy, c->twin);
XLowerWindow(dpy, c->win);
}
XRestackWindows(dpy, wins, n);
drawall();
XSync(dpy, False);
while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
@@ -281,17 +290,22 @@ viewall(Arg *arg)
void
zoom(Arg *arg)
{
Client *c = sel;
unsigned int n;
Client *c;
if(!c || (arrange != dotile) || c->isfloat || maximized)
for(n = 0, c = clients; c; c = c->next)
if(isvisible(c) && !c->isfloat)
n++;
if(!sel || sel->isfloat || n < 2 || (arrange != dotile) || maximized)
return;
if(c == getnext(clients))
if(!(c = getnext(c->next)))
if((c = sel) == nexttiled(clients))
if(!(c = nexttiled(c->next)))
return;
detach(c);
if(clients)
clients->prev = c;
c->next = clients;
clients->prev = c;
clients = c;
focus(c);
arrange(NULL);