Compare commits
4 Commits
dbe98ebfe0
...
5eee770269
Author | SHA1 | Date | |
---|---|---|---|
|
5eee770269 | ||
|
9023b15621 | ||
|
acdf610fda | ||
|
a5e4455d7a |
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,2 +1,3 @@
|
|||||||
dwm
|
dwm
|
||||||
*.o
|
*.o
|
||||||
|
compile_commands.json
|
@ -46,6 +46,7 @@ static const Layout layouts[] = {
|
|||||||
{ "[]=", tile }, /* first entry is default */
|
{ "[]=", tile }, /* first entry is default */
|
||||||
{ "><>", NULL }, /* no layout function means floating behavior */
|
{ "><>", NULL }, /* no layout function means floating behavior */
|
||||||
{ "[M]", monocle },
|
{ "[M]", monocle },
|
||||||
|
{ "|||", col },
|
||||||
};
|
};
|
||||||
|
|
||||||
/* key definitions */
|
/* key definitions */
|
||||||
@ -81,6 +82,7 @@ static Key keys[] = {
|
|||||||
{ MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
|
{ MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
|
||||||
{ MODKEY, XK_f, setlayout, {.v = &layouts[1]} },
|
{ MODKEY, XK_f, setlayout, {.v = &layouts[1]} },
|
||||||
{ MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
|
{ MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
|
||||||
|
{ MODKEY, XK_c, setlayout, {.v = &layouts[3]} },
|
||||||
{ MODKEY, XK_space, setlayout, {0} },
|
{ MODKEY, XK_space, setlayout, {0} },
|
||||||
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} },
|
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} },
|
||||||
{ MODKEY, XK_0, view, {.ui = ~0 } },
|
{ MODKEY, XK_0, view, {.ui = ~0 } },
|
||||||
|
2
config.h
2
config.h
@ -43,6 +43,7 @@ static const int resizehints = 1; /* 1 means respect size hints in tiled resi
|
|||||||
static const Layout layouts[] = {
|
static const Layout layouts[] = {
|
||||||
/* symbol arrange function */
|
/* symbol arrange function */
|
||||||
{ "[]=", tile }, /* first entry is default */
|
{ "[]=", tile }, /* first entry is default */
|
||||||
|
{ "|||", col },
|
||||||
{ "><>", NULL }, /* no layout function means floating behavior */
|
{ "><>", NULL }, /* no layout function means floating behavior */
|
||||||
{ "[M]", monocle },
|
{ "[M]", monocle },
|
||||||
};
|
};
|
||||||
@ -88,6 +89,7 @@ static Key keys[] = {
|
|||||||
{ MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
|
{ MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
|
||||||
{ MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
|
{ MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
|
||||||
|
|
||||||
|
{ MODKEY, XK_Escape, spawn, SHCMD("lock") },
|
||||||
{ MODKEY, XK_F1, spawn, SHCMD("firefox") },
|
{ MODKEY, XK_F1, spawn, SHCMD("firefox") },
|
||||||
{ MODKEY, XK_F2, spawn, SHCMD("nautilus") },
|
{ MODKEY, XK_F2, spawn, SHCMD("nautilus") },
|
||||||
{ MODKEY, XK_F3, spawn, SHCMD("gedit") },
|
{ MODKEY, XK_F3, spawn, SHCMD("gedit") },
|
||||||
|
59
dwm.c
59
dwm.c
@ -49,7 +49,8 @@
|
|||||||
#define CLEANMASK(mask) (mask & ~(numlockmask|LockMask) & (ShiftMask|ControlMask|Mod1Mask|Mod2Mask|Mod3Mask|Mod4Mask|Mod5Mask))
|
#define CLEANMASK(mask) (mask & ~(numlockmask|LockMask) & (ShiftMask|ControlMask|Mod1Mask|Mod2Mask|Mod3Mask|Mod4Mask|Mod5Mask))
|
||||||
#define INTERSECT(x,y,w,h,m) (MAX(0, MIN((x)+(w),(m)->wx+(m)->ww) - MAX((x),(m)->wx)) \
|
#define INTERSECT(x,y,w,h,m) (MAX(0, MIN((x)+(w),(m)->wx+(m)->ww) - MAX((x),(m)->wx)) \
|
||||||
* MAX(0, MIN((y)+(h),(m)->wy+(m)->wh) - MAX((y),(m)->wy)))
|
* MAX(0, MIN((y)+(h),(m)->wy+(m)->wh) - MAX((y),(m)->wy)))
|
||||||
#define ISVISIBLE(C) ((C->tags & C->mon->tagset[C->mon->seltags]))
|
#define ISVISIBLEONTAG(C, T) ((C->tags & T))
|
||||||
|
#define ISVISIBLE(C) ISVISIBLEONTAG(C, C->mon->tagset[C->mon->seltags])
|
||||||
#define LENGTH(X) (sizeof X / sizeof X[0])
|
#define LENGTH(X) (sizeof X / sizeof X[0])
|
||||||
#define MOUSEMASK (BUTTONMASK|PointerMotionMask)
|
#define MOUSEMASK (BUTTONMASK|PointerMotionMask)
|
||||||
#define WIDTH(X) ((X)->w + 2 * (X)->bw)
|
#define WIDTH(X) ((X)->w + 2 * (X)->bw)
|
||||||
@ -172,12 +173,14 @@ static int applysizehints(Client *c, int *x, int *y, int *w, int *h, int interac
|
|||||||
static void arrange(Monitor *m);
|
static void arrange(Monitor *m);
|
||||||
static void arrangemon(Monitor *m);
|
static void arrangemon(Monitor *m);
|
||||||
static void attach(Client *c);
|
static void attach(Client *c);
|
||||||
|
static void attachaside(Client *c);
|
||||||
static void attachstack(Client *c);
|
static void attachstack(Client *c);
|
||||||
static void buttonpress(XEvent *e);
|
static void buttonpress(XEvent *e);
|
||||||
static void checkotherwm(void);
|
static void checkotherwm(void);
|
||||||
static void cleanup(void);
|
static void cleanup(void);
|
||||||
static void cleanupmon(Monitor *mon);
|
static void cleanupmon(Monitor *mon);
|
||||||
static void clientmessage(XEvent *e);
|
static void clientmessage(XEvent *e);
|
||||||
|
static void col(Monitor *);
|
||||||
static void configure(Client *c);
|
static void configure(Client *c);
|
||||||
static void configurenotify(XEvent *e);
|
static void configurenotify(XEvent *e);
|
||||||
static void configurerequest(XEvent *e);
|
static void configurerequest(XEvent *e);
|
||||||
@ -210,6 +213,7 @@ static void maprequest(XEvent *e);
|
|||||||
static void monocle(Monitor *m);
|
static void monocle(Monitor *m);
|
||||||
static void motionnotify(XEvent *e);
|
static void motionnotify(XEvent *e);
|
||||||
static void movemouse(const Arg *arg);
|
static void movemouse(const Arg *arg);
|
||||||
|
static Client *nexttagged(Client *c);
|
||||||
static Client *nexttiled(Client *c);
|
static Client *nexttiled(Client *c);
|
||||||
static void pop(Client *);
|
static void pop(Client *);
|
||||||
static void propertynotify(XEvent *e);
|
static void propertynotify(XEvent *e);
|
||||||
@ -444,6 +448,17 @@ attach(Client *c)
|
|||||||
c->mon->clients = c;
|
c->mon->clients = c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
attachaside(Client *c) {
|
||||||
|
Client *at = nexttagged(c);
|
||||||
|
if(!at) {
|
||||||
|
attach(c);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
c->next = at->next;
|
||||||
|
at->next = c;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
attachstack(Client *c)
|
attachstack(Client *c)
|
||||||
{
|
{
|
||||||
@ -1183,7 +1198,7 @@ manage(Window w, XWindowAttributes *wa)
|
|||||||
c->isfloating = c->oldstate = trans != None || c->isfixed;
|
c->isfloating = c->oldstate = trans != None || c->isfixed;
|
||||||
if (c->isfloating)
|
if (c->isfloating)
|
||||||
XRaiseWindow(dpy, c->win);
|
XRaiseWindow(dpy, c->win);
|
||||||
attach(c);
|
attachaside(c);
|
||||||
attachstack(c);
|
attachstack(c);
|
||||||
XChangeProperty(dpy, root, netatom[NetClientList], XA_WINDOW, 32, PropModeAppend,
|
XChangeProperty(dpy, root, netatom[NetClientList], XA_WINDOW, 32, PropModeAppend,
|
||||||
(unsigned char *) &(c->win), 1);
|
(unsigned char *) &(c->win), 1);
|
||||||
@ -1319,6 +1334,16 @@ movemouse(const Arg *arg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Client *
|
||||||
|
nexttagged(Client *c) {
|
||||||
|
Client *walked = c->mon->clients;
|
||||||
|
for(;
|
||||||
|
walked && (walked->isfloating || !ISVISIBLEONTAG(walked, c->tags));
|
||||||
|
walked = walked->next
|
||||||
|
);
|
||||||
|
return walked;
|
||||||
|
}
|
||||||
|
|
||||||
Client *
|
Client *
|
||||||
nexttiled(Client *c)
|
nexttiled(Client *c)
|
||||||
{
|
{
|
||||||
@ -1589,7 +1614,7 @@ sendmon(Client *c, Monitor *m)
|
|||||||
detachstack(c);
|
detachstack(c);
|
||||||
c->mon = m;
|
c->mon = m;
|
||||||
c->tags = m->tagset[m->seltags]; /* assign tags of target monitor */
|
c->tags = m->tagset[m->seltags]; /* assign tags of target monitor */
|
||||||
attach(c);
|
attachaside(c);
|
||||||
attachstack(c);
|
attachstack(c);
|
||||||
focus(NULL);
|
focus(NULL);
|
||||||
arrange(NULL);
|
arrange(NULL);
|
||||||
@ -1897,6 +1922,32 @@ tile(Monitor *m)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
col(Monitor *m) {
|
||||||
|
unsigned int i, n, h, w, x, y,mw;
|
||||||
|
Client *c;
|
||||||
|
|
||||||
|
for(n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
|
||||||
|
if(n == 0)
|
||||||
|
return;
|
||||||
|
if(n > m->nmaster)
|
||||||
|
mw = m->nmaster ? m->ww * m->mfact : 0;
|
||||||
|
else
|
||||||
|
mw = m->ww;
|
||||||
|
for(i = x = y = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) {
|
||||||
|
if(i < m->nmaster) {
|
||||||
|
w = (mw - x) / (MIN(n, m->nmaster)-i);
|
||||||
|
resize(c, x + m->wx, m->wy, w - (2*c->bw), m->wh - (2*c->bw), False);
|
||||||
|
x += WIDTH(c);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
h = (m->wh - y) / (n - i);
|
||||||
|
resize(c, x + m->wx, m->wy + y, m->ww - x - (2*c->bw), h - (2*c->bw), False);
|
||||||
|
y += HEIGHT(c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
togglebar(const Arg *arg)
|
togglebar(const Arg *arg)
|
||||||
{
|
{
|
||||||
@ -2121,7 +2172,7 @@ updategeom(void)
|
|||||||
m->clients = c->next;
|
m->clients = c->next;
|
||||||
detachstack(c);
|
detachstack(c);
|
||||||
c->mon = mons;
|
c->mon = mons;
|
||||||
attach(c);
|
attachaside(c);
|
||||||
attachstack(c);
|
attachstack(c);
|
||||||
}
|
}
|
||||||
if (m == selmon)
|
if (m == selmon)
|
||||||
|
Loading…
Reference in New Issue
Block a user