Compare commits
29 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 |
3
.hgtags
3
.hgtags
@ -10,5 +10,4 @@ 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
|
|
||||||
|
8
client.c
8
client.c
@ -199,7 +199,7 @@ void
|
|||||||
manage(Window w, XWindowAttributes *wa)
|
manage(Window w, XWindowAttributes *wa)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
Client *c, *tc;
|
Client *c;
|
||||||
Window trans;
|
Window trans;
|
||||||
XSetWindowAttributes twa;
|
XSetWindowAttributes twa;
|
||||||
|
|
||||||
@ -238,11 +238,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 &&
|
||||||
|
@ -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.4
|
||||||
|
|
||||||
# Customize below to fit your system
|
# Customize below to fit your system
|
||||||
|
|
||||||
|
12
dwm.1
12
dwm.1
@ -90,6 +90,18 @@ mode only).
|
|||||||
Maximize current
|
Maximize current
|
||||||
.BR window .
|
.BR window .
|
||||||
.TP
|
.TP
|
||||||
|
.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]
|
.B Mod1-Shift-[1..n]
|
||||||
Apply
|
Apply
|
||||||
.B nth tag
|
.B nth tag
|
||||||
|
3
dwm.h
3
dwm.h
@ -115,7 +115,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 +132,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);
|
||||||
|
1
main.c
1
main.c
@ -55,6 +55,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);
|
||||||
}
|
}
|
||||||
|
86
view.c
86
view.c
@ -38,6 +38,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;
|
||||||
@ -180,53 +187,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,13 +285,17 @@ 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;
|
c->next = clients;
|
||||||
|
Reference in New Issue
Block a user