Compare commits
1 Commits
distrosymb
...
fibonacci
Author | SHA1 | Date | |
---|---|---|---|
|
e6afb29fa7 |
@@ -5,7 +5,6 @@ static const unsigned int borderpx = 1; /* border pixel of windows */
|
|||||||
static const unsigned int snap = 32; /* snap pixel */
|
static const unsigned int snap = 32; /* snap pixel */
|
||||||
static const int showbar = 1; /* 0 means no bar */
|
static const int showbar = 1; /* 0 means no bar */
|
||||||
static const int topbar = 1; /* 0 means bottom bar */
|
static const int topbar = 1; /* 0 means bottom bar */
|
||||||
static const char *distrosymbol = "";
|
|
||||||
static const char *fonts[] = { "monospace:size=10" };
|
static const char *fonts[] = { "monospace:size=10" };
|
||||||
static const char dmenufont[] = "monospace:size=10";
|
static const char dmenufont[] = "monospace:size=10";
|
||||||
static const char col_gray1[] = "#222222";
|
static const char col_gray1[] = "#222222";
|
||||||
@@ -37,11 +36,14 @@ static const float mfact = 0.55; /* factor of master area size [0.05..0.95]
|
|||||||
static const int nmaster = 1; /* number of clients in master area */
|
static const int nmaster = 1; /* number of clients in master area */
|
||||||
static const int resizehints = 1; /* 1 means respect size hints in tiled resizals */
|
static const int resizehints = 1; /* 1 means respect size hints in tiled resizals */
|
||||||
|
|
||||||
|
#include "fibonacci.c"
|
||||||
static const Layout layouts[] = {
|
static const Layout layouts[] = {
|
||||||
/* symbol arrange function */
|
/* symbol arrange function */
|
||||||
{ "[]=", 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 },
|
||||||
|
{ "[@]", spiral },
|
||||||
|
{ "[\\]", dwindle },
|
||||||
};
|
};
|
||||||
|
|
||||||
/* key definitions */
|
/* key definitions */
|
||||||
@@ -77,6 +79,8 @@ 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_r, setlayout, {.v = &layouts[3]} },
|
||||||
|
{ MODKEY|ShiftMask, XK_r, setlayout, {.v = &layouts[4]} },
|
||||||
{ 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 } },
|
||||||
|
8
dwm.c
8
dwm.c
@@ -113,7 +113,6 @@ typedef struct {
|
|||||||
|
|
||||||
struct Monitor {
|
struct Monitor {
|
||||||
char ltsymbol[16];
|
char ltsymbol[16];
|
||||||
char distrosymbol[16];
|
|
||||||
float mfact;
|
float mfact;
|
||||||
int nmaster;
|
int nmaster;
|
||||||
int num;
|
int num;
|
||||||
@@ -432,8 +431,7 @@ buttonpress(XEvent *e)
|
|||||||
focus(NULL);
|
focus(NULL);
|
||||||
}
|
}
|
||||||
if (ev->window == selmon->barwin) {
|
if (ev->window == selmon->barwin) {
|
||||||
x = TEXTW(m->distrosymbol);
|
i = x = 0;
|
||||||
i = 0;
|
|
||||||
do
|
do
|
||||||
x += TEXTW(tags[i]);
|
x += TEXTW(tags[i]);
|
||||||
while (ev->x >= x && ++i < LENGTH(tags));
|
while (ev->x >= x && ++i < LENGTH(tags));
|
||||||
@@ -644,7 +642,6 @@ createmon(void)
|
|||||||
m->lt[0] = &layouts[0];
|
m->lt[0] = &layouts[0];
|
||||||
m->lt[1] = &layouts[1 % LENGTH(layouts)];
|
m->lt[1] = &layouts[1 % LENGTH(layouts)];
|
||||||
strncpy(m->ltsymbol, layouts[0].symbol, sizeof m->ltsymbol);
|
strncpy(m->ltsymbol, layouts[0].symbol, sizeof m->ltsymbol);
|
||||||
strncpy(m->distrosymbol, distrosymbol, sizeof m->distrosymbol);
|
|
||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -718,9 +715,6 @@ drawbar(Monitor *m)
|
|||||||
urg |= c->tags;
|
urg |= c->tags;
|
||||||
}
|
}
|
||||||
x = 0;
|
x = 0;
|
||||||
w = blw = TEXTW(m->distrosymbol);
|
|
||||||
drw_setscheme(drw, scheme[SchemeNorm]);
|
|
||||||
x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->distrosymbol, 0);
|
|
||||||
for (i = 0; i < LENGTH(tags); i++) {
|
for (i = 0; i < LENGTH(tags); i++) {
|
||||||
w = TEXTW(tags[i]);
|
w = TEXTW(tags[i]);
|
||||||
drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? SchemeSel : SchemeNorm]);
|
drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? SchemeSel : SchemeNorm]);
|
||||||
|
66
fibonacci.c
Normal file
66
fibonacci.c
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
void
|
||||||
|
fibonacci(Monitor *mon, int s) {
|
||||||
|
unsigned int i, n, nx, ny, nw, nh;
|
||||||
|
Client *c;
|
||||||
|
|
||||||
|
for(n = 0, c = nexttiled(mon->clients); c; c = nexttiled(c->next), n++);
|
||||||
|
if(n == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
nx = mon->wx;
|
||||||
|
ny = 0;
|
||||||
|
nw = mon->ww;
|
||||||
|
nh = mon->wh;
|
||||||
|
|
||||||
|
for(i = 0, c = nexttiled(mon->clients); c; c = nexttiled(c->next)) {
|
||||||
|
if((i % 2 && nh / 2 > 2 * c->bw)
|
||||||
|
|| (!(i % 2) && nw / 2 > 2 * c->bw)) {
|
||||||
|
if(i < n - 1) {
|
||||||
|
if(i % 2)
|
||||||
|
nh /= 2;
|
||||||
|
else
|
||||||
|
nw /= 2;
|
||||||
|
if((i % 4) == 2 && !s)
|
||||||
|
nx += nw;
|
||||||
|
else if((i % 4) == 3 && !s)
|
||||||
|
ny += nh;
|
||||||
|
}
|
||||||
|
if((i % 4) == 0) {
|
||||||
|
if(s)
|
||||||
|
ny += nh;
|
||||||
|
else
|
||||||
|
ny -= nh;
|
||||||
|
}
|
||||||
|
else if((i % 4) == 1)
|
||||||
|
nx += nw;
|
||||||
|
else if((i % 4) == 2)
|
||||||
|
ny += nh;
|
||||||
|
else if((i % 4) == 3) {
|
||||||
|
if(s)
|
||||||
|
nx += nw;
|
||||||
|
else
|
||||||
|
nx -= nw;
|
||||||
|
}
|
||||||
|
if(i == 0)
|
||||||
|
{
|
||||||
|
if(n != 1)
|
||||||
|
nw = mon->ww * mon->mfact;
|
||||||
|
ny = mon->wy;
|
||||||
|
}
|
||||||
|
else if(i == 1)
|
||||||
|
nw = mon->ww - nw;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
resize(c, nx, ny, nw - 2 * c->bw, nh - 2 * c->bw, False);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
dwindle(Monitor *mon) {
|
||||||
|
fibonacci(mon, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
spiral(Monitor *mon) {
|
||||||
|
fibonacci(mon, 0);
|
||||||
|
}
|
Reference in New Issue
Block a user