Compare commits
21 Commits
Author | SHA1 | Date | |
---|---|---|---|
2c6be7239f | |||
d934296476 | |||
39ae286861 | |||
59e65d1709 | |||
9fdd2cd1a9 | |||
e1deda9e04 | |||
199a601611 | |||
492c6f10fc | |||
caa7ab5362 | |||
f3e672efd8 | |||
02d5dddc00 | |||
c789941bba | |||
e45b3ced67 | |||
5a9af492ae | |||
32563abe86 | |||
70c7b432ea | |||
69dfcaa317 | |||
6ee8e3e93b | |||
8439369db9 | |||
81658eaab3 | |||
81aebf8cae |
1
.hgtags
1
.hgtags
@ -43,3 +43,4 @@ baee494346e520f8dee2cee9491b8350064770d2 3.7
|
|||||||
2ea201354cf016407ea93e1e390d1422940d29b0 3.8
|
2ea201354cf016407ea93e1e390d1422940d29b0 3.8
|
||||||
55478328b2422c700c5404a774c85e77322f41a3 3.9
|
55478328b2422c700c5404a774c85e77322f41a3 3.9
|
||||||
018c3846842291cb6c009dc087e7fe2f0ef53bea 4.0
|
018c3846842291cb6c009dc087e7fe2f0ef53bea 4.0
|
||||||
|
00f4180df72b49aadb2933804fde4bfb33e5666d 4.1
|
||||||
|
3
LICENSE
3
LICENSE
@ -2,6 +2,9 @@ MIT/X Consortium License
|
|||||||
|
|
||||||
© 2006-2007 Anselm R. Garbe <garbeam at gmail dot com>
|
© 2006-2007 Anselm R. Garbe <garbeam at gmail dot com>
|
||||||
© 2006-2007 Sander van Dijk <a dot h dot vandijk at gmail dot com>
|
© 2006-2007 Sander van Dijk <a dot h dot vandijk at gmail dot com>
|
||||||
|
© 2006-2007 Jukka Salmi <jukka at salmi dot ch>
|
||||||
|
© 2007 Premysl Hruby <dfenze at gmail dot com>
|
||||||
|
© 2007 Szabolcs Nagy <nszabolcs at gmail dot com>
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a
|
Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
copy of this software and associated documentation files (the "Software"),
|
copy of this software and associated documentation files (the "Software"),
|
||||||
|
23
client.c
23
client.c
@ -1,6 +1,4 @@
|
|||||||
/* © 2006-2007 Anselm R. Garbe <garbeam at gmail dot com>
|
/* See LICENSE file for copyright and license details. */
|
||||||
* © 2006-2007 Sander van Dijk <a dot h dot vandijk at gmail dot com>
|
|
||||||
* See LICENSE file for license details. */
|
|
||||||
#include "dwm.h"
|
#include "dwm.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -129,8 +127,8 @@ detach(Client *c) {
|
|||||||
|
|
||||||
void
|
void
|
||||||
focus(Client *c) {
|
focus(Client *c) {
|
||||||
if(c && !isvisible(c))
|
if((!c && selscreen)|| (c && !isvisible(c)))
|
||||||
return;
|
for(c = stack; c && !isvisible(c); c = c->snext);
|
||||||
if(sel && sel != c) {
|
if(sel && sel != c) {
|
||||||
grabbuttons(sel, False);
|
grabbuttons(sel, False);
|
||||||
XSetWindowBorder(dpy, sel->win, dc.norm[ColBorder]);
|
XSetWindowBorder(dpy, sel->win, dc.norm[ColBorder]);
|
||||||
@ -152,14 +150,6 @@ focus(Client *c) {
|
|||||||
XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
|
XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
focustopvisible(void) {
|
|
||||||
Client *c;
|
|
||||||
|
|
||||||
for(c = stack; c && !isvisible(c); c = c->snext);
|
|
||||||
focus(c);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
killclient(const char *arg) {
|
killclient(const char *arg) {
|
||||||
XEvent ev;
|
XEvent ev;
|
||||||
@ -230,8 +220,7 @@ manage(Window w, XWindowAttributes *wa) {
|
|||||||
XMoveWindow(dpy, w, c->x + 2 * sw, c->y);
|
XMoveWindow(dpy, w, c->x + 2 * sw, c->y);
|
||||||
XMapWindow(dpy, w);
|
XMapWindow(dpy, w);
|
||||||
setclientstate(c, NormalState);
|
setclientstate(c, NormalState);
|
||||||
if(isvisible(c))
|
focus(c);
|
||||||
focus(c);
|
|
||||||
lt->arrange();
|
lt->arrange();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -305,6 +294,8 @@ togglefloating(const char *arg) {
|
|||||||
if(!sel || lt->arrange == floating)
|
if(!sel || lt->arrange == floating)
|
||||||
return;
|
return;
|
||||||
sel->isfloating = !sel->isfloating;
|
sel->isfloating = !sel->isfloating;
|
||||||
|
if(sel->isfloating)
|
||||||
|
resize(sel, sel->x, sel->y, sel->w, sel->h, True);
|
||||||
lt->arrange();
|
lt->arrange();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -399,7 +390,7 @@ unmanage(Client *c) {
|
|||||||
detach(c);
|
detach(c);
|
||||||
detachstack(c);
|
detachstack(c);
|
||||||
if(sel == c)
|
if(sel == c)
|
||||||
focustopvisible();
|
focus(NULL);
|
||||||
XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
|
XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
|
||||||
setclientstate(c, WithdrawnState);
|
setclientstate(c, WithdrawnState);
|
||||||
free(c->tags);
|
free(c->tags);
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
/* © 2006-2007 Anselm R. Garbe <garbeam at gmail dot com>
|
/* See LICENSE file for copyright and license details. */
|
||||||
* © 2006-2007 Sander van Dijk <a dot h dot vandijk at gmail dot com>
|
|
||||||
* See LICENSE file for license details. */
|
|
||||||
|
|
||||||
/* appearance */
|
/* appearance */
|
||||||
#define BARPOS BarTop /* BarBot, BarOff */
|
#define BARPOS BarTop /* BarBot, BarOff */
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
/* © 2006-2007 Anselm R. Garbe <garbeam at gmail dot com>
|
/* See LICENSE file for copyright and license details. */
|
||||||
* © 2006-2007 Sander van Dijk <a dot h dot vandijk at gmail dot com>
|
|
||||||
* See LICENSE file for license details. */
|
|
||||||
|
|
||||||
/* appearance */
|
/* appearance */
|
||||||
#define BARPOS BarTop /* BarBot, BarOff */
|
#define BARPOS BarTop /* BarBot, BarOff */
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# dwm version
|
# dwm version
|
||||||
VERSION = 4.1
|
VERSION = 4.2
|
||||||
|
|
||||||
# Customize below to fit your system
|
# Customize below to fit your system
|
||||||
|
|
||||||
|
4
draw.c
4
draw.c
@ -1,6 +1,4 @@
|
|||||||
/* © 2006-2007 Anselm R. Garbe <garbeam at gmail dot com>
|
/* See LICENSE file for copyright and license details. */
|
||||||
* © 2006-2007 Sander van Dijk <a dot h dot vandijk at gmail dot com>
|
|
||||||
* See LICENSE file for license details. */
|
|
||||||
#include "dwm.h"
|
#include "dwm.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
9
dwm.h
9
dwm.h
@ -1,6 +1,4 @@
|
|||||||
/* © 2006-2007 Anselm R. Garbe <garbeam at gmail dot com>
|
/* See LICENSE file for copyright and license details.
|
||||||
* © 2006-2007 Sander van Dijk <a dot h dot vandijk at gmail dot com>
|
|
||||||
* See LICENSE file for license details.
|
|
||||||
*
|
*
|
||||||
* dynamic window manager is designed like any other X client as well. It is
|
* dynamic window manager is designed like any other X client as well. It is
|
||||||
* driven through handling X events. In contrast to other X clients, a window
|
* driven through handling X events. In contrast to other X clients, a window
|
||||||
@ -100,8 +98,7 @@ Window root, barwin;
|
|||||||
void attach(Client *c); /* attaches c to global client list */
|
void attach(Client *c); /* attaches c to global client list */
|
||||||
void configure(Client *c); /* send synthetic configure event */
|
void configure(Client *c); /* send synthetic configure event */
|
||||||
void detach(Client *c); /* detaches c from global client list */
|
void detach(Client *c); /* detaches c from global client list */
|
||||||
void focus(Client *c); /* focus c, c may be NULL */
|
void focus(Client *c); /* focus c if visible && !NULL, or focus top visible */
|
||||||
void focustopvisible(void); /* focus top visible window on stack */
|
|
||||||
void killclient(const char *arg); /* kill sel nicely */
|
void killclient(const char *arg); /* kill sel nicely */
|
||||||
void manage(Window w, XWindowAttributes *wa); /* manage new client */
|
void manage(Window w, XWindowAttributes *wa); /* manage new client */
|
||||||
void resize(Client *c, int x, int y,
|
void resize(Client *c, int x, int y,
|
||||||
@ -127,7 +124,7 @@ void incnmaster(const char *arg); /* increments nmaster with arg's index value *
|
|||||||
void initlayouts(void); /* initialize layout array */
|
void initlayouts(void); /* initialize layout array */
|
||||||
Client *nexttiled(Client *c); /* returns tiled successor of c */
|
Client *nexttiled(Client *c); /* returns tiled successor of c */
|
||||||
void restack(void); /* restores z layers of all clients */
|
void restack(void); /* restores z layers of all clients */
|
||||||
void setlayout(const char *arg); /* sets layout, -1 toggles */
|
void setlayout(const char *arg); /* sets layout, NULL means next layout */
|
||||||
void togglebar(const char *arg); /* shows/hides the bar */
|
void togglebar(const char *arg); /* shows/hides the bar */
|
||||||
void togglemax(const char *arg); /* toggles maximization of floating client */
|
void togglemax(const char *arg); /* toggles maximization of floating client */
|
||||||
void zoom(const char *arg); /* zooms the focused client to master area, arg is ignored */
|
void zoom(const char *arg); /* zooms the focused client to master area, arg is ignored */
|
||||||
|
11
event.c
11
event.c
@ -1,6 +1,4 @@
|
|||||||
/* © 2006-2007 Anselm R. Garbe <garbeam at gmail dot com>
|
/* See LICENSE file for copyright and license details. */
|
||||||
* © 2006-2007 Sander van Dijk <a dot h dot vandijk at gmail dot com>
|
|
||||||
* See LICENSE file for license details. */
|
|
||||||
#include "dwm.h"
|
#include "dwm.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@ -218,11 +216,10 @@ configurenotify(XEvent *e) {
|
|||||||
if (ev->window == root && (ev->width != sw || ev->height != sh)) {
|
if (ev->window == root && (ev->width != sw || ev->height != sh)) {
|
||||||
sw = ev->width;
|
sw = ev->width;
|
||||||
sh = ev->height;
|
sh = ev->height;
|
||||||
wah = sh - bh;
|
|
||||||
waw = sw;
|
|
||||||
XFreePixmap(dpy, dc.drawable);
|
XFreePixmap(dpy, dc.drawable);
|
||||||
dc.drawable = XCreatePixmap(dpy, root, sw, bh, DefaultDepth(dpy, screen));
|
dc.drawable = XCreatePixmap(dpy, root, sw, bh, DefaultDepth(dpy, screen));
|
||||||
XResizeWindow(dpy, barwin, sw, bh);
|
XResizeWindow(dpy, barwin, sw, bh);
|
||||||
|
updatebarpos();
|
||||||
lt->arrange();
|
lt->arrange();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -243,11 +240,11 @@ enternotify(XEvent *e) {
|
|||||||
|
|
||||||
if(ev->mode != NotifyNormal || ev->detail == NotifyInferior)
|
if(ev->mode != NotifyNormal || ev->detail == NotifyInferior)
|
||||||
return;
|
return;
|
||||||
if((c = getclient(ev->window)) && isvisible(c))
|
if((c = getclient(ev->window)))
|
||||||
focus(c);
|
focus(c);
|
||||||
else if(ev->window == root) {
|
else if(ev->window == root) {
|
||||||
selscreen = True;
|
selscreen = True;
|
||||||
focustopvisible();
|
focus(NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
70
layout.c
70
layout.c
@ -1,6 +1,4 @@
|
|||||||
/* © 2006-2007 Anselm R. Garbe <garbeam at gmail dot com>
|
/* See LICENSE file for copyright and license details. */
|
||||||
* © 2006-2007 Sander van Dijk <a dot h dot vandijk at gmail dot com>
|
|
||||||
* See LICENSE file for license details. */
|
|
||||||
#include "dwm.h"
|
#include "dwm.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
@ -13,9 +11,25 @@ static unsigned int nlayouts = 0;
|
|||||||
static unsigned int masterw = MASTERWIDTH;
|
static unsigned int masterw = MASTERWIDTH;
|
||||||
static unsigned int nmaster = NMASTER;
|
static unsigned int nmaster = NMASTER;
|
||||||
|
|
||||||
|
static void
|
||||||
|
ban(Client *c) {
|
||||||
|
if (c->isbanned)
|
||||||
|
return;
|
||||||
|
XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
|
||||||
|
c->isbanned = True;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
unban(Client *c) {
|
||||||
|
if (!c->isbanned)
|
||||||
|
return;
|
||||||
|
XMoveWindow(dpy, c->win, c->x, c->y);
|
||||||
|
c->isbanned = False;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
tile(void) {
|
tile(void) {
|
||||||
unsigned int i, n, nx, ny, nw, nh, mw, mh, tw, th, remainder;
|
unsigned int i, n, nx, ny, nw, nh, mw, mh, tw, th;
|
||||||
Client *c;
|
Client *c;
|
||||||
|
|
||||||
for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next))
|
for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next))
|
||||||
@ -24,14 +38,11 @@ tile(void) {
|
|||||||
mh = (n > nmaster) ? wah / nmaster : wah / (n > 0 ? n : 1);
|
mh = (n > nmaster) ? wah / nmaster : wah / (n > 0 ? n : 1);
|
||||||
mw = (n > nmaster) ? (waw * masterw) / 1000 : waw;
|
mw = (n > nmaster) ? (waw * masterw) / 1000 : waw;
|
||||||
th = (n > nmaster) ? wah / (n - nmaster) : 0;
|
th = (n > nmaster) ? wah / (n - nmaster) : 0;
|
||||||
remainder = (n > nmaster) ? wah - th * (n - nmaster) : 0;
|
|
||||||
tw = waw - mw;
|
tw = waw - mw;
|
||||||
|
|
||||||
for(i = 0, c = clients; c; c = c->next)
|
for(i = 0, c = clients; c; c = c->next)
|
||||||
if(isvisible(c)) {
|
if(isvisible(c)) {
|
||||||
if(c->isbanned)
|
unban(c);
|
||||||
XMoveWindow(dpy, c->win, c->x, c->y);
|
|
||||||
c->isbanned = False;
|
|
||||||
if(c->isfloating)
|
if(c->isfloating)
|
||||||
continue;
|
continue;
|
||||||
c->ismax = False;
|
c->ismax = False;
|
||||||
@ -40,16 +51,20 @@ tile(void) {
|
|||||||
if(i < nmaster) {
|
if(i < nmaster) {
|
||||||
ny += i * mh;
|
ny += i * mh;
|
||||||
nw = mw - 2 * c->border;
|
nw = mw - 2 * c->border;
|
||||||
nh = mh - 2 * c->border;
|
nh = mh;
|
||||||
|
if(i + 1 == (n < nmaster ? n : nmaster)) /* remainder */
|
||||||
|
nh = wah - mh * i;
|
||||||
|
nh -= 2 * c->border;
|
||||||
}
|
}
|
||||||
else { /* tile window */
|
else { /* tile window */
|
||||||
nx += mw;
|
nx += mw;
|
||||||
nw = tw - 2 * c->border;
|
nw = tw - 2 * c->border;
|
||||||
if(th > 2 * c->border) {
|
if(th > 2 * c->border) {
|
||||||
ny += (i - nmaster) * th;
|
ny += (i - nmaster) * th;
|
||||||
nh = th - 2 * c->border;
|
nh = th;
|
||||||
if (i == n - 1)
|
if(i + 1 == n) /* remainder */
|
||||||
nh += remainder;
|
nh = wah - th * (i - nmaster);
|
||||||
|
nh -= 2 * c->border;
|
||||||
}
|
}
|
||||||
else /* fallback if th <= 2 * c->border */
|
else /* fallback if th <= 2 * c->border */
|
||||||
nh = wah - 2 * c->border;
|
nh = wah - 2 * c->border;
|
||||||
@ -57,12 +72,9 @@ tile(void) {
|
|||||||
resize(c, nx, ny, nw, nh, False);
|
resize(c, nx, ny, nw, nh, False);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
c->isbanned = True;
|
ban(c);
|
||||||
XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
|
focus(NULL);
|
||||||
}
|
|
||||||
if(!sel || !isvisible(sel))
|
|
||||||
focustopvisible();
|
|
||||||
restack();
|
restack();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,20 +86,16 @@ void
|
|||||||
floating(void) {
|
floating(void) {
|
||||||
Client *c;
|
Client *c;
|
||||||
|
|
||||||
for(c = clients; c; c = c->next) {
|
for(c = clients; c; c = c->next)
|
||||||
if(isvisible(c)) {
|
if(isvisible(c)) {
|
||||||
if(c->isbanned)
|
if(c->isbanned)
|
||||||
XMoveWindow(dpy, c->win, c->x, c->y);
|
XMoveWindow(dpy, c->win, c->x, c->y);
|
||||||
c->isbanned = False;
|
c->isbanned = False;
|
||||||
resize(c, c->x, c->y, c->w, c->h, True);
|
resize(c, c->x, c->y, c->w, c->h, True);
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
c->isbanned = True;
|
ban(c);
|
||||||
XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
|
focus(NULL);
|
||||||
}
|
|
||||||
}
|
|
||||||
if(!sel || !isvisible(sel))
|
|
||||||
focustopvisible();
|
|
||||||
restack();
|
restack();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -198,11 +206,9 @@ setlayout(const char *arg) {
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
if(!arg) {
|
if(!arg) {
|
||||||
for(i = 0; i < nlayouts && lt != &layout[i]; i++);
|
lt++;
|
||||||
if(i == nlayouts - 1)
|
if(lt == layout + nlayouts)
|
||||||
lt = &layout[0];
|
lt = layout;
|
||||||
else
|
|
||||||
lt = &layout[++i];
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
i = atoi(arg);
|
i = atoi(arg);
|
||||||
@ -249,7 +255,7 @@ void
|
|||||||
zoom(const char *arg) {
|
zoom(const char *arg) {
|
||||||
Client *c;
|
Client *c;
|
||||||
|
|
||||||
if(!sel || lt->arrange != tile || sel->isfloating)
|
if(!sel || lt->arrange == floating || sel->isfloating)
|
||||||
return;
|
return;
|
||||||
if((c = sel) == nexttiled(clients))
|
if((c = sel) == nexttiled(clients))
|
||||||
if(!(c = nexttiled(c->next)))
|
if(!(c = nexttiled(c->next)))
|
||||||
|
8
main.c
8
main.c
@ -1,6 +1,4 @@
|
|||||||
/* © 2006-2007 Anselm R. Garbe <garbeam at gmail dot com>
|
/* See LICENSE file for copyright and license details. */
|
||||||
* © 2006-2007 Sander van Dijk <a dot h dot vandijk at gmail dot com>
|
|
||||||
* See LICENSE file for license details. */
|
|
||||||
#include "dwm.h"
|
#include "dwm.h"
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
@ -278,8 +276,8 @@ main(int argc, char *argv[]) {
|
|||||||
fd_set rd;
|
fd_set rd;
|
||||||
XEvent ev;
|
XEvent ev;
|
||||||
|
|
||||||
if(argc == 2 && !strncmp("-v", argv[1], 3))
|
if(argc == 2 && !strcmp("-v", argv[1]))
|
||||||
eprint("dwm-"VERSION", © 2004-2007 Anselm R. Garbe, Sander van Dijk\n");
|
eprint("dwm-"VERSION", © 2006-2007 A. R. Garbe, S. van Dijk, J. Salmi, P. Hruby, S. Nagy\n");
|
||||||
else if(argc != 1)
|
else if(argc != 1)
|
||||||
eprint("usage: dwm [-v]\n");
|
eprint("usage: dwm [-v]\n");
|
||||||
setlocale(LC_CTYPE, "");
|
setlocale(LC_CTYPE, "");
|
||||||
|
4
tag.c
4
tag.c
@ -1,6 +1,4 @@
|
|||||||
/* © 2006-2007 Anselm R. Garbe <garbeam at gmail dot com>
|
/* See LICENSE file for copyright and license details. */
|
||||||
* © 2006-2007 Sander van Dijk <a dot h dot vandijk at gmail dot com>
|
|
||||||
* See LICENSE file for license details. */
|
|
||||||
#include "dwm.h"
|
#include "dwm.h"
|
||||||
#include <regex.h>
|
#include <regex.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
4
util.c
4
util.c
@ -1,6 +1,4 @@
|
|||||||
/* © 2006-2007 Anselm R. Garbe <garbeam at gmail dot com>
|
/* See LICENSE file for copyright and license details. */
|
||||||
* © 2006-2007 Sander van Dijk <a dot h dot vandijk at gmail dot com>
|
|
||||||
* See LICENSE file for license details. */
|
|
||||||
#include "dwm.h"
|
#include "dwm.h"
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
Reference in New Issue
Block a user