Compare commits

..

12 Commits
1.4 ... 1.5

7 changed files with 75 additions and 116 deletions

View File

@ -11,3 +11,4 @@ bbc98e77ae89a7c9232a5be0835f60ea00d8036e 1.0
44a55e6e46bf6c231780b09d919977d6f01083de 1.1 44a55e6e46bf6c231780b09d919977d6f01083de 1.1
e3179ce2b90451d2807cd53b589d768412b8666b 1.2 e3179ce2b90451d2807cd53b589d768412b8666b 1.2
f5f5cbf016a94b48a8fe9c47f0736e96d166d5d4 1.3 f5f5cbf016a94b48a8fe9c47f0736e96d166d5d4 1.3
3cff9403766bf83a9fc2a0aef230115d68de2a8e 1.4

View File

@ -10,6 +10,14 @@
/* static functions */ /* static functions */
static void
detachstack(Client *c)
{
Client **tc;
for(tc=&stack; *tc && *tc != c; tc=&(*tc)->snext);
*tc = c->snext;
}
static void static void
grabbuttons(Client *c, Bool focus) grabbuttons(Client *c, Bool focus)
{ {
@ -99,6 +107,9 @@ focus(Client *c)
} }
} }
if(c) { if(c) {
detachstack(c);
c->snext = stack;
stack = c;
grabbuttons(c, True); grabbuttons(c, True);
drawtitle(c); drawtitle(c);
XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime); XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime);
@ -198,7 +209,6 @@ killclient(Arg *arg)
void void
manage(Window w, XWindowAttributes *wa) manage(Window w, XWindowAttributes *wa)
{ {
unsigned int i;
Client *c; Client *c;
Window trans; Window trans;
XSetWindowAttributes twa; XSetWindowAttributes twa;
@ -247,7 +257,8 @@ manage(Window w, XWindowAttributes *wa)
if(clients) if(clients)
clients->prev = c; clients->prev = c;
c->next = clients; c->next = clients;
clients = c; c->snext = stack;
stack = clients = c;
settitle(c); settitle(c);
ban(c); ban(c);
@ -403,19 +414,16 @@ togglemax(Arg *arg)
void void
unmanage(Client *c) unmanage(Client *c)
{ {
Client *tc, *fc; Client *nc;
Window trans;
XGrabServer(dpy); XGrabServer(dpy);
XSetErrorHandler(xerrordummy); XSetErrorHandler(xerrordummy);
detach(c); detach(c);
detachstack(c);
if(sel == c) { if(sel == c) {
XGetTransientForHint(dpy, c->win, &trans); for(nc = stack; nc && !isvisible(nc); nc = nc->snext);
if(trans && (tc = getclient(trans)) && isvisible(tc)) focus(nc);
fc = tc;
else
fc = getnext(clients);
focus(fc);
} }
XUngrabButton(dpy, AnyButton, AnyModifier, c->win); XUngrabButton(dpy, AnyButton, AnyModifier, c->win);

View File

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

136
dwm.1
View File

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

3
dwm.h
View File

@ -61,6 +61,7 @@ struct Client {
Bool *tags; Bool *tags;
Client *next; Client *next;
Client *prev; Client *prev;
Client *snext;
Window win; Window win;
Window twin; Window twin;
}; };
@ -73,7 +74,7 @@ extern void (*handler[LASTEvent])(XEvent *);
extern void (*arrange)(Arg *); extern void (*arrange)(Arg *);
extern Atom wmatom[WMLast], netatom[NetLast]; extern Atom wmatom[WMLast], netatom[NetLast];
extern Bool running, issel, maximized, *seltag; extern Bool running, issel, maximized, *seltag;
extern Client *clients, *sel; extern Client *clients, *sel, *stack;
extern Cursor cursor[CurLast]; extern Cursor cursor[CurLast];
extern DC dc; extern DC dc;
extern Display *dpy; extern Display *dpy;

1
main.c
View File

@ -27,6 +27,7 @@ Bool issel = True;
Bool maximized = False; Bool maximized = False;
Client *clients = NULL; Client *clients = NULL;
Client *sel = NULL; Client *sel = NULL;
Client *stack = NULL;
Cursor cursor[CurLast]; Cursor cursor[CurLast];
Display *dpy; Display *dpy;
DC dc = {0}; DC dc = {0};

18
view.c
View File

@ -12,13 +12,14 @@ minclient()
{ {
Client *c, *min; Client *c, *min;
if((clients && clients->isfloat) || arrange == dofloat)
return clients; /* don't touch floating order */
for(min = c = clients; c; c = c->next) for(min = c = clients; c; c = c->next)
if(c->weight < min->weight) if(c->weight < min->weight)
min = c; min = c;
return min; return min;
} }
static void static void
reorder() reorder()
{ {
@ -75,8 +76,10 @@ dofloat(Arg *arg)
else else
ban(c); ban(c);
} }
if(!sel || !isvisible(sel)) if(!sel || !isvisible(sel)) {
focus(getnext(clients)); for(c = stack; c && !isvisible(c); c = c->snext);
focus(c);
}
restack(); restack();
} }
@ -137,8 +140,10 @@ dotile(Arg *arg)
else else
ban(c); ban(c);
} }
if(!sel || !isvisible(sel)) if(!sel || !isvisible(sel)) {
focus(getnext(clients)); for(c = stack; c && !isvisible(c); c = c->snext);
focus(c);
}
restack(); restack();
} }
@ -298,8 +303,9 @@ zoom(Arg *arg)
if(!(c = nexttiled(c->next))) if(!(c = nexttiled(c->next)))
return; return;
detach(c); detach(c);
c->next = clients; if(clients)
clients->prev = c; clients->prev = c;
c->next = clients;
clients = c; clients = c;
focus(c); focus(c);
arrange(NULL); arrange(NULL);