Compare commits
8 Commits
Author | SHA1 | Date | |
---|---|---|---|
93aeaa53c9 | |||
06f9f346e6 | |||
5c48012ad2 | |||
a686c9ccd2 | |||
9ca5c3b108 | |||
bab5b1178d | |||
ee8fb0c6e4 | |||
0d9d3e79e9 |
2
.hgtags
2
.hgtags
@ -39,3 +39,5 @@ d3876aa792923f9a95f7ad0c7f0134533404df35 3.2.2
|
|||||||
63ad05e7f9e1f4f1881fb02f529cb6c6ae81e693 3.5
|
63ad05e7f9e1f4f1881fb02f529cb6c6ae81e693 3.5
|
||||||
75b1b25fe0d7e29400baf30568153f668324928b 3.6
|
75b1b25fe0d7e29400baf30568153f668324928b 3.6
|
||||||
20ec6976cee1fcfee0c2f354ae382ee3f9f68efa 3.6.1
|
20ec6976cee1fcfee0c2f354ae382ee3f9f68efa 3.6.1
|
||||||
|
baee494346e520f8dee2cee9491b8350064770d2 3.7
|
||||||
|
2ea201354cf016407ea93e1e390d1422940d29b0 3.8
|
||||||
|
72
client.c
72
client.c
@ -154,10 +154,19 @@ focus(Client *c) {
|
|||||||
|
|
||||||
void
|
void
|
||||||
killclient(const char *arg) {
|
killclient(const char *arg) {
|
||||||
|
XEvent ev;
|
||||||
|
|
||||||
if(!sel)
|
if(!sel)
|
||||||
return;
|
return;
|
||||||
if(isprotodel(sel))
|
if(isprotodel(sel)) {
|
||||||
sendevent(sel->win, wmatom[WMProtocols], wmatom[WMDelete]);
|
ev.type = ClientMessage;
|
||||||
|
ev.xclient.window = sel->win;
|
||||||
|
ev.xclient.message_type = wmatom[WMProtocols];
|
||||||
|
ev.xclient.format = 32;
|
||||||
|
ev.xclient.data.l[0] = wmatom[WMDelete];
|
||||||
|
ev.xclient.data.l[1] = CurrentTime;
|
||||||
|
XSendEvent(dpy, sel->win, False, NoEventMask, &ev);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
XKillClient(dpy, sel->win);
|
XKillClient(dpy, sel->win);
|
||||||
}
|
}
|
||||||
@ -218,12 +227,33 @@ manage(Window w, XWindowAttributes *wa) {
|
|||||||
|
|
||||||
void
|
void
|
||||||
resize(Client *c, int x, int y, int w, int h, Bool sizehints) {
|
resize(Client *c, int x, int y, int w, int h, Bool sizehints) {
|
||||||
float actual, dx, dy, max, min;
|
float dx, dy, max, min, ratio;
|
||||||
XWindowChanges wc;
|
XWindowChanges wc;
|
||||||
|
|
||||||
if(w <= 0 || h <= 0)
|
if(w <= 0 || h <= 0)
|
||||||
return;
|
return;
|
||||||
if(sizehints) {
|
if(sizehints) {
|
||||||
|
if(c->minay > 0 && c->maxay > 0 && (h - c->baseh) > 0) {
|
||||||
|
dx = (float)(w - c->basew);
|
||||||
|
dy = (float)(h - c->baseh);
|
||||||
|
min = (float)(c->minax) / (float)(c->minay);
|
||||||
|
max = (float)(c->maxax) / (float)(c->maxay);
|
||||||
|
ratio = dx / dy;
|
||||||
|
if(max > 0 && min > 0 && ratio > 0) {
|
||||||
|
if(ratio < min) {
|
||||||
|
dy = (dx * min + dy) / (min * min + 1);
|
||||||
|
dx = dy * min;
|
||||||
|
w = (int)dx + c->basew;
|
||||||
|
h = (int)dy + c->baseh;
|
||||||
|
}
|
||||||
|
else if(ratio > max) {
|
||||||
|
dy = (dx * min + dy) / (max * max + 1);
|
||||||
|
dx = dy * min;
|
||||||
|
w = (int)dx + c->basew;
|
||||||
|
h = (int)dy + c->baseh;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if(c->minw && w < c->minw)
|
if(c->minw && w < c->minw)
|
||||||
w = c->minw;
|
w = c->minw;
|
||||||
if(c->minh && h < c->minh)
|
if(c->minh && h < c->minh)
|
||||||
@ -232,33 +262,13 @@ resize(Client *c, int x, int y, int w, int h, Bool sizehints) {
|
|||||||
w = c->maxw;
|
w = c->maxw;
|
||||||
if(c->maxh && h > c->maxh)
|
if(c->maxh && h > c->maxh)
|
||||||
h = c->maxh;
|
h = c->maxh;
|
||||||
/* inspired by algorithm from fluxbox */
|
|
||||||
if(c->minay > 0 && c->maxay && (h - c->baseh) > 0) {
|
|
||||||
dx = (float)(w - c->basew);
|
|
||||||
dy = (float)(h - c->baseh);
|
|
||||||
min = (float)(c->minax) / (float)(c->minay);
|
|
||||||
max = (float)(c->maxax) / (float)(c->maxay);
|
|
||||||
actual = dx / dy;
|
|
||||||
if(max > 0 && min > 0 && actual > 0) {
|
|
||||||
if(actual < min) {
|
|
||||||
dy = (dx * min + dy) / (min * min + 1);
|
|
||||||
dx = dy * min;
|
|
||||||
w = (int)dx + c->basew;
|
|
||||||
h = (int)dy + c->baseh;
|
|
||||||
}
|
|
||||||
else if(actual > max) {
|
|
||||||
dy = (dx * min + dy) / (max * max + 1);
|
|
||||||
dx = dy * min;
|
|
||||||
w = (int)dx + c->basew;
|
|
||||||
h = (int)dy + c->baseh;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(c->incw)
|
if(c->incw)
|
||||||
w -= (w - c->basew) % c->incw;
|
w -= (w - c->basew) % c->incw;
|
||||||
if(c->inch)
|
if(c->inch)
|
||||||
h -= (h - c->baseh) % c->inch;
|
h -= (h - c->baseh) % c->inch;
|
||||||
}
|
}
|
||||||
|
if(w <= 0 || h <= 0)
|
||||||
|
return;
|
||||||
if(w == sw && h == sh)
|
if(w == sw && h == sh)
|
||||||
c->border = 0;
|
c->border = 0;
|
||||||
else
|
else
|
||||||
@ -304,6 +314,10 @@ updatesizehints(Client *c) {
|
|||||||
c->basew = size.base_width;
|
c->basew = size.base_width;
|
||||||
c->baseh = size.base_height;
|
c->baseh = size.base_height;
|
||||||
}
|
}
|
||||||
|
else if(c->flags & PMinSize) {
|
||||||
|
c->basew = size.min_width;
|
||||||
|
c->baseh = size.min_height;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
c->basew = c->baseh = 0;
|
c->basew = c->baseh = 0;
|
||||||
if(c->flags & PResizeInc) {
|
if(c->flags & PResizeInc) {
|
||||||
@ -322,16 +336,20 @@ updatesizehints(Client *c) {
|
|||||||
c->minw = size.min_width;
|
c->minw = size.min_width;
|
||||||
c->minh = size.min_height;
|
c->minh = size.min_height;
|
||||||
}
|
}
|
||||||
|
else if(c->flags & PBaseSize) {
|
||||||
|
c->minw = size.base_width;
|
||||||
|
c->minh = size.base_height;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
c->minw = c->minh = 0;
|
c->minw = c->minh = 0;
|
||||||
if(c->flags & PAspect) {
|
if(c->flags & PAspect) {
|
||||||
c->minax = size.min_aspect.x;
|
c->minax = size.min_aspect.x;
|
||||||
c->minay = size.min_aspect.y;
|
|
||||||
c->maxax = size.max_aspect.x;
|
c->maxax = size.max_aspect.x;
|
||||||
|
c->minay = size.min_aspect.y;
|
||||||
c->maxay = size.max_aspect.y;
|
c->maxay = size.max_aspect.y;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
c->minax = c->minay = c->maxax = c->maxay = 0;
|
c->minax = c->maxax = c->minay = c->maxay = 0;
|
||||||
c->isfixed = (c->maxw && c->minw && c->maxh && c->minh
|
c->isfixed = (c->maxw && c->minw && c->maxh && c->minh
|
||||||
&& c->maxw == c->minw && c->maxh == c->minh);
|
&& c->maxw == c->minw && c->maxh == c->minh);
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# dwm version
|
# dwm version
|
||||||
VERSION = 3.7
|
VERSION = 3.9
|
||||||
|
|
||||||
# Customize below to fit your system
|
# Customize below to fit your system
|
||||||
|
|
||||||
|
12
draw.c
12
draw.c
@ -95,7 +95,6 @@ drawtext(const char *text, unsigned long col[ColLast]) {
|
|||||||
int x, y, w, h;
|
int x, y, w, h;
|
||||||
static char buf[256];
|
static char buf[256];
|
||||||
unsigned int len, olen;
|
unsigned int len, olen;
|
||||||
XGCValues gcv;
|
|
||||||
XRectangle r = { dc.x, dc.y, dc.w, dc.h };
|
XRectangle r = { dc.x, dc.y, dc.w, dc.h };
|
||||||
|
|
||||||
XSetForeground(dpy, dc.gc, col[ColBG]);
|
XSetForeground(dpy, dc.gc, col[ColBG]);
|
||||||
@ -124,16 +123,11 @@ drawtext(const char *text, unsigned long col[ColLast]) {
|
|||||||
}
|
}
|
||||||
if(w > dc.w)
|
if(w > dc.w)
|
||||||
return; /* too long */
|
return; /* too long */
|
||||||
gcv.foreground = col[ColFG];
|
XSetForeground(dpy, dc.gc, col[ColFG]);
|
||||||
if(dc.font.set) {
|
if(dc.font.set)
|
||||||
XChangeGC(dpy, dc.gc, GCForeground, &gcv);
|
|
||||||
XmbDrawString(dpy, dc.drawable, dc.font.set, dc.gc, x, y, buf, len);
|
XmbDrawString(dpy, dc.drawable, dc.font.set, dc.gc, x, y, buf, len);
|
||||||
}
|
else
|
||||||
else {
|
|
||||||
gcv.font = dc.font.xfont->fid;
|
|
||||||
XChangeGC(dpy, dc.gc, GCForeground | GCFont, &gcv);
|
|
||||||
XDrawString(dpy, dc.drawable, dc.gc, x, y, buf, len);
|
XDrawString(dpy, dc.drawable, dc.gc, x, y, buf, len);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int
|
unsigned int
|
||||||
|
50
dwm.1
50
dwm.1
@ -1,4 +1,4 @@
|
|||||||
.TH DWM 1 dwm-VERSION
|
.TH DWM 1 dwm\-VERSION
|
||||||
.SH NAME
|
.SH NAME
|
||||||
dwm \- dynamic window manager
|
dwm \- dynamic window manager
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
@ -45,87 +45,87 @@ label toggles between tiled and floating layout.
|
|||||||
.B Button3
|
.B Button3
|
||||||
click on a tag label adds/removes all windows with that tag to/from the view.
|
click on a tag label adds/removes all windows with that tag to/from the view.
|
||||||
.TP
|
.TP
|
||||||
.B Mod1-Button1
|
.B Mod1\-Button1
|
||||||
click on a tag label applies that tag to the focused window.
|
click on a tag label applies that tag to the focused window.
|
||||||
.TP
|
.TP
|
||||||
.B Mod1-Button3
|
.B Mod1\-Button3
|
||||||
click on a tag label adds/removes that tag to/from the focused window.
|
click on a tag label adds/removes that tag to/from the focused window.
|
||||||
.SS Keyboard commands
|
.SS Keyboard commands
|
||||||
.TP
|
.TP
|
||||||
.B Mod1-Shift-Return
|
.B Mod1\-Shift\-Return
|
||||||
Start
|
Start
|
||||||
.BR xterm.
|
.BR xterm.
|
||||||
.TP
|
.TP
|
||||||
.B Mod1-Return
|
.B Mod1\-Return
|
||||||
Zooms/cycles current window to/from master area (tiled layout only).
|
Zooms/cycles current window to/from master area (tiled layout only).
|
||||||
.TP
|
.TP
|
||||||
.B Mod1-j
|
.B Mod1\-j
|
||||||
Focus next window.
|
Focus next window.
|
||||||
.TP
|
.TP
|
||||||
.B Mod1-k
|
.B Mod1\-k
|
||||||
Focus previous window.
|
Focus previous window.
|
||||||
.TP
|
.TP
|
||||||
.B Mod1-Shift-j
|
.B Mod1\-Shift\-j
|
||||||
Increase the number of windows in the master area (tiled layout only).
|
Increase the number of windows in the master area (tiled layout only).
|
||||||
.TP
|
.TP
|
||||||
.B Mod1-Shift-k
|
.B Mod1\-Shift\-k
|
||||||
Decrease the number of windows in the master area (tiled layout only).
|
Decrease the number of windows in the master area (tiled layout only).
|
||||||
.TP
|
.TP
|
||||||
.B Mod1-l
|
.B Mod1\-l
|
||||||
Increase master area width (tiled layout only).
|
Increase master area width (tiled layout only).
|
||||||
.TP
|
.TP
|
||||||
.B Mod1-h
|
.B Mod1\-h
|
||||||
Decrease master area width (tiled layout only).
|
Decrease master area width (tiled layout only).
|
||||||
.TP
|
.TP
|
||||||
.B Mod1-m
|
.B Mod1\-m
|
||||||
Toggles maximization of current window (floating layout only).
|
Toggles maximization of current window (floating layout only).
|
||||||
.TP
|
.TP
|
||||||
.B Mod1-Shift-[1..n]
|
.B Mod1\-Shift\-[1..n]
|
||||||
Apply
|
Apply
|
||||||
.RB nth
|
.RB nth
|
||||||
tag to current window.
|
tag to current window.
|
||||||
.TP
|
.TP
|
||||||
.B Mod1-Shift-0
|
.B Mod1\-Shift\-0
|
||||||
Apply all tags to current window.
|
Apply all tags to current window.
|
||||||
.TP
|
.TP
|
||||||
.B Mod1-Control-Shift-[1..n]
|
.B Mod1\-Control\-Shift\-[1..n]
|
||||||
Add/remove
|
Add/remove
|
||||||
.B nth
|
.B nth
|
||||||
tag to/from current window.
|
tag to/from current window.
|
||||||
.TP
|
.TP
|
||||||
.B Mod1-Shift-c
|
.B Mod1\-Shift\-c
|
||||||
Close focused window.
|
Close focused window.
|
||||||
.TP
|
.TP
|
||||||
.B Mod1-space
|
.B Mod1\-space
|
||||||
Toggle between tiled and floating layout (affects all windows).
|
Toggle between tiled and floating layout (affects all windows).
|
||||||
.TP
|
.TP
|
||||||
.B Mod1-Shift-space
|
.B Mod1\-Shift\-space
|
||||||
Toggle focused window between tiled and floating state (tiled layout only).
|
Toggle focused window between tiled and floating state (tiled layout only).
|
||||||
.TP
|
.TP
|
||||||
.B Mod1-[1..n]
|
.B Mod1\-[1..n]
|
||||||
View all windows with
|
View all windows with
|
||||||
.BR nth
|
.BR nth
|
||||||
tag.
|
tag.
|
||||||
.TP
|
.TP
|
||||||
.B Mod1-0
|
.B Mod1\-0
|
||||||
View all windows with any tag.
|
View all windows with any tag.
|
||||||
.TP
|
.TP
|
||||||
.B Mod1-Control-[1..n]
|
.B Mod1\-Control\-[1..n]
|
||||||
Add/remove all windows with
|
Add/remove all windows with
|
||||||
.BR nth
|
.BR nth
|
||||||
tag to/from the view.
|
tag to/from the view.
|
||||||
.TP
|
.TP
|
||||||
.B Mod1-Shift-q
|
.B Mod1\-Shift\-q
|
||||||
Quit dwm.
|
Quit dwm.
|
||||||
.SS Mouse commands
|
.SS Mouse commands
|
||||||
.TP
|
.TP
|
||||||
.B Mod1-Button1
|
.B Mod1\-Button1
|
||||||
Move current window while dragging (floating layout only).
|
Move current window while dragging (floating layout only).
|
||||||
.TP
|
.TP
|
||||||
.B Mod1-Button2
|
.B Mod1\-Button2
|
||||||
Zooms/cycles current window to/from master area (tiled layout only).
|
Zooms/cycles current window to/from master area (tiled layout only).
|
||||||
.TP
|
.TP
|
||||||
.B Mod1-Button3
|
.B Mod1\-Button3
|
||||||
Resize current window while dragging (floating layout only).
|
Resize current window while dragging (floating layout only).
|
||||||
.SH CUSTOMIZATION
|
.SH CUSTOMIZATION
|
||||||
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
|
||||||
|
3
dwm.h
3
dwm.h
@ -47,7 +47,7 @@ struct Client {
|
|||||||
int x, y, w, h;
|
int x, y, w, h;
|
||||||
int rx, ry, rw, rh; /* revert geometry */
|
int rx, ry, rw, rh; /* revert geometry */
|
||||||
int basew, baseh, incw, inch, maxw, maxh, minw, minh;
|
int basew, baseh, incw, inch, maxw, maxh, minw, minh;
|
||||||
int minax, minay, maxax, maxay;
|
int minax, maxax, minay, maxay;
|
||||||
long flags;
|
long flags;
|
||||||
unsigned int border;
|
unsigned int border;
|
||||||
Bool isbanned, isfixed, ismax, isfloating;
|
Bool isbanned, isfixed, ismax, isfloating;
|
||||||
@ -130,7 +130,6 @@ void zoom(const char *arg); /* zooms the focused client to master area, arg is
|
|||||||
|
|
||||||
/* main.c */
|
/* main.c */
|
||||||
void quit(const char *arg); /* quit dwm nicely */
|
void quit(const char *arg); /* quit dwm nicely */
|
||||||
void sendevent(Window w, Atom a, long value); /* send synthetic event to w */
|
|
||||||
int xerror(Display *dsply, XErrorEvent *ee); /* dwm's X error handler */
|
int xerror(Display *dsply, XErrorEvent *ee); /* dwm's X error handler */
|
||||||
|
|
||||||
/* tag.c */
|
/* tag.c */
|
||||||
|
16
main.c
16
main.c
@ -205,6 +205,8 @@ setup(void) {
|
|||||||
dc.drawable = XCreatePixmap(dpy, root, sw, bh, DefaultDepth(dpy, screen));
|
dc.drawable = XCreatePixmap(dpy, root, sw, bh, DefaultDepth(dpy, screen));
|
||||||
dc.gc = XCreateGC(dpy, root, 0, 0);
|
dc.gc = XCreateGC(dpy, root, 0, 0);
|
||||||
XSetLineAttributes(dpy, dc.gc, 1, LineSolid, CapButt, JoinMiter);
|
XSetLineAttributes(dpy, dc.gc, 1, LineSolid, CapButt, JoinMiter);
|
||||||
|
if(!dc.font.set)
|
||||||
|
XSetFont(dpy, dc.gc, dc.font.xfont->fid);
|
||||||
/* multihead support */
|
/* multihead support */
|
||||||
selscreen = XQueryPointer(dpy, root, &w, &w, &i, &i, &i, &i, &mask);
|
selscreen = XQueryPointer(dpy, root, &w, &w, &i, &i, &i, &i, &mask);
|
||||||
}
|
}
|
||||||
@ -221,20 +223,6 @@ xerrorstart(Display *dsply, XErrorEvent *ee) {
|
|||||||
|
|
||||||
/* extern */
|
/* extern */
|
||||||
|
|
||||||
void
|
|
||||||
sendevent(Window w, Atom a, long value) {
|
|
||||||
XEvent e;
|
|
||||||
|
|
||||||
e.type = ClientMessage;
|
|
||||||
e.xclient.window = w;
|
|
||||||
e.xclient.message_type = a;
|
|
||||||
e.xclient.format = 32;
|
|
||||||
e.xclient.data.l[0] = value;
|
|
||||||
e.xclient.data.l[1] = CurrentTime;
|
|
||||||
XSendEvent(dpy, w, False, NoEventMask, &e);
|
|
||||||
XSync(dpy, False);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
quit(const char *arg) {
|
quit(const char *arg) {
|
||||||
readin = running = False;
|
readin = running = False;
|
||||||
|
Reference in New Issue
Block a user