Compare commits
29 Commits
Author | SHA1 | Date | |
---|---|---|---|
69408d384d | |||
4aea423f06 | |||
6fc8a63041 | |||
2583a7c0d1 | |||
0ef6e3103c | |||
7c052b37c8 | |||
d9c475d7f4 | |||
c8e57332d1 | |||
c045459917 | |||
e0f64e63db | |||
dddd58a8cd | |||
010fd21b20 | |||
1802fad2f9 | |||
f833d109d1 | |||
7225c99903 | |||
36178933ed | |||
ad0da9a571 | |||
6646468125 | |||
fee8df6ccf | |||
8fa47ac679 | |||
b427a2c6cb | |||
14d05e7c72 | |||
a118a57fe3 | |||
02cea3b47e | |||
1c2d673ded | |||
c34df2c1b6 | |||
6092aa977e | |||
c9cc2b385a | |||
b39d0c521a |
2
.hgtags
2
.hgtags
@ -14,3 +14,5 @@ f5f5cbf016a94b48a8fe9c47f0736e96d166d5d4 1.3
|
|||||||
3cff9403766bf83a9fc2a0aef230115d68de2a8e 1.4
|
3cff9403766bf83a9fc2a0aef230115d68de2a8e 1.4
|
||||||
728c9089b079721b43c3347124639a29baa22a97 1.5
|
728c9089b079721b43c3347124639a29baa22a97 1.5
|
||||||
ad3fa2d185426c51fd5deceae809770363f8d33c 1.6
|
ad3fa2d185426c51fd5deceae809770363f8d33c 1.6
|
||||||
|
4dbdb61c8b8ce21dee5c7050a6b103855964ed20 1.7
|
||||||
|
d5ad819f2a66a40fa75dd2e44429f3bfc884d07b 1.7.1
|
||||||
|
2
README
2
README
@ -37,7 +37,7 @@ like this in your .xinitrc:
|
|||||||
|
|
||||||
while true
|
while true
|
||||||
do
|
do
|
||||||
echo `date` `uptime | sed 's/.*://; s/,//g'`
|
echo `date` `uptime | sed 's/.*,//'`
|
||||||
sleep 1
|
sleep 1
|
||||||
done | dwm
|
done | dwm
|
||||||
|
|
||||||
|
48
client.c
48
client.c
@ -54,19 +54,6 @@ grabbuttons(Client *c, Bool focused) {
|
|||||||
GrabModeAsync, GrabModeSync, None, None);
|
GrabModeAsync, GrabModeSync, None, None);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
resizetitle(Client *c) {
|
|
||||||
c->tw = textw(c->name);
|
|
||||||
if(c->tw > c->w)
|
|
||||||
c->tw = c->w + 2;
|
|
||||||
c->tx = c->x + c->w - c->tw + 2;
|
|
||||||
c->ty = c->y;
|
|
||||||
if(isvisible(c))
|
|
||||||
XMoveResizeWindow(dpy, c->twin, c->tx, c->ty, c->tw, c->th);
|
|
||||||
else
|
|
||||||
XMoveResizeWindow(dpy, c->twin, c->tx + 2 * sw, c->ty, c->tw, c->th);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
xerrordummy(Display *dsply, XErrorEvent *ee) {
|
xerrordummy(Display *dsply, XErrorEvent *ee) {
|
||||||
return 0;
|
return 0;
|
||||||
@ -227,12 +214,12 @@ manage(Window w, XWindowAttributes *wa) {
|
|||||||
c->border = 0;
|
c->border = 0;
|
||||||
updatesize(c);
|
updatesize(c);
|
||||||
|
|
||||||
if(c->x + c->w + 2 > sw)
|
if(c->x + c->w + 2 * BORDERPX > sw)
|
||||||
c->x = sw - c->w - 2;
|
c->x = sw - c->w - 2 * BORDERPX;
|
||||||
if(c->x < 0)
|
if(c->x < sx)
|
||||||
c->x = 0;
|
c->x = sx;
|
||||||
if(c->y + c->h + 2 > sh)
|
if(c->y + c->h + 2 * BORDERPX > sh)
|
||||||
c->y = sh - c->h - 2;
|
c->y = sh - c->h - 2 * BORDERPX;
|
||||||
if(c->h != sh && c->y < bh)
|
if(c->h != sh && c->y < bh)
|
||||||
c->y = bh;
|
c->y = bh;
|
||||||
|
|
||||||
@ -250,11 +237,13 @@ manage(Window w, XWindowAttributes *wa) {
|
|||||||
CWOverrideRedirect | CWBackPixmap | CWEventMask, &twa);
|
CWOverrideRedirect | CWBackPixmap | CWEventMask, &twa);
|
||||||
|
|
||||||
grabbuttons(c, False);
|
grabbuttons(c, False);
|
||||||
|
updatetitle(c);
|
||||||
settags(c, getclient(trans));
|
settags(c, getclient(trans));
|
||||||
if(!c->isfloat)
|
if(!c->isfloat)
|
||||||
c->isfloat = trans
|
c->isfloat = trans
|
||||||
|| (c->maxw && c->minw &&
|
|| (c->maxw && c->minw &&
|
||||||
c->maxw == c->minw && c->maxh == c->minh);
|
c->maxw == c->minw && c->maxh == c->minh);
|
||||||
|
resizetitle(c);
|
||||||
|
|
||||||
if(clients)
|
if(clients)
|
||||||
clients->prev = c;
|
clients->prev = c;
|
||||||
@ -262,7 +251,6 @@ manage(Window w, XWindowAttributes *wa) {
|
|||||||
c->snext = stack;
|
c->snext = stack;
|
||||||
stack = clients = c;
|
stack = clients = c;
|
||||||
|
|
||||||
updatetitle(c);
|
|
||||||
ban(c);
|
ban(c);
|
||||||
XMapWindow(dpy, c->win);
|
XMapWindow(dpy, c->win);
|
||||||
XMapWindow(dpy, c->twin);
|
XMapWindow(dpy, c->twin);
|
||||||
@ -297,8 +285,8 @@ resize(Client *c, Bool sizehints, Corner sticky) {
|
|||||||
c->y = bottom - c->h;
|
c->y = bottom - c->h;
|
||||||
|
|
||||||
/* offscreen appearance fixes */
|
/* offscreen appearance fixes */
|
||||||
if(c->x + c->w < 0)
|
if(c->x + c->w < sx)
|
||||||
c->x = 0;
|
c->x = sx;
|
||||||
if(c->y + c->h < bh)
|
if(c->y + c->h < bh)
|
||||||
c->y = bh;
|
c->y = bh;
|
||||||
if(c->x > sw)
|
if(c->x > sw)
|
||||||
@ -314,12 +302,25 @@ resize(Client *c, Bool sizehints, Corner sticky) {
|
|||||||
if(c->w == sw && c->h == sh)
|
if(c->w == sw && c->h == sh)
|
||||||
wc.border_width = 0;
|
wc.border_width = 0;
|
||||||
else
|
else
|
||||||
wc.border_width = 1;
|
wc.border_width = BORDERPX;
|
||||||
XConfigureWindow(dpy, c->win, CWX | CWY | CWWidth | CWHeight | CWBorderWidth, &wc);
|
XConfigureWindow(dpy, c->win, CWX | CWY | CWWidth | CWHeight | CWBorderWidth, &wc);
|
||||||
configure(c);
|
configure(c);
|
||||||
XSync(dpy, False);
|
XSync(dpy, False);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
resizetitle(Client *c) {
|
||||||
|
c->tw = textw(c->name);
|
||||||
|
if(c->tw > c->w)
|
||||||
|
c->tw = c->w + 2 * BORDERPX;
|
||||||
|
c->tx = c->x + c->w - c->tw + 2 * BORDERPX;
|
||||||
|
c->ty = c->y;
|
||||||
|
if(isvisible(c))
|
||||||
|
XMoveResizeWindow(dpy, c->twin, c->tx, c->ty, c->tw, c->th);
|
||||||
|
else
|
||||||
|
XMoveResizeWindow(dpy, c->twin, c->tx + 2 * sw, c->ty, c->tw, c->th);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
updatesize(Client *c) {
|
updatesize(Client *c) {
|
||||||
long msize;
|
long msize;
|
||||||
@ -382,7 +383,6 @@ updatetitle(Client *c) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
XFree(name.value);
|
XFree(name.value);
|
||||||
resizetitle(c);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
15
config.arg.h
15
config.arg.h
@ -6,9 +6,11 @@
|
|||||||
#define TAGS \
|
#define TAGS \
|
||||||
const char *tags[] = { "dev", "work", "net", "fnord", NULL };
|
const char *tags[] = { "dev", "work", "net", "fnord", NULL };
|
||||||
|
|
||||||
#define DEFMODE dotile /* dofloat */
|
#define DEFMODE dotile /* dofloat */
|
||||||
#define FLOATSYMBOL "><>"
|
#define FLOATSYMBOL "><>"
|
||||||
#define TILESYMBOL "[]="
|
#define STACKPOS StackRight /* StackLeft */
|
||||||
|
#define BSTACKSYMBOL "==="
|
||||||
|
#define VSTACKSYMBOL "[]="
|
||||||
|
|
||||||
#define FONT "-*-terminus-medium-*-*-*-12-*-*-*-*-*-iso10646-*"
|
#define FONT "-*-terminus-medium-*-*-*-12-*-*-*-*-*-iso10646-*"
|
||||||
#define NORMBGCOLOR "#333333"
|
#define NORMBGCOLOR "#333333"
|
||||||
@ -18,7 +20,7 @@ const char *tags[] = { "dev", "work", "net", "fnord", NULL };
|
|||||||
#define STATUSBGCOLOR "#222222"
|
#define STATUSBGCOLOR "#222222"
|
||||||
#define STATUSFGCOLOR "#9999cc"
|
#define STATUSFGCOLOR "#9999cc"
|
||||||
|
|
||||||
#define MASTERW 60 /* percent */
|
#define MASTER 60 /* percent */
|
||||||
#define MODKEY Mod1Mask
|
#define MODKEY Mod1Mask
|
||||||
|
|
||||||
#define KEYS \
|
#define KEYS \
|
||||||
@ -34,8 +36,9 @@ static Key key[] = { \
|
|||||||
{ MODKEY, XK_j, focusnext, { 0 } }, \
|
{ MODKEY, XK_j, focusnext, { 0 } }, \
|
||||||
{ MODKEY, XK_k, focusprev, { 0 } }, \
|
{ MODKEY, XK_k, focusprev, { 0 } }, \
|
||||||
{ MODKEY, XK_Return, zoom, { 0 } }, \
|
{ MODKEY, XK_Return, zoom, { 0 } }, \
|
||||||
{ MODKEY, XK_g, resizecol, { .i = 20 } }, \
|
{ MODKEY, XK_b, togglestackpos, { 0 } }, \
|
||||||
{ MODKEY, XK_s, resizecol, { .i = -20 } }, \
|
{ MODKEY, XK_g, resizecol, { .i = 1 } }, \
|
||||||
|
{ MODKEY, XK_s, resizecol, { .i = -1 } }, \
|
||||||
{ 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 } }, \
|
||||||
@ -61,7 +64,7 @@ static Key key[] = { \
|
|||||||
#define RULES \
|
#define RULES \
|
||||||
static Rule rule[] = { \
|
static Rule rule[] = { \
|
||||||
/* class:instance:title regex tags regex isfloat */ \
|
/* class:instance:title regex tags regex isfloat */ \
|
||||||
{ "Firefox.*", "net", True}, \
|
{ "Firefox.*", "net", False}, \
|
||||||
{ "Gimp.*", NULL, True}, \
|
{ "Gimp.*", NULL, True}, \
|
||||||
{ "MPlayer.*", NULL, True}, \
|
{ "MPlayer.*", NULL, True}, \
|
||||||
{ "Acroread.*", NULL, True}, \
|
{ "Acroread.*", NULL, True}, \
|
||||||
|
@ -8,7 +8,9 @@ const char *tags[] = { "1", "2", "3", "4", "5", NULL };
|
|||||||
|
|
||||||
#define DEFMODE dotile /* dofloat */
|
#define DEFMODE dotile /* dofloat */
|
||||||
#define FLOATSYMBOL "><>"
|
#define FLOATSYMBOL "><>"
|
||||||
#define TILESYMBOL "[]="
|
#define STACKPOS StackRight /* StackLeft */
|
||||||
|
#define BSTACKSYMBOL "==="
|
||||||
|
#define VSTACKSYMBOL "[]="
|
||||||
|
|
||||||
#define FONT "fixed"
|
#define FONT "fixed"
|
||||||
#define NORMBGCOLOR "#333366"
|
#define NORMBGCOLOR "#333366"
|
||||||
@ -18,7 +20,7 @@ const char *tags[] = { "1", "2", "3", "4", "5", NULL };
|
|||||||
#define STATUSBGCOLOR "#dddddd"
|
#define STATUSBGCOLOR "#dddddd"
|
||||||
#define STATUSFGCOLOR "#222222"
|
#define STATUSFGCOLOR "#222222"
|
||||||
|
|
||||||
#define MASTERW 60 /* percent */
|
#define MASTER 60 /* percent */
|
||||||
#define MODKEY Mod1Mask
|
#define MODKEY Mod1Mask
|
||||||
|
|
||||||
#define KEYS \
|
#define KEYS \
|
||||||
@ -28,8 +30,9 @@ static Key key[] = { \
|
|||||||
{ MODKEY, XK_Tab, focusnext, { 0 } }, \
|
{ MODKEY, XK_Tab, focusnext, { 0 } }, \
|
||||||
{ MODKEY|ShiftMask, XK_Tab, focusprev, { 0 } }, \
|
{ MODKEY|ShiftMask, XK_Tab, focusprev, { 0 } }, \
|
||||||
{ MODKEY, XK_Return, zoom, { 0 } }, \
|
{ MODKEY, XK_Return, zoom, { 0 } }, \
|
||||||
{ MODKEY, XK_g, resizecol, { .i = 20 } }, \
|
{ MODKEY, XK_b, togglestackpos, { 0 } }, \
|
||||||
{ MODKEY, XK_s, resizecol, { .i = -20 } }, \
|
{ MODKEY, XK_g, resizecol, { .i = 1 } }, \
|
||||||
|
{ MODKEY, XK_s, resizecol, { .i = -1 } }, \
|
||||||
{ 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.7
|
VERSION = 1.8
|
||||||
|
|
||||||
# Customize below to fit your system
|
# Customize below to fit your system
|
||||||
|
|
||||||
|
6
draw.c
6
draw.c
@ -72,7 +72,7 @@ drawtext(const char *text, unsigned long col[ColLast], Bool highlight) {
|
|||||||
if(highlight) {
|
if(highlight) {
|
||||||
r.x = dc.x + 2;
|
r.x = dc.x + 2;
|
||||||
r.y = dc.y + 2;
|
r.y = dc.y + 2;
|
||||||
r.width = r.height = 3;
|
r.width = r.height = (h + 2) / 4;
|
||||||
XFillRectangles(dpy, dc.drawable, dc.gc, &r, 1);
|
XFillRectangles(dpy, dc.drawable, dc.gc, &r, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -104,7 +104,9 @@ drawstatus(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dc.w = bmw;
|
dc.w = bmw;
|
||||||
drawtext(arrange == dofloat ? FLOATSYMBOL : TILESYMBOL, dc.status, False);
|
drawtext(arrange == dofloat ?
|
||||||
|
FLOATSYMBOL : stackpos == StackBottom ?
|
||||||
|
BSTACKSYMBOL : VSTACKSYMBOL, dc.status, False);
|
||||||
|
|
||||||
x = dc.x + dc.w;
|
x = dc.x + dc.w;
|
||||||
dc.w = textw(stext);
|
dc.w = textw(stext);
|
||||||
|
24
dwm.1
24
dwm.1
@ -9,9 +9,9 @@ dwm is a dynamic window manager for X. It manages windows in tiling and
|
|||||||
floating modes. Either mode can be applied dynamically, optimizing the
|
floating modes. Either mode can be applied dynamically, optimizing the
|
||||||
environment for the application in use and the task performed.
|
environment for 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 area. The master
|
||||||
column contains the window which currently needs most attention, whereas the
|
area contains the window which currently needs most attention, whereas the
|
||||||
stacking column contains all other windows. In floating mode windows can be
|
stacking area contains all other windows. In floating mode windows can be
|
||||||
resized and moved freely. Dialog windows are always managed floating,
|
resized and moved freely. Dialog windows are always managed floating,
|
||||||
regardless of the mode selected.
|
regardless of the mode selected.
|
||||||
.P
|
.P
|
||||||
@ -37,10 +37,11 @@ is read and displayed in the status text area.
|
|||||||
.TP
|
.TP
|
||||||
.B Button1
|
.B Button1
|
||||||
click on a tag label to display all windows with that tag, click on the mode
|
click on a tag label to display all windows with that tag, click on the mode
|
||||||
label toggles between tiled and floating mode.
|
label toggles between tiling and floating mode.
|
||||||
.TP
|
.TP
|
||||||
.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,
|
||||||
|
click on the mode label toggles the stack position (tiling mode).
|
||||||
.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.
|
||||||
@ -60,13 +61,16 @@ Focus next window.
|
|||||||
Focus previous window.
|
Focus previous window.
|
||||||
.TP
|
.TP
|
||||||
.B Mod1-Return
|
.B Mod1-Return
|
||||||
Zooms/cycles current window to/from master column (tiling mode), toggles maximization current window (floating mode).
|
Zooms/cycles current window to/from master area (tiling mode), toggles maximization current window (floating mode).
|
||||||
|
.TP
|
||||||
|
.B Mod1-b
|
||||||
|
Toggle stack position (tiling mode only).
|
||||||
.TP
|
.TP
|
||||||
.B Mod1-g
|
.B Mod1-g
|
||||||
Grow current column (tiling mode only).
|
Grow current area (tiling mode only).
|
||||||
.TP
|
.TP
|
||||||
.B Mod1-s
|
.B Mod1-s
|
||||||
Shrink current column (tiling mode only).
|
Shrink current area (tiling mode only).
|
||||||
.TP
|
.TP
|
||||||
.B Mod1-Shift-[1..n]
|
.B Mod1-Shift-[1..n]
|
||||||
Apply
|
Apply
|
||||||
@ -82,7 +86,7 @@ tag to/from current window.
|
|||||||
Close focused window.
|
Close focused window.
|
||||||
.TP
|
.TP
|
||||||
.B Mod1-space
|
.B Mod1-space
|
||||||
Toggle between tiled and floating mode (affects all windows).
|
Toggle between tiling and floating mode (affects all windows).
|
||||||
.TP
|
.TP
|
||||||
.B Mod1-[1..n]
|
.B Mod1-[1..n]
|
||||||
View all windows with
|
View all windows with
|
||||||
@ -105,7 +109,7 @@ Quit dwm.
|
|||||||
Move current window while dragging (floating mode only).
|
Move current window while dragging (floating mode only).
|
||||||
.TP
|
.TP
|
||||||
.B Mod1-Button2
|
.B Mod1-Button2
|
||||||
Zoom current window to the master column (tiling mode only).
|
Zoom current window to the master area (tiling mode only).
|
||||||
.TP
|
.TP
|
||||||
.B Mod1-Button3
|
.B Mod1-Button3
|
||||||
Resize current window while dragging (floating mode only).
|
Resize current window while dragging (floating mode only).
|
||||||
|
17
dwm.h
17
dwm.h
@ -38,6 +38,8 @@
|
|||||||
/* mask shorthands, used in event.c and client.c */
|
/* mask shorthands, used in event.c and client.c */
|
||||||
#define BUTTONMASK (ButtonPressMask | ButtonReleaseMask)
|
#define BUTTONMASK (ButtonPressMask | ButtonReleaseMask)
|
||||||
#define MOUSEMASK (BUTTONMASK | PointerMotionMask)
|
#define MOUSEMASK (BUTTONMASK | PointerMotionMask)
|
||||||
|
/* other stuff used in different places */
|
||||||
|
#define BORDERPX 1
|
||||||
#define PROTODELWIN 1
|
#define PROTODELWIN 1
|
||||||
|
|
||||||
enum { NetSupported, NetWMName, NetLast }; /* EWMH atoms */
|
enum { NetSupported, NetWMName, NetLast }; /* EWMH atoms */
|
||||||
@ -45,6 +47,10 @@ enum { WMProtocols, WMDelete, WMLast }; /* default atoms */
|
|||||||
enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
|
enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
|
||||||
enum { ColFG, ColBG, ColLast }; /* color */
|
enum { ColFG, ColBG, ColLast }; /* color */
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
StackLeft, StackBottom, StackRight
|
||||||
|
} StackPos; /* stack position*/
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
TopLeft, TopRight, BotLeft, BotRight
|
TopLeft, TopRight, BotLeft, BotRight
|
||||||
} Corner; /* window corners */
|
} Corner; /* window corners */
|
||||||
@ -95,8 +101,8 @@ struct Client {
|
|||||||
extern const char *tags[]; /* all tags */
|
extern const char *tags[]; /* all tags */
|
||||||
extern char stext[1024]; /* status text */
|
extern char stext[1024]; /* status text */
|
||||||
extern int bx, by, bw, bh, bmw; /* bar geometry, bar mode label width */
|
extern int bx, by, bw, bh, bmw; /* bar geometry, bar mode label width */
|
||||||
extern int mw, screen, sx, sy, sw, sh; /* screen geometry, master width */
|
extern int screen, sx, sy, sw, sh; /* screen geometry */
|
||||||
extern unsigned int ntags, numlockmask; /* number of tags, dynamic lock mask */
|
extern unsigned int master, ntags, numlockmask; /* master percent, number of tags, dynamic lock mask */
|
||||||
extern void (*handler[LASTEvent])(XEvent *); /* event handler */
|
extern void (*handler[LASTEvent])(XEvent *); /* event handler */
|
||||||
extern void (*arrange)(Arg *); /* arrange function, indicates mode */
|
extern void (*arrange)(Arg *); /* arrange function, indicates mode */
|
||||||
extern Atom wmatom[WMLast], netatom[NetLast];
|
extern Atom wmatom[WMLast], netatom[NetLast];
|
||||||
@ -105,6 +111,7 @@ extern Client *clients, *sel, *stack; /* global client list and stack */
|
|||||||
extern Cursor cursor[CurLast];
|
extern Cursor cursor[CurLast];
|
||||||
extern DC dc; /* global draw context */
|
extern DC dc; /* global draw context */
|
||||||
extern Display *dpy;
|
extern Display *dpy;
|
||||||
|
extern StackPos stackpos;
|
||||||
extern Window root, barwin;
|
extern Window root, barwin;
|
||||||
|
|
||||||
/* client.c */
|
/* client.c */
|
||||||
@ -117,6 +124,7 @@ extern void gravitate(Client *c, Bool invert); /* gravitate c */
|
|||||||
extern void killclient(Arg *arg); /* kill c nicely */
|
extern void killclient(Arg *arg); /* kill c nicely */
|
||||||
extern void manage(Window w, XWindowAttributes *wa); /* manage new client */
|
extern void manage(Window w, XWindowAttributes *wa); /* manage new client */
|
||||||
extern void resize(Client *c, Bool sizehints, Corner sticky); /* resize c*/
|
extern void resize(Client *c, Bool sizehints, Corner sticky); /* resize c*/
|
||||||
|
extern void resizetitle(Client *c); /* resizes c->twin correctly */
|
||||||
extern void updatesize(Client *c); /* update the size structs of c */
|
extern void updatesize(Client *c); /* update the size structs of c */
|
||||||
extern void updatetitle(Client *c); /* update the name of c */
|
extern void updatetitle(Client *c); /* update the name of c */
|
||||||
extern void unmanage(Client *c); /* destroy c */
|
extern void unmanage(Client *c); /* destroy c */
|
||||||
@ -160,10 +168,11 @@ extern void dotile(Arg *arg); /* arranges all windows, arg is ignored */
|
|||||||
extern void focusnext(Arg *arg); /* focuses next visible client, arg is ignored */
|
extern void focusnext(Arg *arg); /* focuses next visible client, arg is ignored */
|
||||||
extern void focusprev(Arg *arg); /* focuses previous visible client, arg is ignored */
|
extern void focusprev(Arg *arg); /* focuses previous visible client, arg is ignored */
|
||||||
extern Bool isvisible(Client *c); /* returns True if client is visible */
|
extern Bool isvisible(Client *c); /* returns True if client is visible */
|
||||||
extern void resizecol(Arg *arg); /* resizes the master width with arg's index value */
|
extern void resizecol(Arg *arg); /* resizes the master percent with arg's index value */
|
||||||
extern void restack(void); /* restores z layers of all clients */
|
extern void restack(void); /* restores z layers of all clients */
|
||||||
|
extern void togglestackpos(Arg *arg); /* toggles stack position */
|
||||||
extern void togglemode(Arg *arg); /* toggles global arrange function (dotile/dofloat) */
|
extern void togglemode(Arg *arg); /* toggles global arrange function (dotile/dofloat) */
|
||||||
extern void toggleview(Arg *arg); /* toggles the tag with arg's index (in)visible */
|
extern void toggleview(Arg *arg); /* toggles the tag with arg's index (in)visible */
|
||||||
extern void view(Arg *arg); /* views the tag with arg's index */
|
extern void view(Arg *arg); /* views the tag with arg's index */
|
||||||
extern void viewall(Arg *arg); /* views all tags, arg is ignored */
|
extern void viewall(Arg *arg); /* views all tags, arg is ignored */
|
||||||
extern void zoom(Arg *arg); /* zooms the focused client to master column, arg is ignored */
|
extern void zoom(Arg *arg); /* zooms the focused client to master area, arg is ignored */
|
||||||
|
9
event.c
9
event.c
@ -126,6 +126,8 @@ buttonpress(XEvent *e) {
|
|||||||
if(ev->x < x + bmw) {
|
if(ev->x < x + bmw) {
|
||||||
if(ev->button == Button1)
|
if(ev->button == Button1)
|
||||||
togglemode(NULL);
|
togglemode(NULL);
|
||||||
|
else if(ev->button == Button3)
|
||||||
|
togglestackpos(NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if((c = getclient(ev->window))) {
|
else if((c = getclient(ev->window))) {
|
||||||
@ -150,7 +152,6 @@ configurerequest(XEvent *e) {
|
|||||||
unsigned long newmask;
|
unsigned long newmask;
|
||||||
Client *c;
|
Client *c;
|
||||||
XConfigureRequestEvent *ev = &e->xconfigurerequest;
|
XConfigureRequestEvent *ev = &e->xconfigurerequest;
|
||||||
XEvent synev;
|
|
||||||
XWindowChanges wc;
|
XWindowChanges wc;
|
||||||
|
|
||||||
if((c = getclient(ev->window))) {
|
if((c = getclient(ev->window))) {
|
||||||
@ -177,8 +178,11 @@ configurerequest(XEvent *e) {
|
|||||||
else
|
else
|
||||||
configure(c);
|
configure(c);
|
||||||
XSync(dpy, False);
|
XSync(dpy, False);
|
||||||
if(c->isfloat)
|
if(c->isfloat) {
|
||||||
resize(c, False, TopLeft);
|
resize(c, False, TopLeft);
|
||||||
|
if(!isvisible(c))
|
||||||
|
ban(c);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
arrange(NULL);
|
arrange(NULL);
|
||||||
}
|
}
|
||||||
@ -317,6 +321,7 @@ propertynotify(XEvent *e) {
|
|||||||
}
|
}
|
||||||
if(ev->atom == XA_WM_NAME || ev->atom == netatom[NetWMName]) {
|
if(ev->atom == XA_WM_NAME || ev->atom == netatom[NetWMName]) {
|
||||||
updatetitle(c);
|
updatetitle(c);
|
||||||
|
resizetitle(c);
|
||||||
drawtitle(c);
|
drawtitle(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
11
main.c
11
main.c
@ -19,8 +19,8 @@
|
|||||||
|
|
||||||
char stext[1024];
|
char stext[1024];
|
||||||
Bool *seltag;
|
Bool *seltag;
|
||||||
int bx, by, bw, bh, bmw, mw, screen, sx, sy, sw, sh;
|
int bx, by, bw, bh, bmw, masterd, screen, sx, sy, sw, sh;
|
||||||
unsigned int ntags, numlockmask;
|
unsigned int master, ntags, numlockmask;
|
||||||
Atom wmatom[WMLast], netatom[NetLast];
|
Atom wmatom[WMLast], netatom[NetLast];
|
||||||
Bool running = True;
|
Bool running = True;
|
||||||
Bool issel = True;
|
Bool issel = True;
|
||||||
@ -129,11 +129,14 @@ setup(void) {
|
|||||||
dc.status[ColFG] = getcolor(STATUSFGCOLOR);
|
dc.status[ColFG] = getcolor(STATUSFGCOLOR);
|
||||||
setfont(FONT);
|
setfont(FONT);
|
||||||
|
|
||||||
bmw = textw(FLOATSYMBOL) > textw(TILESYMBOL) ? textw(FLOATSYMBOL) : textw(TILESYMBOL);
|
bmw = textw(VSTACKSYMBOL) > textw(BSTACKSYMBOL) ?
|
||||||
|
textw(VSTACKSYMBOL) : textw(BSTACKSYMBOL);
|
||||||
|
bmw = bmw > textw(FLOATSYMBOL) ?
|
||||||
|
bmw : textw(FLOATSYMBOL);
|
||||||
sx = sy = 0;
|
sx = sy = 0;
|
||||||
sw = DisplayWidth(dpy, screen);
|
sw = DisplayWidth(dpy, screen);
|
||||||
sh = DisplayHeight(dpy, screen);
|
sh = DisplayHeight(dpy, screen);
|
||||||
mw = (sw * MASTERW) / 100;
|
master = MASTER;
|
||||||
|
|
||||||
bx = by = 0;
|
bx = by = 0;
|
||||||
bw = sw;
|
bw = sw;
|
||||||
|
128
view.c
128
view.c
@ -49,8 +49,8 @@ togglemax(Client *c)
|
|||||||
if((c->ismax = !c->ismax)) {
|
if((c->ismax = !c->ismax)) {
|
||||||
c->rx = c->x; c->x = sx;
|
c->rx = c->x; c->x = sx;
|
||||||
c->ry = c->y; c->y = bh;
|
c->ry = c->y; c->y = bh;
|
||||||
c->rw = c->w; c->w = sw;
|
c->rw = c->w; c->w = sw - 2 * BORDERPX;
|
||||||
c->rh = c->h; c->h = sh - bh - 2;
|
c->rh = c->h; c->h = sh - bh - 2 * BORDERPX;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
c->x = c->rx;
|
c->x = c->rx;
|
||||||
@ -65,6 +65,7 @@ togglemax(Client *c)
|
|||||||
/* extern */
|
/* extern */
|
||||||
|
|
||||||
void (*arrange)(Arg *) = DEFMODE;
|
void (*arrange)(Arg *) = DEFMODE;
|
||||||
|
StackPos stackpos = STACKPOS;
|
||||||
|
|
||||||
void
|
void
|
||||||
detach(Client *c) {
|
detach(Client *c) {
|
||||||
@ -95,19 +96,35 @@ dofloat(Arg *arg) {
|
|||||||
restack();
|
restack();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* This algorithm is based on a (M)aster area and a (S)tacking area.
|
||||||
|
* It supports following arrangements:
|
||||||
|
* SSMMM MMMMM MMMSS
|
||||||
|
* SSMMM SSSSS MMMSS
|
||||||
|
*/
|
||||||
void
|
void
|
||||||
dotile(Arg *arg) {
|
dotile(Arg *arg) {
|
||||||
int h, i, n, w;
|
unsigned int i, n, md, stackw, stackh, tw, th;
|
||||||
Client *c;
|
Client *c;
|
||||||
|
|
||||||
w = sw - mw;
|
|
||||||
for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next))
|
for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next))
|
||||||
n++;
|
n++;
|
||||||
|
|
||||||
|
if(stackpos == StackBottom) {
|
||||||
|
md = ((sh - bh) * master) / 100;
|
||||||
|
stackw = sw;
|
||||||
|
stackh = sh - bh - md;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
md = (sw * master) / 100;
|
||||||
|
stackw = sw - md;
|
||||||
|
stackh = sh - bh;
|
||||||
|
}
|
||||||
|
|
||||||
|
tw = stackw;
|
||||||
if(n > 1)
|
if(n > 1)
|
||||||
h = (sh - bh) / (n - 1);
|
th = stackh / (n - 1);
|
||||||
else
|
else
|
||||||
h = sh - bh;
|
th = stackh;
|
||||||
|
|
||||||
for(i = 0, c = clients; c; c = c->next) {
|
for(i = 0, c = clients; c; c = c->next) {
|
||||||
if(isvisible(c)) {
|
if(isvisible(c)) {
|
||||||
@ -116,32 +133,53 @@ dotile(Arg *arg) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
c->ismax = False;
|
c->ismax = False;
|
||||||
if(n == 1) {
|
c->x = sx;
|
||||||
c->x = sx;
|
c->y = sy + bh;
|
||||||
c->y = sy + bh;
|
if(n == 1) { /* only 1 window */
|
||||||
c->w = sw - 2;
|
c->w = sw - 2 * BORDERPX;
|
||||||
c->h = sh - 2 - bh;
|
c->h = sh - 2 * BORDERPX - bh;
|
||||||
}
|
}
|
||||||
else if(i == 0) {
|
else if(i == 0) { /* master window */
|
||||||
c->x = sx;
|
if(stackpos == StackLeft)
|
||||||
c->y = sy + bh;
|
c->x += stackw;
|
||||||
c->w = mw - 2;
|
switch(stackpos) {
|
||||||
c->h = sh - 2 - bh;
|
case StackLeft:
|
||||||
|
case StackRight:
|
||||||
|
c->w = md - 2 * BORDERPX;
|
||||||
|
c->h = sh - bh - 2 * BORDERPX;
|
||||||
|
break;
|
||||||
|
case StackBottom:
|
||||||
|
c->w = sw - 2 * BORDERPX;
|
||||||
|
c->h = md - 2 * BORDERPX;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if(h > bh) {
|
else { /* tile window */
|
||||||
c->x = sx + mw;
|
if(stackpos == StackRight)
|
||||||
c->y = sy + (i - 1) * h + bh;
|
c->x += md;
|
||||||
c->w = w - 2;
|
if(th > bh) {
|
||||||
if(i + 1 == n)
|
switch(stackpos) {
|
||||||
c->h = sh - c->y - 2;
|
case StackLeft:
|
||||||
else
|
case StackRight:
|
||||||
c->h = h - 2;
|
c->y = sy + (i - 1) * th + bh;
|
||||||
}
|
if(i + 1 == n)
|
||||||
else { /* fallback if h < bh */
|
c->h = sh - c->y - 2 * BORDERPX;
|
||||||
c->x = sx + mw;
|
break;
|
||||||
c->y = sy + bh;
|
case StackBottom:
|
||||||
c->w = w - 2;
|
c->y = sy + md + (i - 1) * th + bh;
|
||||||
c->h = sh - 2 - bh;
|
if(i + 1 == n)
|
||||||
|
c->h = sh - c->y - 2 * BORDERPX;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
c->w = tw - 2 * BORDERPX;
|
||||||
|
c->h = th - 2 * BORDERPX;
|
||||||
|
}
|
||||||
|
else { /* fallback if th < bh */
|
||||||
|
if(stackpos == StackBottom)
|
||||||
|
c->y += md;
|
||||||
|
c->w = stackw - 2 * BORDERPX;
|
||||||
|
c->h = stackh - 2 * BORDERPX;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
resize(c, False, TopLeft);
|
resize(c, False, TopLeft);
|
||||||
i++;
|
i++;
|
||||||
@ -210,14 +248,14 @@ resizecol(Arg *arg) {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if(sel == getnext(clients)) {
|
if(sel == getnext(clients)) {
|
||||||
if(mw + arg->i > sw - 100 || mw + arg->i < 100)
|
if(master + arg->i > 95 || master + arg->i < 5)
|
||||||
return;
|
return;
|
||||||
mw += arg->i;
|
master += arg->i;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if(mw - arg->i > sw - 100 || mw - arg->i < 100)
|
if(master - arg->i > 95 || master - arg->i < 5)
|
||||||
return;
|
return;
|
||||||
mw -= arg->i;
|
master -= arg->i;
|
||||||
}
|
}
|
||||||
arrange(NULL);
|
arrange(NULL);
|
||||||
}
|
}
|
||||||
@ -235,11 +273,18 @@ restack(void) {
|
|||||||
XRaiseWindow(dpy, sel->win);
|
XRaiseWindow(dpy, sel->win);
|
||||||
XRaiseWindow(dpy, sel->twin);
|
XRaiseWindow(dpy, sel->twin);
|
||||||
}
|
}
|
||||||
if(arrange != dofloat)
|
if(arrange != dofloat) {
|
||||||
|
if(!sel->isfloat) {
|
||||||
|
XLowerWindow(dpy, sel->twin);
|
||||||
|
XLowerWindow(dpy, sel->win);
|
||||||
|
}
|
||||||
for(c = nexttiled(clients); c; c = nexttiled(c->next)) {
|
for(c = nexttiled(clients); c; c = nexttiled(c->next)) {
|
||||||
|
if(c == sel)
|
||||||
|
continue;
|
||||||
XLowerWindow(dpy, c->twin);
|
XLowerWindow(dpy, c->twin);
|
||||||
XLowerWindow(dpy, c->win);
|
XLowerWindow(dpy, c->win);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
drawall();
|
drawall();
|
||||||
XSync(dpy, False);
|
XSync(dpy, False);
|
||||||
while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
|
while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
|
||||||
@ -266,6 +311,17 @@ toggleview(Arg *arg) {
|
|||||||
arrange(NULL);
|
arrange(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
togglestackpos(Arg *arg) {
|
||||||
|
if(arrange == dofloat)
|
||||||
|
return;
|
||||||
|
if(stackpos == StackBottom)
|
||||||
|
stackpos = STACKPOS;
|
||||||
|
else
|
||||||
|
stackpos = StackBottom;
|
||||||
|
arrange(NULL);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
view(Arg *arg) {
|
view(Arg *arg) {
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
@ -287,6 +343,8 @@ viewall(Arg *arg) {
|
|||||||
arrange(NULL);
|
arrange(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
zoom(Arg *arg) {
|
zoom(Arg *arg) {
|
||||||
unsigned int n;
|
unsigned int n;
|
||||||
|
Reference in New Issue
Block a user