Compare commits
41 Commits
Author | SHA1 | Date | |
---|---|---|---|
0925dd588c | |||
6f20315dff | |||
2e68f22118 | |||
8aa860d270 | |||
15abade272 | |||
7ab8c87281 | |||
4ff8f71643 | |||
d22abeee86 | |||
a33150eb4b | |||
fd00b3a186 | |||
e8389a4cc0 | |||
6078d756bc | |||
57c49fe867 | |||
c60de1acd4 | |||
69b738c097 | |||
da0b2a2f31 | |||
2378a558a2 | |||
f18ed615ae | |||
f6656fffb4 | |||
aaad7bfd15 | |||
0915da8842 | |||
0d0e8bde13 | |||
838a1ff950 | |||
e1315fd40c | |||
52a3ab1042 | |||
a82e7b765e | |||
0ed0fa4d5b | |||
ec85fddb9a | |||
3a1343a245 | |||
9066ee2eb4 | |||
40bd21ce63 | |||
4633fbec61 | |||
25060031a5 | |||
c7ae6334b7 | |||
eac04882b4 | |||
6499fc4f93 | |||
04f27a5438 | |||
1b3903d6e9 | |||
cc05093b0d | |||
6436dd4438 | |||
26c50c780e |
4
.hgtags
4
.hgtags
@ -10,5 +10,5 @@ fae61afa861755636c4a1070694209ace8efbb6c 0.9
|
|||||||
bbc98e77ae89a7c9232a5be0835f60ea00d8036e 1.0
|
bbc98e77ae89a7c9232a5be0835f60ea00d8036e 1.0
|
||||||
44a55e6e46bf6c231780b09d919977d6f01083de 1.1
|
44a55e6e46bf6c231780b09d919977d6f01083de 1.1
|
||||||
e3179ce2b90451d2807cd53b589d768412b8666b 1.2
|
e3179ce2b90451d2807cd53b589d768412b8666b 1.2
|
||||||
6413ea66b1c2496cfc2173fe58df67cb965eb1da 1.3
|
f5f5cbf016a94b48a8fe9c47f0736e96d166d5d4 1.3
|
||||||
dd44dc937e8b0a46abf1a15a333dba5304e4fe89 1.3
|
3cff9403766bf83a9fc2a0aef230115d68de2a8e 1.4
|
||||||
|
36
client.c
36
client.c
@ -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,8 +209,7 @@ killclient(Arg *arg)
|
|||||||
void
|
void
|
||||||
manage(Window w, XWindowAttributes *wa)
|
manage(Window w, XWindowAttributes *wa)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
Client *c;
|
||||||
Client *c, *tc;
|
|
||||||
Window trans;
|
Window trans;
|
||||||
XSetWindowAttributes twa;
|
XSetWindowAttributes twa;
|
||||||
|
|
||||||
@ -238,11 +248,7 @@ manage(Window w, XWindowAttributes *wa)
|
|||||||
CWOverrideRedirect | CWBackPixmap | CWEventMask, &twa);
|
CWOverrideRedirect | CWBackPixmap | CWEventMask, &twa);
|
||||||
|
|
||||||
grabbuttons(c, False);
|
grabbuttons(c, False);
|
||||||
if((tc = getclient(trans))) /* inherit tags */
|
settags(c, getclient(trans));
|
||||||
for(i = 0; i < ntags; i++)
|
|
||||||
c->tags[i] = tc->tags[i];
|
|
||||||
else
|
|
||||||
settags(c);
|
|
||||||
if(!c->isfloat)
|
if(!c->isfloat)
|
||||||
c->isfloat = trans
|
c->isfloat = trans
|
||||||
|| (c->maxw && c->minw &&
|
|| (c->maxw && c->minw &&
|
||||||
@ -251,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);
|
||||||
@ -407,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);
|
||||||
|
@ -34,6 +34,8 @@ static Key key[] = { \
|
|||||||
{ MODKEY, XK_k, focusprev, { 0 } }, \
|
{ MODKEY, XK_k, focusprev, { 0 } }, \
|
||||||
{ MODKEY, XK_Return, zoom, { 0 } }, \
|
{ MODKEY, XK_Return, zoom, { 0 } }, \
|
||||||
{ MODKEY, XK_m, togglemax, { 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_1, tag, { .i = 0 } }, \
|
||||||
{ MODKEY|ShiftMask, XK_2, tag, { .i = 1 } }, \
|
{ MODKEY|ShiftMask, XK_2, tag, { .i = 1 } }, \
|
||||||
{ MODKEY|ShiftMask, XK_3, tag, { .i = 2 } }, \
|
{ MODKEY|ShiftMask, XK_3, tag, { .i = 2 } }, \
|
||||||
|
@ -7,8 +7,8 @@
|
|||||||
const char *tags[] = { "1", "2", "3", "4", "5", NULL };
|
const char *tags[] = { "1", "2", "3", "4", "5", NULL };
|
||||||
|
|
||||||
#define DEFMODE dotile /* dofloat */
|
#define DEFMODE dotile /* dofloat */
|
||||||
#define FLOATSYMBOL "~"
|
#define FLOATSYMBOL "><>"
|
||||||
#define TILESYMBOL "#"
|
#define TILESYMBOL "[]="
|
||||||
|
|
||||||
#define FONT "fixed"
|
#define FONT "fixed"
|
||||||
#define SELBGCOLOR "#666699"
|
#define SELBGCOLOR "#666699"
|
||||||
@ -29,6 +29,8 @@ static Key key[] = { \
|
|||||||
{ MODKEY|ShiftMask, XK_Tab, focusprev, { 0 } }, \
|
{ MODKEY|ShiftMask, XK_Tab, focusprev, { 0 } }, \
|
||||||
{ MODKEY, XK_Return, zoom, { 0 } }, \
|
{ MODKEY, XK_Return, zoom, { 0 } }, \
|
||||||
{ MODKEY, XK_m, togglemax, { 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_1, tag, { .i = 0 } }, \
|
||||||
{ MODKEY|ShiftMask, XK_2, tag, { .i = 1 } }, \
|
{ MODKEY|ShiftMask, XK_2, tag, { .i = 1 } }, \
|
||||||
{ MODKEY|ShiftMask, XK_3, tag, { .i = 2 } }, \
|
{ MODKEY|ShiftMask, XK_3, tag, { .i = 2 } }, \
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# dwm version
|
# dwm version
|
||||||
VERSION = 1.3
|
VERSION = 1.5
|
||||||
|
|
||||||
# Customize below to fit your system
|
# Customize below to fit your system
|
||||||
|
|
||||||
|
132
dwm.1
132
dwm.1
@ -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,102 +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
|
||||||
|
.B Mod1-g
|
||||||
|
Grow current column (tiling mode only).
|
||||||
|
.TP
|
||||||
|
.B Mod1-s
|
||||||
|
Shrink current column (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)
|
||||||
|
6
dwm.h
6
dwm.h
@ -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;
|
||||||
@ -115,7 +116,7 @@ extern int xerror(Display *dsply, XErrorEvent *ee);
|
|||||||
extern void initrregs();
|
extern void initrregs();
|
||||||
extern Client *getnext(Client *c);
|
extern Client *getnext(Client *c);
|
||||||
extern Client *getprev(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 tag(Arg *arg);
|
||||||
extern void toggletag(Arg *arg);
|
extern void toggletag(Arg *arg);
|
||||||
|
|
||||||
@ -132,6 +133,7 @@ extern void dotile(Arg *arg);
|
|||||||
extern void focusnext(Arg *arg);
|
extern void focusnext(Arg *arg);
|
||||||
extern void focusprev(Arg *arg);
|
extern void focusprev(Arg *arg);
|
||||||
extern Bool isvisible(Client *c);
|
extern Bool isvisible(Client *c);
|
||||||
|
extern void resizecol(Arg *arg);
|
||||||
extern void restack();
|
extern void restack();
|
||||||
extern void togglemode(Arg *arg);
|
extern void togglemode(Arg *arg);
|
||||||
extern void toggleview(Arg *arg);
|
extern void toggleview(Arg *arg);
|
||||||
|
2
main.c
2
main.c
@ -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};
|
||||||
@ -55,6 +56,7 @@ cleanup()
|
|||||||
XDestroyWindow(dpy, barwin);
|
XDestroyWindow(dpy, barwin);
|
||||||
XSetInputFocus(dpy, PointerRoot, RevertToPointerRoot, CurrentTime);
|
XSetInputFocus(dpy, PointerRoot, RevertToPointerRoot, CurrentTime);
|
||||||
XSync(dpy, False);
|
XSync(dpy, False);
|
||||||
|
free(seltag);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
15
tag.c
15
tag.c
@ -76,15 +76,19 @@ initrregs()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
settags(Client *c)
|
settags(Client *c, Client *trans)
|
||||||
{
|
{
|
||||||
char prop[512];
|
char prop[512];
|
||||||
unsigned int i, j;
|
unsigned int i, j;
|
||||||
regmatch_t tmp;
|
regmatch_t tmp;
|
||||||
Bool matched = False;
|
Bool matched = trans != NULL;
|
||||||
XClassHint ch;
|
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",
|
snprintf(prop, sizeof(prop), "%s:%s:%s",
|
||||||
ch.res_class ? ch.res_class : "",
|
ch.res_class ? ch.res_class : "",
|
||||||
ch.res_name ? ch.res_name : "", c->name);
|
ch.res_name ? ch.res_name : "", c->name);
|
||||||
@ -106,8 +110,7 @@ settags(Client *c)
|
|||||||
if(!matched)
|
if(!matched)
|
||||||
for(i = 0; i < ntags; i++)
|
for(i = 0; i < ntags; i++)
|
||||||
c->tags[i] = seltag[i];
|
c->tags[i] = seltag[i];
|
||||||
for(i = 0; i < ntags && !c->tags[i]; i++);
|
for(c->weight = 0; c->weight < ntags && !c->tags[c->weight]; c->weight++);
|
||||||
c->weight = i;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -121,6 +124,7 @@ tag(Arg *arg)
|
|||||||
for(i = 0; i < ntags; i++)
|
for(i = 0; i < ntags; i++)
|
||||||
sel->tags[i] = False;
|
sel->tags[i] = False;
|
||||||
sel->tags[arg->i] = True;
|
sel->tags[arg->i] = True;
|
||||||
|
sel->weight = arg->i;
|
||||||
arrange(NULL);
|
arrange(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -136,5 +140,6 @@ toggletag(Arg *arg)
|
|||||||
for(i = 0; i < ntags && !sel->tags[i]; i++);
|
for(i = 0; i < ntags && !sel->tags[i]; i++);
|
||||||
if(i == ntags)
|
if(i == ntags)
|
||||||
sel->tags[arg->i] = True;
|
sel->tags[arg->i] = True;
|
||||||
|
sel->weight = (i == ntags) ? arg->i : i;
|
||||||
arrange(NULL);
|
arrange(NULL);
|
||||||
}
|
}
|
||||||
|
104
view.c
104
view.c
@ -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()
|
||||||
{
|
{
|
||||||
@ -38,6 +39,13 @@ reorder()
|
|||||||
clients = newclients;
|
clients = newclients;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Client *
|
||||||
|
nexttiled(Client *c)
|
||||||
|
{
|
||||||
|
for(c = getnext(c); c && c->isfloat; c = getnext(c->next));
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
/* extern */
|
/* extern */
|
||||||
|
|
||||||
void (*arrange)(Arg *) = DEFMODE;
|
void (*arrange)(Arg *) = DEFMODE;
|
||||||
@ -68,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();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -130,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();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -180,53 +192,50 @@ isvisible(Client *c)
|
|||||||
return False;
|
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
|
void
|
||||||
restack()
|
restack()
|
||||||
{
|
{
|
||||||
static unsigned int nwins = 0;
|
|
||||||
static Window *wins = NULL;
|
|
||||||
unsigned int f, fi, m, mi, n;
|
|
||||||
Client *c;
|
Client *c;
|
||||||
XEvent ev;
|
XEvent ev;
|
||||||
|
|
||||||
for(f = 0, m = 0, c = clients; c; c = c->next)
|
if(!sel) {
|
||||||
if(isvisible(c)) {
|
|
||||||
if(c->isfloat || arrange == dofloat)
|
|
||||||
f++;
|
|
||||||
else
|
|
||||||
m++;
|
|
||||||
}
|
|
||||||
if(!(n = 2 * (f + m))) {
|
|
||||||
drawstatus();
|
drawstatus();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(nwins < n) {
|
|
||||||
nwins = n;
|
|
||||||
wins = erealloc(wins, nwins * sizeof(Window));
|
|
||||||
}
|
|
||||||
|
|
||||||
fi = 0;
|
|
||||||
mi = 2 * f;
|
|
||||||
if(sel->isfloat || arrange == dofloat) {
|
if(sel->isfloat || arrange == dofloat) {
|
||||||
wins[fi++] = sel->twin;
|
XRaiseWindow(dpy, sel->win);
|
||||||
wins[fi++] = sel->win;
|
XRaiseWindow(dpy, sel->twin);
|
||||||
}
|
}
|
||||||
else {
|
if(arrange != dofloat)
|
||||||
wins[mi++] = sel->twin;
|
for(c = nexttiled(clients); c; c = nexttiled(c->next)) {
|
||||||
wins[mi++] = sel->win;
|
XLowerWindow(dpy, c->twin);
|
||||||
|
XLowerWindow(dpy, c->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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
XRestackWindows(dpy, wins, n);
|
|
||||||
drawall();
|
drawall();
|
||||||
XSync(dpy, False);
|
XSync(dpy, False);
|
||||||
while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
|
while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
|
||||||
@ -281,17 +290,22 @@ viewall(Arg *arg)
|
|||||||
void
|
void
|
||||||
zoom(Arg *arg)
|
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;
|
return;
|
||||||
|
|
||||||
if(c == getnext(clients))
|
if((c = sel) == nexttiled(clients))
|
||||||
if(!(c = getnext(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);
|
||||||
|
Reference in New Issue
Block a user