add: alpha for st & new layouts for dwm
This commit is contained in:
+9
-5
@@ -51,6 +51,8 @@ static const Rule rules[] = {
|
||||
{ NULL, "keepassxc", NULL, SPTAG(2), 1, -1 },
|
||||
{ NULL, "spnmtui", NULL, SPTAG(3), 1, -1 },
|
||||
{ NULL, "spmusic", NULL, SPTAG(4), 1, -1 },
|
||||
{ "st-256color", NULL, NULL, 1 << 0, 0, -1 },
|
||||
{ "firefox", NULL, NULL, 1 << 1, 0, -1 },
|
||||
};
|
||||
|
||||
/* layout(s) */
|
||||
@@ -60,11 +62,14 @@ static const int resizehints = 1; /* 1 means respect size hints in tiled resi
|
||||
static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */
|
||||
static const int refreshrate = 120; /* refresh rate (per second) for client move/resize */
|
||||
|
||||
#include "fibonacci.c"
|
||||
static const Layout layouts[] = {
|
||||
/* symbol arrange function */
|
||||
{ "[\\]", dwindle },
|
||||
{ "[]=", tile }, /* first entry is default */
|
||||
{ "><>", NULL }, /* no layout function means floating behavior */
|
||||
{ "[M]", monocle },
|
||||
{ "[@]", spiral },
|
||||
};
|
||||
|
||||
/* key definitions */
|
||||
@@ -87,7 +92,7 @@ static const char *djcmd[] = { "dj.sh", NULL };
|
||||
static const Key keys[] = {
|
||||
/* modifier key function argument */
|
||||
// essential apps
|
||||
{ MODKEY, XK_d, spawn, {.v = dmenucmd } },
|
||||
{ MODKEY, XK_space, spawn, {.v = dmenucmd } },
|
||||
{ MODKEY, XK_Return, spawn, {.v = termcmd } },
|
||||
{ MODKEY, XK_m, spawn, {.v = djcmd } },
|
||||
// window management
|
||||
@@ -96,17 +101,15 @@ static const Key keys[] = {
|
||||
{ MODKEY, XK_h, setmfact, {.f = -0.05} },
|
||||
{ MODKEY, XK_l, setmfact, {.f = +0.05} },
|
||||
{ MODKEY, XK_q, killclient, {0} },
|
||||
{ MODKEY, XK_space, togglefloating, {0} },
|
||||
{ MODKEY|ShiftMask, XK_f, togglefloating, {0} },
|
||||
// focus change (tags and monitors)
|
||||
//{ MODKEY, XK_0, view, {.ui = ~0 } },
|
||||
//{ MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } },
|
||||
{ MODKEY, XK_comma, focusmon, {.i = -1 } },
|
||||
{ MODKEY, XK_period, focusmon, {.i = +1 } },
|
||||
{ MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
|
||||
{ MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
|
||||
// scratchpads
|
||||
{ MODKEY|ShiftMask, XK_Return, togglescratch, {.ui = 0 } }, // ephemeral term
|
||||
{ MODKEY|ShiftMask, XK_f, togglescratch, {.ui = 1 } }, // file manager
|
||||
{ MODKEY, XK_f, togglescratch, {.ui = 1 } }, // file manager
|
||||
{ MODKEY, XK_p, togglescratch, {.ui = 2 } }, // keepass
|
||||
{ MODKEY, XK_n, togglescratch, {.ui = 3 } }, // nmtui
|
||||
{ MODKEY|ShiftMask, XK_m, togglescratch, {.ui = 4 } }, // music
|
||||
@@ -120,6 +123,7 @@ static const Key keys[] = {
|
||||
TAGKEYS( XK_7, 6)
|
||||
TAGKEYS( XK_8, 7)
|
||||
TAGKEYS( XK_9, 8)
|
||||
// misc
|
||||
{ MODKEY|ShiftMask, XK_e, quit, {0} },
|
||||
};
|
||||
|
||||
|
||||
+89
-64
@@ -14,21 +14,43 @@ static const char col_gray3[] = "#bbbbbb";
|
||||
static const char col_gray4[] = "#eeeeee";
|
||||
static const char col_main[] = "#735e97";
|
||||
static const char *colors[][3] = {
|
||||
/* fg bg border */
|
||||
[SchemeNorm] = { col_gray3, col_gray1, col_gray2 },
|
||||
[SchemeSel] = { col_gray4, col_main, col_main },
|
||||
/* fg bg border */
|
||||
[SchemeNorm] = { col_gray3, col_gray1, col_gray2 },
|
||||
[SchemeSel] = { col_gray4, col_main, col_main },
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
const char *name;
|
||||
const void *cmd;
|
||||
} Sp;
|
||||
const char *spcmd0[] = {"st", "-n", "spterm", "-g", "120x34", NULL };
|
||||
const char *spcmd1[] = {"st", "-n", "spfm", "-g", "144x41", "-e", "lf", NULL };
|
||||
const char *spcmd2[] = {"keepassxc", NULL };
|
||||
const char *spcmd3[] = {"st", "-n", "spnmtui", "-g", "140x30", "-e", "nmtui", NULL };
|
||||
const char *spcmd4[] = {"st", "-n", "spmusic", "-g", "140x30", "-e", "ncmpcpp", NULL };
|
||||
static Sp scratchpads[] = {
|
||||
/* name cmd */
|
||||
{"spterm", spcmd0},
|
||||
{"spranger", spcmd1},
|
||||
{"spkeepassxc", spcmd2},
|
||||
{"spnmtui", spcmd3},
|
||||
{"spmusic", spcmd4},
|
||||
};
|
||||
|
||||
/* tagging */
|
||||
static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
|
||||
|
||||
static const Rule rules[] = {
|
||||
/* xprop(1):
|
||||
* WM_CLASS(STRING) = instance, class
|
||||
* WM_NAME(STRING) = title
|
||||
*/
|
||||
/* class instance title tags mask isfloating monitor */
|
||||
{ "Firefox", NULL, NULL, 1 << 1, 0, -1 },
|
||||
/* xprop(1):
|
||||
* WM_CLASS(STRING) = instance, class
|
||||
* WM_NAME(STRING) = title
|
||||
*/
|
||||
/* class instance title tags mask isfloating monitor */
|
||||
{ NULL, "spterm", NULL, SPTAG(0), 1, -1 },
|
||||
{ NULL, "spfm", NULL, SPTAG(1), 1, -1 },
|
||||
{ NULL, "keepassxc", NULL, SPTAG(2), 1, -1 },
|
||||
{ NULL, "spnmtui", NULL, SPTAG(3), 1, -1 },
|
||||
{ NULL, "spmusic", NULL, SPTAG(4), 1, -1 },
|
||||
};
|
||||
|
||||
/* layout(s) */
|
||||
@@ -39,79 +61,82 @@ static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen win
|
||||
static const int refreshrate = 120; /* refresh rate (per second) for client move/resize */
|
||||
|
||||
static const Layout layouts[] = {
|
||||
/* symbol arrange function */
|
||||
{ "[]=", tile }, /* first entry is default */
|
||||
{ "><>", NULL }, /* no layout function means floating behavior */
|
||||
{ "[M]", monocle },
|
||||
/* symbol arrange function */
|
||||
{ "[]=", tile }, /* first entry is default */
|
||||
{ "><>", NULL }, /* no layout function means floating behavior */
|
||||
{ "[M]", monocle },
|
||||
};
|
||||
|
||||
/* key definitions */
|
||||
#define MODKEY Mod4Mask /* Mod4 = Hyper key */
|
||||
#define TAGKEYS(KEY,TAG) \
|
||||
{ MODKEY, KEY, view, {.ui = 1 << TAG} }, \
|
||||
{ MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \
|
||||
{ MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \
|
||||
{ MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} },
|
||||
{ MODKEY, KEY, view, {.ui = 1 << TAG} }, \
|
||||
{ MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \
|
||||
{ MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \
|
||||
{ MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} },
|
||||
|
||||
/* helper for spawning shell commands in the pre dwm-5.0 fashion */
|
||||
#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
|
||||
|
||||
/* commands */
|
||||
static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
|
||||
static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_main, "-sf", col_gray4, NULL };
|
||||
static const char *dmenucmd[] = { "dmenu_run", "-np", "-l", "10", "-g", "2", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_main, "-sf", col_gray4, NULL };
|
||||
static const char *termcmd[] = { "st", NULL };
|
||||
static const char *djcmd[] = { "dj.sh", NULL };
|
||||
|
||||
static const Key keys[] = {
|
||||
/* modifier key function argument */
|
||||
{ MODKEY, XK_d, spawn, {.v = dmenucmd } },
|
||||
{ MODKEY, XK_Return, spawn, {.v = termcmd } },
|
||||
// { MODKEY, XK_b, togglebar, {0} },
|
||||
{ MODKEY, XK_j, focusstack, {.i = +1 } },
|
||||
{ MODKEY, XK_k, focusstack, {.i = -1 } },
|
||||
// { MODKEY, XK_i, incnmaster, {.i = +1 } },
|
||||
// { MODKEY, XK_d, incnmaster, {.i = -1 } },
|
||||
{ MODKEY, XK_h, setmfact, {.f = -0.05} },
|
||||
{ MODKEY, XK_l, setmfact, {.f = +0.05} },
|
||||
// { MODKEY, XK_Return, zoom, {0} },
|
||||
// { MODKEY, XK_Tab, view, {0} },
|
||||
{ MODKEY, XK_q, killclient, {0} },
|
||||
// { MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
|
||||
// { MODKEY, XK_f, setlayout, {.v = &layouts[1]} },
|
||||
{ MODKEY, XK_f, setlayout, {.v = &layouts[2]} },
|
||||
// { MODKEY, XK_space, setlayout, {0} },
|
||||
{ MODKEY, XK_space, togglefloating, {0} },
|
||||
{ MODKEY, XK_0, view, {.ui = ~0 } },
|
||||
{ MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } },
|
||||
{ MODKEY, XK_comma, focusmon, {.i = -1 } },
|
||||
{ MODKEY, XK_period, focusmon, {.i = +1 } },
|
||||
{ MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
|
||||
{ MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
|
||||
TAGKEYS( XK_1, 0)
|
||||
TAGKEYS( XK_2, 1)
|
||||
TAGKEYS( XK_3, 2)
|
||||
TAGKEYS( XK_4, 3)
|
||||
TAGKEYS( XK_5, 4)
|
||||
TAGKEYS( XK_6, 5)
|
||||
TAGKEYS( XK_7, 6)
|
||||
TAGKEYS( XK_8, 7)
|
||||
TAGKEYS( XK_9, 8)
|
||||
{ MODKEY|ShiftMask, XK_e, quit, {0} },
|
||||
/* modifier key function argument */
|
||||
// essential apps
|
||||
{ MODKEY, XK_d, spawn, {.v = dmenucmd } },
|
||||
{ MODKEY, XK_Return, spawn, {.v = termcmd } },
|
||||
{ MODKEY, XK_m, spawn, {.v = djcmd } },
|
||||
// window management
|
||||
{ MODKEY, XK_j, focusstack, {.i = +1 } },
|
||||
{ MODKEY, XK_k, focusstack, {.i = -1 } },
|
||||
{ MODKEY, XK_h, setmfact, {.f = -0.05} },
|
||||
{ MODKEY, XK_l, setmfact, {.f = +0.05} },
|
||||
{ MODKEY, XK_q, killclient, {0} },
|
||||
{ MODKEY, XK_space, togglefloating, {0} },
|
||||
// focus change (tags and monitors)
|
||||
//{ MODKEY, XK_0, view, {.ui = ~0 } },
|
||||
//{ MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } },
|
||||
{ MODKEY, XK_comma, focusmon, {.i = -1 } },
|
||||
{ MODKEY, XK_period, focusmon, {.i = +1 } },
|
||||
{ MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
|
||||
{ MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
|
||||
// scratchpads
|
||||
{ MODKEY|ShiftMask, XK_Return, togglescratch, {.ui = 0 } }, // ephemeral term
|
||||
{ MODKEY|ShiftMask, XK_f, togglescratch, {.ui = 1 } }, // file manager
|
||||
{ MODKEY, XK_p, togglescratch, {.ui = 2 } }, // keepass
|
||||
{ MODKEY, XK_n, togglescratch, {.ui = 3 } }, // nmtui
|
||||
{ MODKEY|ShiftMask, XK_m, togglescratch, {.ui = 4 } }, // music
|
||||
// tag movement
|
||||
TAGKEYS( XK_1, 0)
|
||||
TAGKEYS( XK_2, 1)
|
||||
TAGKEYS( XK_3, 2)
|
||||
TAGKEYS( XK_4, 3)
|
||||
TAGKEYS( XK_5, 4)
|
||||
TAGKEYS( XK_6, 5)
|
||||
TAGKEYS( XK_7, 6)
|
||||
TAGKEYS( XK_8, 7)
|
||||
TAGKEYS( XK_9, 8)
|
||||
{ MODKEY|ShiftMask, XK_e, quit, {0} },
|
||||
};
|
||||
|
||||
/* button definitions */
|
||||
/* click can be ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */
|
||||
static const Button buttons[] = {
|
||||
/* click event mask button function argument */
|
||||
{ ClkLtSymbol, 0, Button1, setlayout, {0} },
|
||||
{ ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} },
|
||||
{ ClkWinTitle, 0, Button2, zoom, {0} },
|
||||
{ ClkStatusText, 0, Button2, spawn, {.v = termcmd } },
|
||||
{ ClkClientWin, MODKEY, Button1, movemouse, {0} },
|
||||
{ ClkClientWin, MODKEY, Button2, togglefloating, {0} },
|
||||
{ ClkClientWin, MODKEY, Button3, resizemouse, {0} },
|
||||
{ ClkTagBar, 0, Button1, view, {0} },
|
||||
{ ClkTagBar, 0, Button3, toggleview, {0} },
|
||||
{ ClkTagBar, MODKEY, Button1, tag, {0} },
|
||||
{ ClkTagBar, MODKEY, Button3, toggletag, {0} },
|
||||
/* click event mask button function argument */
|
||||
{ ClkLtSymbol, 0, Button1, setlayout, {0} },
|
||||
{ ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} },
|
||||
{ ClkWinTitle, 0, Button2, zoom, {0} },
|
||||
{ ClkStatusText, 0, Button2, spawn, {.v = termcmd } },
|
||||
{ ClkClientWin, MODKEY, Button1, movemouse, {0} },
|
||||
{ ClkClientWin, MODKEY, Button2, togglefloating, {0} },
|
||||
{ ClkClientWin, MODKEY, Button1, resizemouse, {0} },
|
||||
{ ClkTagBar, 0, Button1, view, {0} },
|
||||
{ ClkTagBar, 0, Button3, toggleview, {0} },
|
||||
{ ClkTagBar, MODKEY, Button1, tag, {0} },
|
||||
{ ClkTagBar, MODKEY, Button3, toggletag, {0} },
|
||||
};
|
||||
|
||||
|
||||
+22
-43
@@ -1,47 +1,26 @@
|
||||
--- config.def.h
|
||||
+++ config.def.h
|
||||
@@ -18,17 +18,33 @@ static const char *colors[][3] = {
|
||||
[SchemeSel] = { col_gray4, col_cyan, col_cyan },
|
||||
@@ -36,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 resizehints = 1; /* 1 means respect size hints in tiled resizals */
|
||||
|
||||
+#include "fibonacci.c"
|
||||
static const Layout layouts[] = {
|
||||
/* symbol arrange function */
|
||||
{ "[]=", tile }, /* first entry is default */
|
||||
{ "><>", NULL }, /* no layout function means floating behavior */
|
||||
{ "[M]", monocle },
|
||||
+ { "[@]", spiral },
|
||||
+ { "[\\]", dwindle },
|
||||
};
|
||||
|
||||
+typedef struct {
|
||||
+ const char *name;
|
||||
+ const void *cmd;
|
||||
+} Sp;
|
||||
+const char *spcmd1[] = {"st", "-n", "spterm", "-g", "120x34", NULL };
|
||||
+const char *spcmd2[] = {"st", "-n", "spfm", "-g", "144x41", "-e", "ranger", NULL };
|
||||
+const char *spcmd3[] = {"keepassxc", NULL };
|
||||
+static Sp scratchpads[] = {
|
||||
+ /* name cmd */
|
||||
+ {"spterm", spcmd1},
|
||||
+ {"spranger", spcmd2},
|
||||
+ {"keepassxc", spcmd3},
|
||||
+};
|
||||
+
|
||||
/* tagging */
|
||||
static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
|
||||
-
|
||||
static const Rule rules[] = {
|
||||
/* xprop(1):
|
||||
* WM_CLASS(STRING) = instance, class
|
||||
* WM_NAME(STRING) = title
|
||||
*/
|
||||
/* class instance title tags mask isfloating monitor */
|
||||
- { "Gimp", NULL, NULL, 0, 1, -1 },
|
||||
- { "Firefox", NULL, NULL, 1 << 8, 0, -1 },
|
||||
+ { "Gimp", NULL, NULL, 0, 1, -1 },
|
||||
+ { "Firefox", NULL, NULL, 1 << 8, 0, -1 },
|
||||
+ { NULL, "spterm", NULL, SPTAG(0), 1, -1 },
|
||||
+ { NULL, "spfm", NULL, SPTAG(1), 1, -1 },
|
||||
+ { NULL, "keepassxc", NULL, SPTAG(2), 0, -1 },
|
||||
};
|
||||
|
||||
/* layout(s) */
|
||||
@@ -59,6 +75,7 @@ static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn()
|
||||
static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL };
|
||||
static const char *termcmd[] = { "st", NULL };
|
||||
|
||||
+
|
||||
static Key keys[] = {
|
||||
/* modifier key function argument */
|
||||
{ MODKEY, XK_p, spawn, {.v = dmenucmd } },
|
||||
/* key definitions */
|
||||
@@ -76,6 +79,8 @@ static Key keys[] = {
|
||||
{ MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
|
||||
{ MODKEY, XK_f, setlayout, {.v = &layouts[1]} },
|
||||
{ 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|ShiftMask, XK_space, togglefloating, {0} },
|
||||
{ MODKEY, XK_0, view, {.ui = ~0 } },
|
||||
|
||||
+9
-5
@@ -51,6 +51,8 @@ static const Rule rules[] = {
|
||||
{ NULL, "keepassxc", NULL, SPTAG(2), 1, -1 },
|
||||
{ NULL, "spnmtui", NULL, SPTAG(3), 1, -1 },
|
||||
{ NULL, "spmusic", NULL, SPTAG(4), 1, -1 },
|
||||
{ "st-256color", NULL, NULL, 1 << 0, 0, -1 },
|
||||
{ "firefox", NULL, NULL, 1 << 1, 0, -1 },
|
||||
};
|
||||
|
||||
/* layout(s) */
|
||||
@@ -60,11 +62,14 @@ static const int resizehints = 1; /* 1 means respect size hints in tiled resi
|
||||
static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */
|
||||
static const int refreshrate = 120; /* refresh rate (per second) for client move/resize */
|
||||
|
||||
#include "fibonacci.c"
|
||||
static const Layout layouts[] = {
|
||||
/* symbol arrange function */
|
||||
{ "[\\]", dwindle },
|
||||
{ "[]=", tile }, /* first entry is default */
|
||||
{ "><>", NULL }, /* no layout function means floating behavior */
|
||||
{ "[M]", monocle },
|
||||
{ "[@]", spiral },
|
||||
};
|
||||
|
||||
/* key definitions */
|
||||
@@ -87,7 +92,7 @@ static const char *djcmd[] = { "dj.sh", NULL };
|
||||
static const Key keys[] = {
|
||||
/* modifier key function argument */
|
||||
// essential apps
|
||||
{ MODKEY, XK_d, spawn, {.v = dmenucmd } },
|
||||
{ MODKEY, XK_space, spawn, {.v = dmenucmd } },
|
||||
{ MODKEY, XK_Return, spawn, {.v = termcmd } },
|
||||
{ MODKEY, XK_m, spawn, {.v = djcmd } },
|
||||
// window management
|
||||
@@ -96,17 +101,15 @@ static const Key keys[] = {
|
||||
{ MODKEY, XK_h, setmfact, {.f = -0.05} },
|
||||
{ MODKEY, XK_l, setmfact, {.f = +0.05} },
|
||||
{ MODKEY, XK_q, killclient, {0} },
|
||||
{ MODKEY, XK_space, togglefloating, {0} },
|
||||
{ MODKEY|ShiftMask, XK_f, togglefloating, {0} },
|
||||
// focus change (tags and monitors)
|
||||
//{ MODKEY, XK_0, view, {.ui = ~0 } },
|
||||
//{ MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } },
|
||||
{ MODKEY, XK_comma, focusmon, {.i = -1 } },
|
||||
{ MODKEY, XK_period, focusmon, {.i = +1 } },
|
||||
{ MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
|
||||
{ MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
|
||||
// scratchpads
|
||||
{ MODKEY|ShiftMask, XK_Return, togglescratch, {.ui = 0 } }, // ephemeral term
|
||||
{ MODKEY|ShiftMask, XK_f, togglescratch, {.ui = 1 } }, // file manager
|
||||
{ MODKEY, XK_f, togglescratch, {.ui = 1 } }, // file manager
|
||||
{ MODKEY, XK_p, togglescratch, {.ui = 2 } }, // keepass
|
||||
{ MODKEY, XK_n, togglescratch, {.ui = 3 } }, // nmtui
|
||||
{ MODKEY|ShiftMask, XK_m, togglescratch, {.ui = 4 } }, // music
|
||||
@@ -120,6 +123,7 @@ static const Key keys[] = {
|
||||
TAGKEYS( XK_7, 6)
|
||||
TAGKEYS( XK_8, 7)
|
||||
TAGKEYS( XK_9, 8)
|
||||
// misc
|
||||
{ MODKEY|ShiftMask, XK_e, quit, {0} },
|
||||
};
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
From ec9f55b6005cfa3b025b3d700c61af3ce539d057 Mon Sep 17 00:00:00 2001
|
||||
From: Niki Yoshiuchi <nyoshiuchi@gmail.com>
|
||||
Date: Sat, 18 Apr 2020 09:55:26 -0700
|
||||
Subject: [PATCH] Adding the fibonacci layout patch
|
||||
|
||||
---
|
||||
config.def.h | 5 ++++
|
||||
fibonacci.c | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
2 files changed, 71 insertions(+)
|
||||
create mode 100644 fibonacci.c
|
||||
|
||||
diff --git a/config.def.h b/config.def.h
|
||||
index 1c0b587..5708487 100644
|
||||
--- a/config.def.h
|
||||
+++ b/config.def.h
|
||||
@@ -36,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 resizehints = 1; /* 1 means respect size hints in tiled resizals */
|
||||
|
||||
+#include "fibonacci.c"
|
||||
static const Layout layouts[] = {
|
||||
/* symbol arrange function */
|
||||
{ "[]=", tile }, /* first entry is default */
|
||||
{ "><>", NULL }, /* no layout function means floating behavior */
|
||||
{ "[M]", monocle },
|
||||
+ { "[@]", spiral },
|
||||
+ { "[\\]", dwindle },
|
||||
};
|
||||
|
||||
/* key definitions */
|
||||
@@ -76,6 +79,8 @@ static Key keys[] = {
|
||||
{ MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
|
||||
{ MODKEY, XK_f, setlayout, {.v = &layouts[1]} },
|
||||
{ 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|ShiftMask, XK_space, togglefloating, {0} },
|
||||
{ MODKEY, XK_0, view, {.ui = ~0 } },
|
||||
diff --git a/fibonacci.c b/fibonacci.c
|
||||
new file mode 100644
|
||||
index 0000000..fce0a57
|
||||
--- /dev/null
|
||||
+++ b/fibonacci.c
|
||||
@@ -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);
|
||||
+}
|
||||
--
|
||||
2.20.1
|
||||
|
||||
|
||||
Reference in New Issue
Block a user