Compare commits
No commits in common. "5eee7702699f38c5ee6318a186ec699c5075badd" and "dbe98ebfe07754606c16c475efc07089126fe700" have entirely different histories.
5eee770269
...
dbe98ebfe0
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,3 +1,2 @@
|
|||||||
dwm
|
dwm
|
||||||
*.o
|
*.o
|
||||||
compile_commands.json
|
|
@ -46,7 +46,6 @@ 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 */
|
||||||
@ -82,7 +81,6 @@ 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,7 +43,6 @@ 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 },
|
||||||
};
|
};
|
||||||
@ -89,7 +88,6 @@ 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,8 +49,7 @@
|
|||||||
#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 ISVISIBLEONTAG(C, T) ((C->tags & T))
|
#define ISVISIBLE(C) ((C->tags & C->mon->tagset[C->mon->seltags]))
|
||||||
#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)
|
||||||
@ -173,14 +172,12 @@ 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);
|
||||||
@ -213,7 +210,6 @@ 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);
|
||||||
@ -448,17 +444,6 @@ 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)
|
||||||
{
|
{
|
||||||
@ -1198,7 +1183,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);
|
||||||
attachaside(c);
|
attach(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);
|
||||||
@ -1334,16 +1319,6 @@ 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)
|
||||||
{
|
{
|
||||||
@ -1614,7 +1589,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 */
|
||||||
attachaside(c);
|
attach(c);
|
||||||
attachstack(c);
|
attachstack(c);
|
||||||
focus(NULL);
|
focus(NULL);
|
||||||
arrange(NULL);
|
arrange(NULL);
|
||||||
@ -1922,32 +1897,6 @@ 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)
|
||||||
{
|
{
|
||||||
@ -2172,7 +2121,7 @@ updategeom(void)
|
|||||||
m->clients = c->next;
|
m->clients = c->next;
|
||||||
detachstack(c);
|
detachstack(c);
|
||||||
c->mon = mons;
|
c->mon = mons;
|
||||||
attachaside(c);
|
attach(c);
|
||||||
attachstack(c);
|
attachstack(c);
|
||||||
}
|
}
|
||||||
if (m == selmon)
|
if (m == selmon)
|
||||||
|
Loading…
Reference in New Issue
Block a user