Compare commits
48 Commits
Author | SHA1 | Date | |
---|---|---|---|
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 | |||
01d13b0c49 | |||
f15f45a9f8 | |||
1b2e149cb4 | |||
6136640ec9 | |||
95d8423823 | |||
de6411c338 | |||
e316cf53f6 | |||
c107db57db | |||
d39d00057c | |||
26157e6973 | |||
6d22782e8f | |||
1836b6740d | |||
924a088812 | |||
bab575c868 | |||
daae3bba50 | |||
05fbbbd8dc | |||
4c368bcd24 | |||
9927b9e642 | |||
1b492dffc8 |
2
.hgtags
2
.hgtags
@ -9,3 +9,5 @@ cd15de32e173f8ce97bfe1c9b6607937b59056b4 0.8
|
||||
fae61afa861755636c4a1070694209ace8efbb6c 0.9
|
||||
bbc98e77ae89a7c9232a5be0835f60ea00d8036e 1.0
|
||||
44a55e6e46bf6c231780b09d919977d6f01083de 1.1
|
||||
e3179ce2b90451d2807cd53b589d768412b8666b 1.2
|
||||
f5f5cbf016a94b48a8fe9c47f0736e96d166d5d4 1.3
|
||||
|
63
client.c
63
client.c
@ -82,22 +82,29 @@ ban(Client *c)
|
||||
void
|
||||
focus(Client *c)
|
||||
{
|
||||
Client *old = sel;
|
||||
Client *old;
|
||||
|
||||
if(!issel)
|
||||
return;
|
||||
if(!sel)
|
||||
sel = c;
|
||||
else if(sel != c) {
|
||||
if(sel->ismax)
|
||||
if(maximized)
|
||||
togglemax(NULL);
|
||||
old = sel;
|
||||
sel = c;
|
||||
grabbuttons(old, False);
|
||||
drawtitle(old);
|
||||
if(old) {
|
||||
grabbuttons(old, False);
|
||||
drawtitle(old);
|
||||
}
|
||||
}
|
||||
grabbuttons(c, True);
|
||||
drawtitle(c);
|
||||
XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime);
|
||||
if(c) {
|
||||
grabbuttons(c, True);
|
||||
drawtitle(c);
|
||||
XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime);
|
||||
}
|
||||
else
|
||||
XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
|
||||
}
|
||||
|
||||
Client *
|
||||
@ -192,7 +199,7 @@ void
|
||||
manage(Window w, XWindowAttributes *wa)
|
||||
{
|
||||
unsigned int i;
|
||||
Client *c, *tc;
|
||||
Client *c;
|
||||
Window trans;
|
||||
XSetWindowAttributes twa;
|
||||
|
||||
@ -231,11 +238,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 &&
|
||||
@ -247,13 +250,12 @@ manage(Window w, XWindowAttributes *wa)
|
||||
clients = c;
|
||||
|
||||
settitle(c);
|
||||
if(isvisible(c))
|
||||
sel = c;
|
||||
arrange(NULL);
|
||||
ban(c);
|
||||
XMapWindow(dpy, c->win);
|
||||
XMapWindow(dpy, c->twin);
|
||||
if(isvisible(c))
|
||||
focus(c);
|
||||
arrange(NULL);
|
||||
}
|
||||
|
||||
void
|
||||
@ -366,12 +368,13 @@ void
|
||||
togglemax(Arg *arg)
|
||||
{
|
||||
int ox, oy, ow, oh;
|
||||
Client *c;
|
||||
XEvent ev;
|
||||
|
||||
if(!sel)
|
||||
return;
|
||||
|
||||
if((sel->ismax = !sel->ismax)) {
|
||||
if((maximized = !maximized)) {
|
||||
ox = sel->x;
|
||||
oy = sel->y;
|
||||
ow = sel->w;
|
||||
@ -382,6 +385,9 @@ togglemax(Arg *arg)
|
||||
sel->h = sh - 2 - bh;
|
||||
|
||||
restack();
|
||||
for(c = getnext(clients); c; c = getnext(c->next))
|
||||
if(c != sel)
|
||||
ban(c);
|
||||
resize(sel, arrange == dofloat, TopLeft);
|
||||
|
||||
sel->x = ox;
|
||||
@ -390,37 +396,36 @@ togglemax(Arg *arg)
|
||||
sel->h = oh;
|
||||
}
|
||||
else
|
||||
resize(sel, False, TopLeft);
|
||||
arrange(NULL);
|
||||
while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
|
||||
}
|
||||
|
||||
void
|
||||
unmanage(Client *c)
|
||||
{
|
||||
Client *tc;
|
||||
Client *tc, *fc;
|
||||
Window trans;
|
||||
XGrabServer(dpy);
|
||||
XSetErrorHandler(xerrordummy);
|
||||
|
||||
XGetTransientForHint(dpy, c->win, &trans);
|
||||
detach(c);
|
||||
if(sel == c) {
|
||||
XGetTransientForHint(dpy, c->win, &trans);
|
||||
if(trans && (tc = getclient(trans)) && isvisible(tc))
|
||||
fc = tc;
|
||||
else
|
||||
fc = getnext(clients);
|
||||
focus(fc);
|
||||
}
|
||||
|
||||
XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
|
||||
XDestroyWindow(dpy, c->twin);
|
||||
|
||||
detach(c);
|
||||
if(sel == c) {
|
||||
if(trans && (tc = getclient(trans)) && isvisible(tc))
|
||||
sel = tc;
|
||||
else
|
||||
sel = getnext(clients);
|
||||
}
|
||||
free(c->tags);
|
||||
free(c);
|
||||
|
||||
XSync(dpy, False);
|
||||
XSetErrorHandler(xerror);
|
||||
XUngrabServer(dpy);
|
||||
if(sel)
|
||||
focus(sel);
|
||||
arrange(NULL);
|
||||
}
|
||||
|
@ -27,13 +27,15 @@ static Key key[] = { \
|
||||
{ MODKEY|ShiftMask, XK_Return, spawn, \
|
||||
{ .cmd = "exec uxterm -bg '#111111' -fg '#eeeeee' -cr '#eeeeee' +sb -fn '"FONT"'" } }, \
|
||||
{ MODKEY, XK_p, spawn, \
|
||||
{ .cmd = "exec \"$(IFS=:; for dir in $PATH; do " \
|
||||
"for file in \"$dir\"/*; do [ -x \"$file\" ] && echo \"${file##*/}\"; done; " \
|
||||
"done | sort -u | dmenu)\"" } }, \
|
||||
{ .cmd = "exe=\"$(IFS=:; for dir in $PATH; do " \
|
||||
"for file in \"$dir\"/*; do [ -x \"$file\" ] && echo \"${file##*/}\"; done; " \
|
||||
"done | sort -u | dmenu)\" && exec \"$exe\"" } }, \
|
||||
{ MODKEY, XK_j, focusnext, { 0 } }, \
|
||||
{ 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 } }, \
|
||||
@ -44,6 +46,7 @@ static Key key[] = { \
|
||||
{ MODKEY|ControlMask|ShiftMask, XK_4, toggletag, { .i = 3 } }, \
|
||||
{ MODKEY|ShiftMask, XK_c, killclient, { 0 } }, \
|
||||
{ MODKEY, XK_space, togglemode, { 0 } }, \
|
||||
{ MODKEY, XK_0, viewall, { 0 } }, \
|
||||
{ MODKEY, XK_1, view, { .i = 0 } }, \
|
||||
{ MODKEY, XK_2, view, { .i = 1 } }, \
|
||||
{ MODKEY, XK_3, view, { .i = 2 } }, \
|
||||
|
@ -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 } }, \
|
||||
@ -41,6 +43,7 @@ static Key key[] = { \
|
||||
{ MODKEY|ControlMask|ShiftMask, XK_5, toggletag, { .i = 4 } }, \
|
||||
{ MODKEY|ShiftMask, XK_c, killclient, { 0 } }, \
|
||||
{ MODKEY, XK_space, togglemode, { 0 } }, \
|
||||
{ MODKEY, XK_0, viewall, { 0 } }, \
|
||||
{ MODKEY, XK_1, view, { .i = 0 } }, \
|
||||
{ MODKEY, XK_2, view, { .i = 1 } }, \
|
||||
{ MODKEY, XK_3, view, { .i = 2 } }, \
|
||||
|
@ -1,5 +1,5 @@
|
||||
# dwm version
|
||||
VERSION = 1.2
|
||||
VERSION = 1.4
|
||||
|
||||
# Customize below to fit your system
|
||||
|
||||
|
36
dwm.1
36
dwm.1
@ -51,6 +51,18 @@ mode.
|
||||
click on a tag label adds/removes all windows with that
|
||||
.B tag
|
||||
to/from the view.
|
||||
.TP
|
||||
.B Mod1-Button1
|
||||
click on a tag label applies that
|
||||
.B tag
|
||||
to the focused
|
||||
.BR window .
|
||||
.TP
|
||||
.B Mod1-Button3
|
||||
click on a tag label adds/removes that
|
||||
.B tag
|
||||
to/from the focused
|
||||
.BR window .
|
||||
.SS Keyboard commands
|
||||
.TP
|
||||
.B Mod1-Shift-Return
|
||||
@ -78,13 +90,25 @@ mode only).
|
||||
Maximize current
|
||||
.BR window .
|
||||
.TP
|
||||
.B Mod1-Shift-[0..n]
|
||||
.B Mod1-g
|
||||
Grow current
|
||||
.BR column
|
||||
.RB ( tiling
|
||||
mode only).
|
||||
.TP
|
||||
.B Mod1-s
|
||||
Shrink current
|
||||
.BR column
|
||||
.RB ( tiling
|
||||
mode only).
|
||||
.TP
|
||||
.B Mod1-Shift-[1..n]
|
||||
Apply
|
||||
.B nth tag
|
||||
to current
|
||||
.BR window .
|
||||
.TP
|
||||
.B Mod1-Control-Shift-[0..n]
|
||||
.B Mod1-Control-Shift-[1..n]
|
||||
Add/remove
|
||||
.B nth tag
|
||||
to/from current
|
||||
@ -102,11 +126,15 @@ and
|
||||
mode (affects
|
||||
.BR "all windows" ).
|
||||
.TP
|
||||
.B Mod1-[0..n]
|
||||
.B Mod1-[1..n]
|
||||
View all windows with
|
||||
.BR "tag n" .
|
||||
.TP
|
||||
.B Mod1-Control-[0..n]
|
||||
.B Mod1-0
|
||||
View all windows with any
|
||||
.BR "tag" .
|
||||
.TP
|
||||
.B Mod1-Control-[1..n]
|
||||
Add/remove all windows with
|
||||
.B tag n
|
||||
to/from the view.
|
||||
|
7
dwm.h
7
dwm.h
@ -58,7 +58,6 @@ struct Client {
|
||||
long flags;
|
||||
unsigned int border, weight;
|
||||
Bool isfloat;
|
||||
Bool ismax;
|
||||
Bool *tags;
|
||||
Client *next;
|
||||
Client *prev;
|
||||
@ -73,7 +72,7 @@ extern unsigned int ntags, numlockmask;
|
||||
extern void (*handler[LASTEvent])(XEvent *);
|
||||
extern void (*arrange)(Arg *);
|
||||
extern Atom wmatom[WMLast], netatom[NetLast];
|
||||
extern Bool running, issel, *seltag;
|
||||
extern Bool running, issel, maximized, *seltag;
|
||||
extern Client *clients, *sel;
|
||||
extern Cursor cursor[CurLast];
|
||||
extern DC dc;
|
||||
@ -116,7 +115,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);
|
||||
|
||||
@ -133,8 +132,10 @@ 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);
|
||||
extern void view(Arg *arg);
|
||||
extern void viewall(Arg *arg);
|
||||
extern void zoom(Arg *arg);
|
||||
|
127
dwm.html
127
dwm.html
@ -1,127 +0,0 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>dwm - dynamic window manager</title>
|
||||
<meta name="author" content="Anselm R. Garbe">
|
||||
<meta name="generator" content="ed">
|
||||
<meta name="copyright" content="(C)opyright 2006 by Anselm R. Garbe">
|
||||
<link rel="dwm icon" href="favicon.ico" type="image/x-icon" />
|
||||
<style type="text/css">
|
||||
body {
|
||||
color: #000000;
|
||||
font-family: sans-serif;
|
||||
margin: 20px 20px 20px 20px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<center>
|
||||
<img src="dwm.png"/><br />
|
||||
<h3>dynamic window manager</h3>
|
||||
</center>
|
||||
<h3>Description</h3>
|
||||
<p>
|
||||
dwm is a dynamic window manager for X11.
|
||||
</p>
|
||||
<h4>Background</h4>
|
||||
<p>
|
||||
As founder and main developer of wmii I came to the conclusion that
|
||||
wmii is too clunky for my needs. I don't need so many funky features
|
||||
and all this hype about remote control through a 9P service, I only
|
||||
want to manage my windows in a simple, but dynamic way. wmii never got
|
||||
finished because I listened to users, who proposed arbitrary ideas I
|
||||
considered useful. This resulted in an extreme <a
|
||||
href="http://www.jwz.org/doc/cadt.html">CADT</a> development model,
|
||||
which was a mistake. Thus the philosophy of dwm is simply <i>to fit my
|
||||
needs</i> (maybe yours as well). That's it.
|
||||
</p>
|
||||
<h4>Differences to ion, larswm, and wmii</h4>
|
||||
<p>
|
||||
In contrast to ion, larswm, and wmii, dwm is much smaller, faster and simpler.
|
||||
</p>
|
||||
<ul>
|
||||
<li>
|
||||
dwm has no Lua integration, no 9P support, no editable
|
||||
tagbars, no shell-based configuration, no remote control, and comes
|
||||
without any additional tools like printing the selection or warping
|
||||
the mouse.
|
||||
</li>
|
||||
<li>
|
||||
dwm is only a single binary, it's source code is intended to never
|
||||
exceed 2000 SLOC.
|
||||
</li>
|
||||
<li>
|
||||
dwm is based on tagging and dynamic window management (however
|
||||
simpler than ion, wmii or larswm). It manages windows in
|
||||
tiling and floating modes. Either mode can be applied dynamically,
|
||||
depending on the application in use and the task performed.
|
||||
</li>
|
||||
<li>
|
||||
dwm doesn't distinguishes between layers, there is no floating or
|
||||
tiled layer. Wether the clients of currently selected tag are in
|
||||
tiled mode or not, you can re-arrange all clients on the fly.
|
||||
Popup- and fixed-size windows are treated floating, however.
|
||||
</li>
|
||||
<li>
|
||||
dwm is customized through editing its source code, that makes it
|
||||
extremely fast and secure - it does not process any input data
|
||||
which hasn't been known at compile time, except window title names
|
||||
and status text read from standard input. You don't have to learn
|
||||
Lua/sh/ruby or some weird configuration file format (like X
|
||||
resource files), beside C to customize it for your needs,
|
||||
you <b>only</b> have to learn C (at least editing header files).
|
||||
</li>
|
||||
<li>
|
||||
Because dwm is customized through editing its source code, it's
|
||||
pointless to make binary packages of it. This keeps its userbase
|
||||
small and elitist. No novices asking stupid questions.
|
||||
</li>
|
||||
<li>
|
||||
dwm uses 1-pixel borders to provide the maximum of screen real
|
||||
estate to clients. Small titlebars are only drawn in front of
|
||||
unfocused clients.
|
||||
</li>
|
||||
<li>
|
||||
dwm reads from standard input to print arbitrary status text (like
|
||||
the date, load, battery charge). That's much simpler than
|
||||
larsremote, wmiir and what not...
|
||||
</li>
|
||||
<li>
|
||||
It can be downloaded and distributed under the conditions
|
||||
of the <a href="http://10kloc.org/cgi-bin/hgwebdir.cgi/dwm?f=f10eb1139362;file=LICENSE;style=raw">MIT/X Consortium license</a>.
|
||||
</li>
|
||||
<li>
|
||||
Optionally you can install <b>dmenu</b> to extend dwm with a wmii-alike menu.
|
||||
</li>
|
||||
</ul>
|
||||
<h4>Links</h4>
|
||||
<ul>
|
||||
<li><a href="http://10kloc.org/cgi-bin/man/man2html?query=dwm">Man page</a></li>
|
||||
<li><a href="http://10kloc.org/shots/dwm-20060810a.png">Screenshot of tiled mode</a> (20060810)</li>
|
||||
<li><a href="http://10kloc.org/shots/dwm-20060810b.png">Screenshotof floating mode</a> (20060810)</li>
|
||||
<li><a href="http://10kloc.org/download/poster.ps">A4 poster (PostScript)</a></li>
|
||||
<li>Mailing List: <a href="http://10kloc.org/cgi-bin/mailman/listinfo/dwm">dwm at wmii dot de</a> <a href="http://10kloc.org/pipermail/dwm/">(Archives)</a> <a href="http://dir.gmane.org/gmane.comp.window-managers.dwm">(GMANE Archive)</a></li>
|
||||
<li>IRC channel: <code>#dwm</code> at <code>irc.oftc.net</code></li>
|
||||
</ul>
|
||||
<h3>Download</h3>
|
||||
<ul>
|
||||
<li><a href="http://10kloc.org/download/dwm-1.2.tar.gz">dwm 1.2</a> (15kb) (20060830)</li>
|
||||
<li><a href="http://10kloc.org/download/dmenu-0.6.tar.gz">dmenu 0.6</a> (7kb) (20060828)</li>
|
||||
</ul>
|
||||
<h3>Development</h3>
|
||||
<p>
|
||||
dwm is actively developed in parallel to wmii. You can <a href="http://10kloc.org/cgi-bin/hgwebdir.cgi/dwm">browse</a> its source code repository or get a copy using <a href="http://www.selenic.com/mercurial/">Mercurial</a> with following command:
|
||||
</p>
|
||||
<p>
|
||||
<code>hg clone http://10kloc.org/cgi-bin/hgwebdir.cgi/dwm</code>
|
||||
</p>
|
||||
<p>
|
||||
<code>hg clone http://10kloc.org/cgi-bin/hgwebdir.cgi/dmenu</code>
|
||||
</p>
|
||||
<h3>Miscellaneous</h3>
|
||||
<p>
|
||||
You can purchase this <a href="https://www.spreadshirt.net/shop.php?op=article&article_id=3298632&view=403">tricot</a>
|
||||
if you like dwm and the dwm logo, which has been designed by Anselm.
|
||||
</p>
|
||||
<p><small>--Anselm</small></p>
|
||||
</body>
|
||||
</html>
|
45
event.c
45
event.c
@ -109,10 +109,18 @@ buttonpress(XEvent *e)
|
||||
for(a.i = 0; a.i < ntags; a.i++) {
|
||||
x += textw(tags[a.i]);
|
||||
if(ev->x < x) {
|
||||
if(ev->button == Button1)
|
||||
view(&a);
|
||||
else if(ev->button == Button3)
|
||||
toggleview(&a);
|
||||
if(ev->button == Button1) {
|
||||
if(ev->state & MODKEY)
|
||||
tag(&a);
|
||||
else
|
||||
view(&a);
|
||||
}
|
||||
else if(ev->button == Button3) {
|
||||
if(ev->state & MODKEY)
|
||||
toggletag(&a);
|
||||
else
|
||||
toggleview(&a);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -123,26 +131,17 @@ buttonpress(XEvent *e)
|
||||
}
|
||||
else if((c = getclient(ev->window))) {
|
||||
focus(c);
|
||||
if(CLEANMASK(ev->state) != MODKEY)
|
||||
if(maximized || CLEANMASK(ev->state) != MODKEY)
|
||||
return;
|
||||
switch(ev->button) {
|
||||
default:
|
||||
break;
|
||||
case Button1:
|
||||
if(!c->ismax && (arrange == dofloat || c->isfloat)) {
|
||||
restack(c);
|
||||
movemouse(c);
|
||||
}
|
||||
break;
|
||||
case Button2:
|
||||
if(ev->button == Button1 && (arrange == dofloat || c->isfloat)) {
|
||||
restack(c);
|
||||
movemouse(c);
|
||||
}
|
||||
else if(ev->button == Button2)
|
||||
zoom(NULL);
|
||||
break;
|
||||
case Button3:
|
||||
if(!c->ismax && (arrange == dofloat || c->isfloat)) {
|
||||
restack(c);
|
||||
resizemouse(c);
|
||||
}
|
||||
break;
|
||||
else if(ev->button == Button3 && (arrange == dofloat || c->isfloat)) {
|
||||
restack(c);
|
||||
resizemouse(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -174,7 +173,7 @@ configurerequest(XEvent *e)
|
||||
XWindowChanges wc;
|
||||
|
||||
if((c = getclient(ev->window))) {
|
||||
if(!c->isfloat && (arrange != dofloat) && c->ismax) {
|
||||
if((c == sel) && !c->isfloat && (arrange != dofloat) && maximized) {
|
||||
synconfig(c, sx, sy + bh, sw - 2, sh - 2 - bh, ev->border_width);
|
||||
XSync(dpy, False);
|
||||
return;
|
||||
|
BIN
favicon.ico
BIN
favicon.ico
Binary file not shown.
Before Width: | Height: | Size: 198 B |
2
main.c
2
main.c
@ -24,6 +24,7 @@ unsigned int ntags, numlockmask;
|
||||
Atom wmatom[WMLast], netatom[NetLast];
|
||||
Bool running = True;
|
||||
Bool issel = True;
|
||||
Bool maximized = False;
|
||||
Client *clients = NULL;
|
||||
Client *sel = NULL;
|
||||
Cursor cursor[CurLast];
|
||||
@ -54,6 +55,7 @@ cleanup()
|
||||
XDestroyWindow(dpy, barwin);
|
||||
XSetInputFocus(dpy, PointerRoot, RevertToPointerRoot, CurrentTime);
|
||||
XSync(dpy, False);
|
||||
free(seltag);
|
||||
}
|
||||
|
||||
static void
|
||||
|
30
tag.c
30
tag.c
@ -30,17 +30,6 @@ RULES
|
||||
static RReg *rreg = NULL;
|
||||
static unsigned int len = 0;
|
||||
|
||||
static void
|
||||
commit()
|
||||
{
|
||||
/* asserts sel != NULL */
|
||||
settitle(sel);
|
||||
if(!isvisible(sel))
|
||||
arrange(NULL);
|
||||
else
|
||||
drawstatus();
|
||||
}
|
||||
|
||||
/* extern */
|
||||
|
||||
Client *
|
||||
@ -87,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);
|
||||
@ -117,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
|
||||
@ -132,7 +124,8 @@ tag(Arg *arg)
|
||||
for(i = 0; i < ntags; i++)
|
||||
sel->tags[i] = False;
|
||||
sel->tags[arg->i] = True;
|
||||
commit();
|
||||
sel->weight = arg->i;
|
||||
arrange(NULL);
|
||||
}
|
||||
|
||||
void
|
||||
@ -147,5 +140,6 @@ toggletag(Arg *arg)
|
||||
for(i = 0; i < ntags && !sel->tags[i]; i++);
|
||||
if(i == ntags)
|
||||
sel->tags[arg->i] = True;
|
||||
commit();
|
||||
sel->weight = (i == ntags) ? arg->i : i;
|
||||
arrange(NULL);
|
||||
}
|
||||
|
117
view.c
117
view.c
@ -38,6 +38,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;
|
||||
@ -59,18 +66,17 @@ dofloat(Arg *arg)
|
||||
{
|
||||
Client *c;
|
||||
|
||||
maximized = False;
|
||||
|
||||
for(c = clients; c; c = c->next) {
|
||||
c->ismax = False;
|
||||
if(isvisible(c)) {
|
||||
resize(c, True, TopLeft);
|
||||
}
|
||||
else
|
||||
ban(c);
|
||||
}
|
||||
if((sel = getnext(clients)))
|
||||
focus(sel);
|
||||
else
|
||||
XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
|
||||
if(!sel || !isvisible(sel))
|
||||
focus(getnext(clients));
|
||||
restack();
|
||||
}
|
||||
|
||||
@ -80,6 +86,8 @@ dotile(Arg *arg)
|
||||
int h, i, n, w;
|
||||
Client *c;
|
||||
|
||||
maximized = False;
|
||||
|
||||
w = sw - mw;
|
||||
for(n = 0, c = clients; c; c = c->next)
|
||||
if(isvisible(c) && !c->isfloat)
|
||||
@ -91,7 +99,6 @@ dotile(Arg *arg)
|
||||
h = sh - bh;
|
||||
|
||||
for(i = 0, c = clients; c; c = c->next) {
|
||||
c->ismax = False;
|
||||
if(isvisible(c)) {
|
||||
if(c->isfloat) {
|
||||
resize(c, True, TopLeft);
|
||||
@ -130,10 +137,8 @@ dotile(Arg *arg)
|
||||
else
|
||||
ban(c);
|
||||
}
|
||||
if((sel = getnext(clients)))
|
||||
focus(sel);
|
||||
else
|
||||
XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
|
||||
if(!sel || !isvisible(sel))
|
||||
focus(getnext(clients));
|
||||
restack();
|
||||
}
|
||||
|
||||
@ -182,53 +187,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));
|
||||
@ -269,16 +271,31 @@ view(Arg *arg)
|
||||
arrange(NULL);
|
||||
}
|
||||
|
||||
void
|
||||
viewall(Arg *arg)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
for(i = 0; i < ntags; i++)
|
||||
seltag[i] = True;
|
||||
reorder();
|
||||
arrange(NULL);
|
||||
}
|
||||
|
||||
void
|
||||
zoom(Arg *arg)
|
||||
{
|
||||
Client *c = sel;
|
||||
unsigned int n;
|
||||
Client *c;
|
||||
|
||||
if(!c || (arrange != dotile) || c->isfloat || c->ismax)
|
||||
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);
|
||||
c->next = clients;
|
||||
|
Reference in New Issue
Block a user