finish work, now on to testing
This commit is contained in:
parent
079a50c7cb
commit
a442c9b501
6
TODO.txt
6
TODO.txt
|
@ -1,6 +0,0 @@
|
|||
TODO: https://github.com/szatanjl/dwm/commit/1529909466206016f2101457bbf37c67195714c8
|
||||
TODO: continue reworking keybinds, add layout binds, remove binds related to gaps, add stack binds
|
||||
TODO: add remaining systray vars to config.h
|
||||
|
||||
FIX: barschemes needs constants as colors
|
||||
FIX: remove dmenumon/dmenucmd references in dwm.c or come up with a better solution
|
272
config.h
272
config.h
|
@ -1,8 +1,7 @@
|
|||
/* See LICENSE file for copyright and license details. */
|
||||
|
||||
#define BROWSER "librewolf"
|
||||
#define TERMINAL "kitty"
|
||||
#define PLAYER "firefox" /* this is currently only passed to playerctl as the client to control */
|
||||
#define PLAYERCTL "firefox" /* this is currently only passed to playerctl as the client to control */
|
||||
|
||||
/* appearance */
|
||||
static const unsigned int borderpx = 2;
|
||||
|
@ -10,34 +9,67 @@ static const unsigned int snap = 20;
|
|||
static const int showbar = 1;
|
||||
static const int topbar = 1;
|
||||
static const int swallowfloating = 0;
|
||||
static const unsigned int systraypinning = 0;
|
||||
static const unsigned int systrayonleft = 0;
|
||||
static const unsigned int systrayspacing = 2;
|
||||
static const int systraypinningfailfirst = 1;
|
||||
static const int showsystray = 1;
|
||||
static const int systrayonleft = 0;
|
||||
static char *fonts[] = {
|
||||
static const char *fonts[] = {
|
||||
"monospace:pixelsize=14",
|
||||
"monospace:pixelsize=20",
|
||||
"monospace:pixelsize=30",
|
||||
};
|
||||
|
||||
static char *colors[] = {
|
||||
[0] = "#000000", [1] = "#7f0000", [2] = "#007f00", [3] = "#7f7f00",
|
||||
[4] = "#00007f", [5] = "#7f007f", [6] = "#007f7f", [7] = "#cccccc",
|
||||
[8] = "#333333", [9] = "#ff0000", [10] = "#00ff00", [11] = "#ffff00",
|
||||
[12] = "#0000ff", [13] = "#ff00ff", [14] = "#00ffff", [15] = "#ffffff",
|
||||
/* Extra Colors (not accessible with SGR escapes) */
|
||||
[16] = "#222222", [17] = "#444444",
|
||||
};
|
||||
static char color0[] = "#000000";
|
||||
static char color1[] = "#7f0000";
|
||||
static char color2[] = "#007f00";
|
||||
static char color3[] = "#7f7f00";
|
||||
static char color4[] = "#00007f";
|
||||
static char color5[] = "#7f007f";
|
||||
static char color6[] = "#007f7f";
|
||||
static char color7[] = "#cccccc";
|
||||
static char color8[] = "#333333";
|
||||
static char color9[] = "#ff0000";
|
||||
static char color10[] = "#00ff00";
|
||||
static char color11[] = "#ffff00";
|
||||
static char color12[] = "#0000ff";
|
||||
static char color13[] = "#ff00ff";
|
||||
static char color14[] = "#00ffff";
|
||||
static char color15[] = "#ffffff";
|
||||
static char bordernorm[] = "#222222";
|
||||
static char bordersel[] = "#444444";
|
||||
|
||||
static char *barschemes[][3] = {
|
||||
/* fg bg border */
|
||||
[SchemeNorm] = {colors[15], colors[0], colors[16]},
|
||||
[SchemeSel] = {colors[15], colors[4], colors[17]},
|
||||
[SchemeStatus] = {colors[7], colors[0], "#000000"}, // Statusbar right
|
||||
[SchemeTagsSel] = {colors[0], colors[4], "#000000"}, // Tagbar left selected
|
||||
[SchemeTagsNorm] = {colors[7], colors[0], "#000000"}, // Tagbar left unselected
|
||||
[SchemeInfoSel] = {colors[7], colors[0], "#000000"}, // infobar middle selected
|
||||
[SchemeInfoNorm] = {colors[7], colors[0], "#000000"}, // infobar middle unselected
|
||||
[SchemeNorm] = { color15, color0, bordernorm },
|
||||
[SchemeSel] = { color15, color4, bordersel },
|
||||
[SchemeStatus] = { color7, color0, "#000000" }, // Statusbar right
|
||||
[SchemeTagsSel] = { color0, color4, "#000000" }, // Tagbar left selected
|
||||
[SchemeTagsNorm] = { color7, color0, "#000000" }, // Tagbar left unselected
|
||||
[SchemeInfoSel] = { color7, color0, "#000000" }, // infobar middle selected
|
||||
[SchemeInfoNorm] = { color7, color0, "#000000" }, // infobar middle unselected
|
||||
};
|
||||
|
||||
// static const char *colors[] = {
|
||||
// [0] = "#000000", [1] = "#7f0000", [2] = "#007f00", [3] = "#7f7f00",
|
||||
// [4] = "#00007f", [5] = "#7f007f", [6] = "#007f7f", [7] = "#cccccc",
|
||||
// [8] = "#333333", [9] = "#ff0000", [10] = "#00ff00", [11] = "#ffff00",
|
||||
// [12] = "#0000ff", [13] = "#ff00ff", [14] = "#00ffff", [15] = "#ffffff",
|
||||
// /* Extra Colors (not accessible with SGR escapes) */
|
||||
// [16] = "#222222", [17] = "#444444",
|
||||
// };
|
||||
//
|
||||
// static char *barschemes[][3] = {
|
||||
// /* fg bg border */
|
||||
// [SchemeNorm] = {colors[15], colors[0], colors[16]},
|
||||
// [SchemeSel] = {colors[15], colors[4], colors[17]},
|
||||
// [SchemeStatus] = {colors[7], colors[0], "#000000"}, // Statusbar right
|
||||
// [SchemeTagsSel] = {colors[0], colors[4], "#000000"}, // Tagbar left selected
|
||||
// [SchemeTagsNorm] = {colors[7], colors[0], "#000000"}, // Tagbar left unselected
|
||||
// [SchemeInfoSel] = {colors[7], colors[0], "#000000"}, // infobar middle selected
|
||||
// [SchemeInfoNorm] = {colors[7], colors[0], "#000000"}, // infobar middle unselected
|
||||
// };
|
||||
|
||||
/* tagging */
|
||||
static const char *tags[] = {"1", "2", "3", "4", "5", "6", "7", "8", "9"};
|
||||
|
||||
|
@ -68,11 +100,11 @@ static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen win
|
|||
static const Layout layouts[] = {
|
||||
/* symbol arrange function */
|
||||
{ "[]=", tile },
|
||||
{ "[M]", monocle },
|
||||
{ "TTT", bstack },
|
||||
{ ":::", gaplessgrid },
|
||||
{ "===", bstackhoriz },
|
||||
{ "|M|", centeredmaster },
|
||||
{ ":::", gaplessgrid },
|
||||
{ "[M]", monocle },
|
||||
{ "===", bstackhoriz },
|
||||
{ ">M>", centeredfloatingmaster },
|
||||
{ "><>", NULL }, /* Floating */
|
||||
};
|
||||
|
@ -84,14 +116,6 @@ static const Layout layouts[] = {
|
|||
{ MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \
|
||||
{ MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \
|
||||
{ MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} },
|
||||
#define STACKKEYS(MOD,ACTION) \
|
||||
{MOD, XK_j, ACTION##stack, {.i = INC(+1)}}, \
|
||||
{MOD, XK_k, ACTION##stack, {.i = INC(-1)}}, \
|
||||
{MOD, XK_tab, ACTION##stack, {.i = 0}}, \
|
||||
{MOD, XK_v, ACTION##stack, {.i = PREVSEL}}, \
|
||||
// {MOD, XK_a, ACTION##stack, {.i = 1}}, \
|
||||
// {MOD, XK_z, ACTION##stack, {.i = 2}}, \
|
||||
// {MOD, XK_x, ACTION##stack, {.i = -1}},
|
||||
|
||||
/* helper for spawning shell commands in the pre dwm-5.0 fashion */
|
||||
#define SHCMD(cmd) { .v = (const char *[]) { "/bin/sh", "-c", cmd, NULL } }
|
||||
|
@ -105,24 +129,24 @@ static const char *spmix[] = { "m", "/bin/sh", "-c", "$TERMINAL --name spmix -e
|
|||
|
||||
/* Xresources preferences to load at startup */
|
||||
ResourcePref resources[] = {
|
||||
{ "color0", STRING, &colors[0] },
|
||||
{ "color1", STRING, &colors[1] },
|
||||
{ "color2", STRING, &colors[2] },
|
||||
{ "color3", STRING, &colors[3] },
|
||||
{ "color4", STRING, &colors[4] },
|
||||
{ "color5", STRING, &colors[5] },
|
||||
{ "color6", STRING, &colors[6] },
|
||||
{ "color7", STRING, &colors[7] },
|
||||
{ "color8", STRING, &colors[8] },
|
||||
{ "color9", STRING, &colors[9] },
|
||||
{ "color10", STRING, &colors[10] },
|
||||
{ "color11", STRING, &colors[11] },
|
||||
{ "color12", STRING, &colors[12] },
|
||||
{ "color13", STRING, &colors[13] },
|
||||
{ "color14", STRING, &colors[14] },
|
||||
{ "color15", STRING, &colors[15] },
|
||||
{ "bordernorm", STRING, &colors[16] },
|
||||
{ "bordersel", STRING, &colors[17] },
|
||||
{ "color0", STRING, &color0 },
|
||||
{ "color1", STRING, &color1 },
|
||||
{ "color2", STRING, &color2 },
|
||||
{ "color3", STRING, &color3 },
|
||||
{ "color4", STRING, &color4 },
|
||||
{ "color5", STRING, &color5 },
|
||||
{ "color6", STRING, &color6 },
|
||||
{ "color7", STRING, &color7 },
|
||||
{ "color8", STRING, &color8 },
|
||||
{ "color9", STRING, &color9 },
|
||||
{ "color10", STRING, &color10 },
|
||||
{ "color11", STRING, &color11 },
|
||||
{ "color12", STRING, &color12 },
|
||||
{ "color13", STRING, &color13 },
|
||||
{ "color14", STRING, &color14 },
|
||||
{ "color15", STRING, &color15 },
|
||||
{ "bordernorm", STRING, &bordernorm },
|
||||
{ "bordersel", STRING, &bordersel },
|
||||
};
|
||||
|
||||
#include <X11/XF86keysym.h>
|
||||
|
@ -154,82 +178,84 @@ static const Key keys[] = {
|
|||
TAGKEYS( XK_9, 8)
|
||||
{ MODKEY, XK_0, view, {.ui = ~0} },
|
||||
{ MODKEY | ShiftMask, XK_0, tag, {.ui = ~0} },
|
||||
// { MODKEY, XK_ssharp, spawn, {.v = (const char *[]){NULL}} },
|
||||
// { MODKEY | ShiftMask, XK_ssharp, spawn, {.v = (const char *[]){NULL}} },
|
||||
// { MODKEY, XK_acute, spawn, {.v = (const char *[]){NULL}} },
|
||||
// { MODKEY | ShiftMask, XK_acute, spawn, {.v = (const char *[]){NULL}} },
|
||||
// { MODKEY, XK_bracketleft, spawn, {.v = (const char *[]){NULL}} },
|
||||
// { MODKEY | ShiftMask, XK_bracketleft, spawn, {.v = (const char *[]){NULL}} },
|
||||
// { MODKEY, XK_bracketright, spawn, {.v = (const char *[]){NULL}} },
|
||||
// { MODKEY | ShiftMask, XK_bracketright, spawn, {.v = (const char *[]){NULL}} },
|
||||
{ MODKEY, XK_BackSpace, spawn, {.v = (const char *[]){"sysact", NULL}} },
|
||||
{ MODKEY | ShiftMask, XK_BackSpace, spawn, {.v = (const char *[]){"sysact", NULL}} },
|
||||
/* XK_Tab is bound in STACKKEYS*/
|
||||
{ MODKEY|ShiftMask, XK_Tab, view, {0} },
|
||||
{ MODKEY, XK_q, killclient, {0} },
|
||||
// { MODKEY | ShiftMask, XK_q, spawn, {.v = (const char *[]){NULL}} },
|
||||
// { MODKEY, XK_w, spawn, {.v = (const char *[]){NULL}} },
|
||||
// { MODKEY | ShiftMask, XK_w, spawn, {.v = (const char *[]){NULL}} },
|
||||
{ MODKEY, XK_e, togglescratch, {.v = splf} },
|
||||
// { MODKEY | ShiftMask, XK_e, spawn, {.v = (const char *[]){NULL}} },
|
||||
{ MODKEY, XK_Tab, focusstack, {.i = 0} },
|
||||
{ MODKEY | ShiftMask, XK_Tab, pushstack, {.i = 0} },
|
||||
{ MODKEY, XK_apostrophe, killclient, {0} },
|
||||
// { MODKEY | ShiftMask, XK_apostrophe, spawn, {.v = (const char *[]){NULL}} },
|
||||
{ MODKEY, XK_comma, focusmon, {.i = -1} },
|
||||
{ MODKEY | ShiftMask, XK_comma, tagmon, {.i = -1} },
|
||||
{ MODKEY, XK_period, focusmon, {.i = +1} },
|
||||
{ MODKEY | ShiftMask, XK_period, tagmon, {.i = +1} },
|
||||
{ MODKEY, XK_p, togglefullscr, {0} },
|
||||
// { MODKEY | ShiftMask, XK_p, setlayout, {.v = (const char *[]){NULL}} },
|
||||
// { MODKEY, XK_y, spawn, {.v = (const char *[]){NULL}} },
|
||||
// { MODKEY | ShiftMask, XK_y, spawn, {.v = (const char *[]){NULL}} },
|
||||
// { MODKEY, XK_f, spawn, {.v = (const char *[]){NULL}} },
|
||||
// { MODKEY | ShiftMask, XK_f, spawn, {.v = (const char *[]){NULL}} },
|
||||
// { MODKEY, XK_g, spawn, {.v = (const char *[]){NULL}} },
|
||||
// { MODKEY | ShiftMask, XK_g, spawn, {.v = (const char *[]){NULL}} },
|
||||
{ MODKEY, XK_c, incnmaster, {.i = -1} },
|
||||
{ MODKEY | ShiftMask, XK_c, resetnmaster, {0} },
|
||||
{ MODKEY, XK_r, incnmaster, {.i = +1} },
|
||||
{ MODKEY | ShiftMask, XK_r, incnmaster, {.i = -1} },
|
||||
// { MODKEY, XK_t, spawn, {.v = (const char *[]){NULL}} },
|
||||
// { MODKEY | ShiftMask, XK_t, spawn, {.v = (const char *[]){NULL}} },
|
||||
// { MODKEY, XK_z, spawn, {.v = (const char *[]){NULL}} },
|
||||
// { MODKEY | ShiftMask, XK_z, spawn, {.v = (const char *[]){NULL}} },
|
||||
{ MODKEY | ShiftMask, XK_r, resetnmaster, {0} },
|
||||
{ MODKEY, XK_l, setmfact, {.f = +0.05} },
|
||||
// { MODKEY | ShiftMask, XK_l, spawn, {.v = (const char *[]){NULL}} },
|
||||
// { MODKEY, XK_slash, spawn, {.v = (const char *[]){NULL}} },
|
||||
// { MODKEY | ShiftMask, XK_slash, spawn, {.v = (const char *[]){NULL}} },
|
||||
// { MODKEY, XK_equal, spawn, {.v = (const char *[]){NULL}} },
|
||||
// { MODKEY | ShiftMask, XK_equal, spawn, {.v = (const char *[]){NULL}} },
|
||||
// { MODKEY, XK_a, spawn, {.v = (const char *[]){NULL}} },
|
||||
// { MODKEY | ShiftMask, XK_a, spawn, {.v = (const char *[]){NULL}} },
|
||||
{ MODKEY, XK_o, togglescratch, {.v = sphtop} },
|
||||
{ MODKEY | ShiftMask, XK_o, spawn, {.v = (const char *[]){TERMINAL, "-e", "htop", NULL}} },
|
||||
{ MODKEY, XK_e, togglescratch, {.v = splf} },
|
||||
{ MODKEY | ShiftMask, XK_e, spawn, {.v = (const char *[]){TERMINAL, "-d", "~", "-e", "lf", NULL}} },
|
||||
{ MODKEY, XK_u, spawn, {.v = (const char *[]){BROWSER, NULL}} },
|
||||
{ MODKEY | ShiftMask, XK_u, spawn, {.v = (const char *[]){TERMINAL, "-e", "sudo", "nmtui", NULL}} },
|
||||
// { MODKEY, XK_i, spawn, {.v = (const char *[]){NULL}} },
|
||||
// { MODKEY | ShiftMask, XK_i, spawn, {.v = (const char *[]){NULL}} },
|
||||
{ MODKEY, XK_o, togglescratch, {.v = sphtop} },
|
||||
{ MODKEY | ShiftMask, XK_o, spawn, {.v = (const char *[]){TERMINAL, "-e", "htop", NULL}} },
|
||||
// { MODKEY, XK_p, spawn, {.v = (const char *[]){NULL}} },
|
||||
// { MODKEY | ShiftMask, XK_p, spawn, {.v = (const char *[]){NULL}} },
|
||||
// { MODKEY, XK_udiaeresis, spawn, {.v = (const char *[]){NULL}} },
|
||||
// { MODKEY | ShiftMask, XK_udiaeresis, spawn, {.v = (const char *[]){NULL}} },
|
||||
// { MODKEY, XK_plus, spawn, {.v = (const char *[]){NULL}} },
|
||||
// { MODKEY | ShiftMask, XK_plus, spawn, {.v = (const char *[]){NULL}} },
|
||||
{ MODKEY, XK_a, togglegaps, {0} },
|
||||
{ MODKEY | ShiftMask, XK_a, defaultgaps, {0} },
|
||||
// { MODKEY, XK_s, spawn, {.v = (const char *[]){NULL}} },
|
||||
// { MODKEY | ShiftMask, XK_s, spawn, {.v = (const char *[]){NULL}} },
|
||||
{ MODKEY, XK_d, spawn, {.v = (const char *[]){"dmenu_run", NULL}} },
|
||||
{ MODKEY | ShiftMask, XK_d, spawn, {.v = (const char *[]){NULL}} },
|
||||
{ MODKEY, XK_f, togglefullscr, {0} },
|
||||
// { MODKEY | ShiftMask, XK_f, setlayout, {.v = (const char *[]){NULL}} },
|
||||
// { MODKEY, XK_g, spawn, {.v = (const char *[]){NULL}} },
|
||||
// { MODKEY | ShiftMask, XK_g, spawn, {.v = (const char *[]){NULL}} },
|
||||
// { MODKEY, XK_d, spawn, {.v = (const char *[]){NULL}} },
|
||||
// { MODKEY | ShiftMask, XK_d, spawn, {.v = (const char *[]){NULL}} },
|
||||
{ MODKEY, XK_h, setmfact, {.f = -0.05} },
|
||||
// { MODKEY | ShiftMask, XK_h, spawn, {.v = (const char *[]){NULL}} },
|
||||
/* XK_j and XK_k are bound in STACKKEYS */
|
||||
{ MODKEY, XK_l, setmfact, {.f = +0.05} },
|
||||
// { MODKEY | ShiftMask, XK_l, spawn, {.v = (const char *[]){NULL}} },
|
||||
// { MODKEY, XK_odiaeresis, spawn, {.v = (const char *[]){NULL}} },
|
||||
// { MODKEY | ShiftMask, XK_odiaeresis, spawn, {.v = (const char *[]){NULL}} },
|
||||
// { MODKEY, XK_adiaeresis, spawn, {.v = (const char *[]){NULL}} },
|
||||
// { MODKEY | ShiftMask, XK_adiaeresis, spawn, {.v = (const char *[]){NULL}} },
|
||||
{ MODKEY, XK_numbersign, togglescratch, {.v = spqalc} },
|
||||
// { MODKEY | ShiftMask, XK_numbersign, spawn, {.v = (const char *[]){NULL}} },
|
||||
{ MODKEY, XK_t, spawn, {.v = (const char *[]){"dmenu_run", NULL}} },
|
||||
{ MODKEY | ShiftMask, XK_t, spawn, {.v = (const char *[]){NULL}} },
|
||||
{ MODKEY, XK_n, setlayout, {.v = &layouts[0]} },
|
||||
{ MODKEY | ShiftMask, XK_n, setlayout, {.v = &layouts[1]} },
|
||||
{ MODKEY, XK_s, setlayout, {.v = &layouts[2]} },
|
||||
{ MODKEY | ShiftMask, XK_s, setlayout, {.v = &layouts[3]} },
|
||||
{ MODKEY, XK_minus, setlayout, {.v = &layouts[4]} },
|
||||
{ MODKEY | ShiftMask, XK_minus, setlayout, {.v = &layouts[5]} },
|
||||
{ MODKEY, XK_backslash, togglescratch, {.v = spqalc} },
|
||||
// { MODKEY | ShiftMask, XK_backslash, spawn, {.v = (const char *[]){NULL}} },
|
||||
{ MODKEY, XK_Return, spawn, {.v = (const char *[]){TERMINAL, "-d", "~", NULL}} },
|
||||
{ MODKEY | ShiftMask, XK_Return, spawn, {.v = (const char *[]){"samedir", NULL}} },
|
||||
// { MODKEY, XK_y, spawn, {.v = (const char *[]){NULL}} },
|
||||
// { MODKEY | ShiftMask, XK_y, spawn, {.v = (const char *[]){NULL}} },
|
||||
// { MODKEY, XK_semicolon, spawn, {.v = (const char *[]){NULL}} },
|
||||
// { MODKEY | ShiftMask, XK_semicolon, spawn, {.v = (const char *[]){NULL}} },
|
||||
// { MODKEY, XK_q, spawn, {.v = (const char *[]){NULL}} },
|
||||
// { MODKEY | ShiftMask, XK_q, spawn, {.v = (const char *[]){NULL}} },
|
||||
{ MODKEY, XK_j, focusstack, {.i = INC(+1)} },
|
||||
{ MODKEY | ShiftMask, XK_j, pushstack, {.i = INC(+1)} },
|
||||
{ MODKEY, XK_k, focusstack, {.i = INC(-1)} },
|
||||
{ MODKEY | ShiftMask, XK_k, pushstack, {.i = INC(-1)} },
|
||||
// { MODKEY, XK_x, spawn, {.v = (const char *[]){NULL}} },
|
||||
// { MODKEY | ShiftMask, XK_x, spawn, {.v = (const char *[]){NULL}} },
|
||||
// { MODKEY, XK_c, spawn, {.v = (const char *[]){NULL}} },
|
||||
// { MODKEY | ShiftMask, XK_c, spawn, {.v = (const char *[]){NULL}} },
|
||||
/* XK_v is bound in STACKKEYS */
|
||||
{ MODKEY, XK_b, togglebar, {0} },
|
||||
// { MODKEY | ShiftMask, XK_b, spawn, {.v = (const char *[]){NULL}} },
|
||||
{ MODKEY, XK_n, spawn, {.v = (const char *[]){TERMINAL, "-e", "nvim", "-c", "VimwikiIndex", NULL}} },
|
||||
// { MODKEY | ShiftMask, XK_n, spawn, {.v = (const char *[]){NULL}} },
|
||||
// { MODKEY, XK_m, spawn, {.v = (const char *[]){NULL}} },
|
||||
{ MODKEY, XK_m, spawn, {.v = (const char *[]){BROWSER, "listen.tidal.de", NULL }} },
|
||||
{ MODKEY | ShiftMask, XK_m, spawn, SHCMD("pamixer -t; kill -44 $(pidof dwmblocks)") },
|
||||
{ MODKEY, XK_comma, spawn, {.v = (const char *[]){"playerctl", "-p", PLAYER, "previous", NULL}} },
|
||||
{ MODKEY | ShiftMask, XK_comma, spawn, {.v = (const char *[]){"playerctl", "-p", PLAYER, "position", "0", NULL}} },
|
||||
{ MODKEY, XK_period, spawn, {.v = (const char *[]){"playerctl", "-p", PLAYER, "previous", NULL}} },
|
||||
// { MODKEY | ShiftMask, XK_period, spawn, {.v = (const char *[]){NULL}} },
|
||||
// { MODKEY, XK_minus, spawn, {.v = (const char *[]){NULL}} },
|
||||
// { MODKEY | ShiftMask, XK_minus, spawn, {.v = (const char *[]){NULL}} },
|
||||
{ MODKEY, XK_w, spawn, {.v = (const char *[]){"ferdium", NULL}} },
|
||||
// { MODKEY | ShiftMask, XK_w, spawn, {.v = (const char *[]){NULL}} },
|
||||
{ MODKEY, XK_v, focusstack, {.i = PREVSEL} },
|
||||
{ MODKEY | ShiftMask, XK_v, pushstack, {.i = PREVSEL} },
|
||||
// { MODKEY, XK_z, spawn, {.v = (const char *[]){NULL}} },
|
||||
// { MODKEY | ShiftMask, XK_z, spawn, {.v = (const char *[]){NULL}} },
|
||||
{ MODKEY, XK_space, zoom, {0} },
|
||||
{ MODKEY | ShiftMask, XK_space, togglefloating, {0} },
|
||||
{ 0, XK_Print, spawn, SHCMD("maim ~/Photos/Screenshots/pic-full-$(date '+%y%m%d-%H%M-%S').png") },
|
||||
|
@ -244,33 +270,33 @@ static const Key keys[] = {
|
|||
// { MODKEY | ShiftMask, XK_Insert, spawn, {.v = (const char *[]){NULL}} },
|
||||
// { MODKEY, XK_Home, spawn, {.v = (const char *[]){NULL}} },
|
||||
// { MODKEY | ShiftMask, XK_Home, spawn, {.v = (const char *[]){NULL}} },
|
||||
// { MODKEY, XK_Page_Up, spawn, {.v = (const char *[]){NULL}} },
|
||||
// { MODKEY | ShiftMask, XK_Page_Up, spawn, {.v = (const char *[]){NULL}} },
|
||||
{ MODKEY, XK_Delete, spawn, {.v = (const char *[]){"dmenurecord", "kill", NULL}} },
|
||||
// { MODKEY | ShiftMask, XK_Delete, spawn, {.v = (const char *[]){NULL}} },
|
||||
// { MODKEY, XK_End, spawn, {.v = (const char *[]){NULL}} },
|
||||
{ MODKEY | ShiftMask, XK_End, quit, {0} },
|
||||
// { MODKEY, XK_Page_Up, spawn, {.v = (const char *[]){NULL}} },
|
||||
// { MODKEY | ShiftMask, XK_Page_Up, spawn, {.v = (const char *[]){NULL}} },
|
||||
// { MODKEY, XK_Page_Down, spawn, {.v = (const char *[]){NULL}} },
|
||||
// { MODKEY | ShiftMask, XK_Page_Down, spawn, {.v = (const char *[]){NULL}} },
|
||||
{ MODKEY, XK_Left, focusmon, {.i = -1} },
|
||||
{ MODKEY | ShiftMask, XK_Left, tagmon, {.i = -1} },
|
||||
{ MODKEY, XK_Right, focusmon, {.i = +1} },
|
||||
{ MODKEY | ShiftMask, XK_Right, tagmon, {.i = +1} },
|
||||
// { MODKEY, XK_Up, spawn, {.v = (const char *[]){NULL}} },
|
||||
// { MODKEY | ShiftMask, XK_Up, spawn, {.v = (const char *[]){NULL}} },
|
||||
// { MODKEY, XK_Down, spawn, {.v = (const char *[]){NULL}} },
|
||||
// { MODKEY | ShiftMask, XK_Down, spawn, {.v = (const char *[]){NULL}} },
|
||||
{ MODKEY, XK_Left, spawn, {.v = (const char *[]){"playerctl", "-p", PLAYERCTL, "previous", NULL}} },
|
||||
{ MODKEY | ShiftMask, XK_Left, spawn, {.v = (const char *[]){"playerctl", "-p", PLAYERCTL, "position", "0", NULL}} },
|
||||
{ MODKEY, XK_Right, spawn, {.v = (const char *[]){"playerctl", "-p", PLAYERCTL, "next", NULL}} },
|
||||
// { MODKEY | ShiftMask, XK_Right, spawn, {.v = (const char *[]){NULL}} },
|
||||
{ MODKEY, XK_Up, spawn, SHCMD("pamixer --allow-boost -i 5; pkill -RTMIN+10 dwmblocks") },
|
||||
{ MODKEY | ShiftMask, XK_Up, spawn, SHCMD("pamixer --allow-boost -i 20; pkill -RTMIN+10 dwmblocks") },
|
||||
{ MODKEY, XK_Down, spawn, SHCMD("pamixer --allow-boost -d 5; pkill -RTMIN+10 dwmblocks") },
|
||||
{ MODKEY | ShiftMask, XK_Down, spawn, SHCMD("pamixer --allow-boost -d 20; pkill -RTMIN+10 dwmblocks") },
|
||||
|
||||
{ 0, XF86XK_AudioMute, spawn, SHCMD("pamixer -t; pkill -RTMIN+10 dwmblocks") },
|
||||
{ 0, XF86XK_AudioRaiseVolume, spawn, SHCMD("pamixer --allow-boost -i 5; pkill -RTMIN+10 dwmblocks") },
|
||||
{ 0, XF86XK_AudioLowerVolume, spawn, SHCMD("pamixer --allow-boost -d 5; pkill -RTMIN+10 dwmblocks") },
|
||||
{ 0, XF86XK_AudioPrev, spawn, {.v = (const char *[]){"playerctl", "-p", PLAYER, "previous", NULL}} },
|
||||
{ 0, XF86XK_AudioNext, spawn, {.v = (const char *[]){"playerctl", "-p", PLAYER, "next", NULL}} },
|
||||
{ 0, XF86XK_AudioPause, spawn, {.v = (const char *[]){"playerctl", "-p", PLAYER, "pause", NULL}} },
|
||||
{ 0, XF86XK_AudioPlay, spawn, {.v = (const char *[]){"playerctl", "-p", PLAYER, "play", NULL}} },
|
||||
{ 0, XF86XK_AudioStop, spawn, {.v = (const char *[]){"playerctl", "-p", PLAYER, "stop", NULL}} },
|
||||
{ 0, XF86XK_AudioRewind, spawn, {.v = (const char *[]){"playerctl", "-p", PLAYER, "position", "10-", NULL}} },
|
||||
{ 0, XF86XK_AudioForward, spawn, {.v = (const char *[]){"playerctl", "-p", PLAYER, "position", "10+", NULL}} },
|
||||
{ 0, XF86XK_AudioPrev, spawn, {.v = (const char *[]){"playerctl", "-p", PLAYERCTL, "previous", NULL}} },
|
||||
{ 0, XF86XK_AudioNext, spawn, {.v = (const char *[]){"playerctl", "-p", PLAYERCTL, "next", NULL}} },
|
||||
{ 0, XF86XK_AudioPause, spawn, {.v = (const char *[]){"playerctl", "-p", PLAYERCTL, "pause", NULL}} },
|
||||
{ 0, XF86XK_AudioPlay, spawn, {.v = (const char *[]){"playerctl", "-p", PLAYERCTL, "play", NULL}} },
|
||||
{ 0, XF86XK_AudioStop, spawn, {.v = (const char *[]){"playerctl", "-p", PLAYERCTL, "stop", NULL}} },
|
||||
{ 0, XF86XK_AudioRewind, spawn, {.v = (const char *[]){"playerctl", "-p", PLAYERCTL, "position", "10-", NULL}} },
|
||||
{ 0, XF86XK_AudioForward, spawn, {.v = (const char *[]){"playerctl", "-p", PLAYERCTL, "position", "10+", NULL}} },
|
||||
// { 0, XF86XK_AudioMedia, spawn, {.v = (const char *[]){NULL}} },
|
||||
{ 0, XF86XK_AudioMicMute, spawn, SHCMD("pactl set-source-mute @DEFAULT_SOURCE@ toggle") },
|
||||
{ 0, XF86XK_PowerOff, spawn, {.v = (const char *[]){"sysact", NULL}} },
|
||||
|
|
117
drw.c
117
drw.c
|
@ -1,9 +1,9 @@
|
|||
/* See LICENSE file for copyright and license details. */
|
||||
#include <X11/Xft/Xft.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xft/Xft.h>
|
||||
|
||||
#include "drw.h"
|
||||
#include "util.h"
|
||||
|
@ -13,21 +13,17 @@
|
|||
|
||||
static const unsigned char utfbyte[UTF_SIZ + 1] = {0x80, 0, 0xC0, 0xE0, 0xF0};
|
||||
static const unsigned char utfmask[UTF_SIZ + 1] = {0xC0, 0x80, 0xE0, 0xF0, 0xF8};
|
||||
static const long utfmin[UTF_SIZ + 1] = { 0, 0, 0x80, 0x800, 0x10000};
|
||||
static const long utfmin[UTF_SIZ + 1] = {0, 0, 0x80, 0x800, 0x10000};
|
||||
static const long utfmax[UTF_SIZ + 1] = {0x10FFFF, 0x7F, 0x7FF, 0xFFFF, 0x10FFFF};
|
||||
|
||||
static long
|
||||
utf8decodebyte(const char c, size_t *i)
|
||||
{
|
||||
static long utf8decodebyte(const char c, size_t *i) {
|
||||
for (*i = 0; *i < (UTF_SIZ + 1); ++(*i))
|
||||
if (((unsigned char)c & utfmask[*i]) == utfbyte[*i])
|
||||
return (unsigned char)c & ~utfmask[*i];
|
||||
return 0;
|
||||
}
|
||||
|
||||
static size_t
|
||||
utf8validate(long *u, size_t i)
|
||||
{
|
||||
static size_t utf8validate(long *u, size_t i) {
|
||||
if (!BETWEEN(*u, utfmin[i], utfmax[i]) || BETWEEN(*u, 0xD800, 0xDFFF))
|
||||
*u = UTF_INVALID;
|
||||
for (i = 1; *u > utfmax[i]; ++i)
|
||||
|
@ -35,9 +31,7 @@ utf8validate(long *u, size_t i)
|
|||
return i;
|
||||
}
|
||||
|
||||
static size_t
|
||||
utf8decode(const char *c, long *u, size_t clen)
|
||||
{
|
||||
static size_t utf8decode(const char *c, long *u, size_t clen) {
|
||||
size_t i, j, len, type;
|
||||
long udecoded;
|
||||
|
||||
|
@ -60,9 +54,7 @@ utf8decode(const char *c, long *u, size_t clen)
|
|||
return len;
|
||||
}
|
||||
|
||||
Drw *
|
||||
drw_create(Display *dpy, int screen, Window root, unsigned int w, unsigned int h)
|
||||
{
|
||||
Drw *drw_create(Display *dpy, int screen, Window root, unsigned int w, unsigned int h) {
|
||||
Drw *drw = ecalloc(1, sizeof(Drw));
|
||||
|
||||
drw->dpy = dpy;
|
||||
|
@ -77,9 +69,7 @@ drw_create(Display *dpy, int screen, Window root, unsigned int w, unsigned int h
|
|||
return drw;
|
||||
}
|
||||
|
||||
void
|
||||
drw_resize(Drw *drw, unsigned int w, unsigned int h)
|
||||
{
|
||||
void drw_resize(Drw *drw, unsigned int w, unsigned int h) {
|
||||
if (!drw)
|
||||
return;
|
||||
|
||||
|
@ -90,9 +80,7 @@ drw_resize(Drw *drw, unsigned int w, unsigned int h)
|
|||
drw->drawable = XCreatePixmap(drw->dpy, drw->root, w, h, DefaultDepth(drw->dpy, drw->screen));
|
||||
}
|
||||
|
||||
void
|
||||
drw_free(Drw *drw)
|
||||
{
|
||||
void drw_free(Drw *drw) {
|
||||
XFreePixmap(drw->dpy, drw->drawable);
|
||||
XFreeGC(drw->dpy, drw->gc);
|
||||
drw_fontset_free(drw->fonts);
|
||||
|
@ -102,9 +90,7 @@ drw_free(Drw *drw)
|
|||
/* This function is an implementation detail. Library users should use
|
||||
* drw_fontset_create instead.
|
||||
*/
|
||||
static Fnt *
|
||||
xfont_create(Drw *drw, const char *fontname, FcPattern *fontpattern)
|
||||
{
|
||||
static Fnt *xfont_create(Drw *drw, const char *fontname, FcPattern *fontpattern) {
|
||||
Fnt *font;
|
||||
XftFont *xfont = NULL;
|
||||
FcPattern *pattern = NULL;
|
||||
|
@ -119,7 +105,7 @@ xfont_create(Drw *drw, const char *fontname, FcPattern *fontpattern)
|
|||
fprintf(stderr, "error, cannot load font from name: '%s'\n", fontname);
|
||||
return NULL;
|
||||
}
|
||||
if (!(pattern = FcNameParse((FcChar8 *) fontname))) {
|
||||
if (!(pattern = FcNameParse((FcChar8 *)fontname))) {
|
||||
fprintf(stderr, "error, cannot parse font name to pattern: '%s'\n", fontname);
|
||||
XftFontClose(drw->dpy, xfont);
|
||||
return NULL;
|
||||
|
@ -142,9 +128,7 @@ xfont_create(Drw *drw, const char *fontname, FcPattern *fontpattern)
|
|||
return font;
|
||||
}
|
||||
|
||||
static void
|
||||
xfont_free(Fnt *font)
|
||||
{
|
||||
static void xfont_free(Fnt *font) {
|
||||
if (!font)
|
||||
return;
|
||||
if (font->pattern)
|
||||
|
@ -153,9 +137,7 @@ xfont_free(Fnt *font)
|
|||
free(font);
|
||||
}
|
||||
|
||||
Fnt*
|
||||
drw_fontset_create(Drw* drw, const char *fonts[], size_t fontcount)
|
||||
{
|
||||
Fnt *drw_fontset_create(Drw *drw, const char *fonts[], size_t fontcount) {
|
||||
Fnt *cur, *ret = NULL;
|
||||
size_t i;
|
||||
|
||||
|
@ -171,32 +153,27 @@ drw_fontset_create(Drw* drw, const char *fonts[], size_t fontcount)
|
|||
return (drw->fonts = ret);
|
||||
}
|
||||
|
||||
void
|
||||
drw_fontset_free(Fnt *font)
|
||||
{
|
||||
void drw_fontset_free(Fnt *font) {
|
||||
if (font) {
|
||||
drw_fontset_free(font->next);
|
||||
xfont_free(font);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
drw_clr_create(Drw *drw, Clr *dest, const char *clrname)
|
||||
{
|
||||
void drw_clr_create(Drw *drw, Clr *dest, const char *clrname) {
|
||||
if (!drw || !dest || !clrname)
|
||||
return;
|
||||
|
||||
if (!XftColorAllocName(drw->dpy, DefaultVisual(drw->dpy, drw->screen),
|
||||
DefaultColormap(drw->dpy, drw->screen),
|
||||
clrname, dest))
|
||||
DefaultColormap(drw->dpy, drw->screen), clrname, dest))
|
||||
die("error, cannot allocate color '%s'", clrname);
|
||||
|
||||
dest->pixel |= 0xff << 24;
|
||||
}
|
||||
|
||||
/* Wrapper to create color schemes. The caller has to call free(3) on the
|
||||
* returned color scheme when done using it. */
|
||||
Clr *
|
||||
drw_scm_create(Drw *drw, char *clrnames[], size_t clrcount)
|
||||
{
|
||||
Clr *drw_scm_create(Drw *drw, char *clrnames[], size_t clrcount) {
|
||||
size_t i;
|
||||
Clr *ret;
|
||||
|
||||
|
@ -209,23 +186,17 @@ drw_scm_create(Drw *drw, char *clrnames[], size_t clrcount)
|
|||
return ret;
|
||||
}
|
||||
|
||||
void
|
||||
drw_setfontset(Drw *drw, Fnt *set)
|
||||
{
|
||||
void drw_setfontset(Drw *drw, Fnt *set) {
|
||||
if (drw)
|
||||
drw->fonts = set;
|
||||
}
|
||||
|
||||
void
|
||||
drw_setscheme(Drw *drw, Clr *scm)
|
||||
{
|
||||
void drw_setscheme(Drw *drw, Clr *scm) {
|
||||
if (drw)
|
||||
drw->scheme = scm;
|
||||
}
|
||||
|
||||
void
|
||||
drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled, int invert)
|
||||
{
|
||||
void drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled, int invert) {
|
||||
if (!drw || !drw->scheme)
|
||||
return;
|
||||
XSetForeground(drw->dpy, drw->gc, invert ? drw->scheme[ColBg].pixel : drw->scheme[ColFg].pixel);
|
||||
|
@ -235,9 +206,8 @@ drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled, int
|
|||
XDrawRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w - 1, h - 1);
|
||||
}
|
||||
|
||||
int
|
||||
drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lpad, const char *text, int invert)
|
||||
{
|
||||
int drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lpad,
|
||||
const char *text, int invert) {
|
||||
int i, ty, ellipsis_x = 0;
|
||||
unsigned int tmpw, ew, ellipsis_w = 0, ellipsis_len;
|
||||
XftDraw *d = NULL;
|
||||
|
@ -252,7 +222,10 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp
|
|||
int charexists = 0, overflow = 0;
|
||||
/* keep track of a couple codepoints for which we have no match. */
|
||||
enum { nomatches_len = 64 };
|
||||
static struct { long codepoint[nomatches_len]; unsigned int idx; } nomatches;
|
||||
static struct {
|
||||
long codepoint[nomatches_len];
|
||||
unsigned int idx;
|
||||
} nomatches;
|
||||
static unsigned int ellipsis_width = 0;
|
||||
|
||||
if (!drw || (render && (!drw->scheme || !w)) || !text || !drw->fonts)
|
||||
|
@ -263,8 +236,7 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp
|
|||
} else {
|
||||
XSetForeground(drw->dpy, drw->gc, drw->scheme[invert ? ColFg : ColBg].pixel);
|
||||
XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w, h);
|
||||
d = XftDrawCreate(drw->dpy, drw->drawable,
|
||||
DefaultVisual(drw->dpy, drw->screen),
|
||||
d = XftDrawCreate(drw->dpy, drw->drawable, DefaultVisual(drw->dpy, drw->screen),
|
||||
DefaultColormap(drw->dpy, drw->screen));
|
||||
x += lpad;
|
||||
w -= lpad;
|
||||
|
@ -319,8 +291,8 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp
|
|||
if (utf8strlen) {
|
||||
if (render) {
|
||||
ty = y + (h - usedfont->h) / 2 + usedfont->xfont->ascent;
|
||||
XftDrawStringUtf8(d, &drw->scheme[invert ? ColBg : ColFg],
|
||||
usedfont->xfont, x, ty, (XftChar8 *)utf8str, utf8strlen);
|
||||
XftDrawStringUtf8(d, &drw->scheme[invert ? ColBg : ColFg], usedfont->xfont, x, ty,
|
||||
(XftChar8 *)utf8str, utf8strlen);
|
||||
}
|
||||
x += ew;
|
||||
w -= ew;
|
||||
|
@ -372,7 +344,7 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp
|
|||
} else {
|
||||
xfont_free(usedfont);
|
||||
nomatches.codepoint[++nomatches.idx % nomatches_len] = utf8codepoint;
|
||||
no_match:
|
||||
no_match:
|
||||
usedfont = drw->fonts;
|
||||
}
|
||||
}
|
||||
|
@ -384,9 +356,7 @@ no_match:
|
|||
return x + (render ? w : 0);
|
||||
}
|
||||
|
||||
void
|
||||
drw_map(Drw *drw, Window win, int x, int y, unsigned int w, unsigned int h)
|
||||
{
|
||||
void drw_map(Drw *drw, Window win, int x, int y, unsigned int w, unsigned int h) {
|
||||
if (!drw)
|
||||
return;
|
||||
|
||||
|
@ -394,26 +364,21 @@ drw_map(Drw *drw, Window win, int x, int y, unsigned int w, unsigned int h)
|
|||
XSync(drw->dpy, False);
|
||||
}
|
||||
|
||||
unsigned int
|
||||
drw_fontset_getwidth(Drw *drw, const char *text)
|
||||
{
|
||||
unsigned int drw_fontset_getwidth(Drw *drw, const char *text) {
|
||||
if (!drw || !drw->fonts || !text)
|
||||
return 0;
|
||||
return drw_text(drw, 0, 0, 0, 0, 0, text, 0);
|
||||
}
|
||||
|
||||
unsigned int
|
||||
drw_fontset_getwidth_clamp(Drw *drw, const char *text, unsigned int n)
|
||||
{
|
||||
unsigned int drw_fontset_getwidth_clamp(Drw *drw, const char *text, unsigned int n) {
|
||||
unsigned int tmp = 0;
|
||||
if (drw && drw->fonts && text && n)
|
||||
tmp = drw_text(drw, 0, 0, 0, 0, 0, text, n);
|
||||
return MIN(n, tmp);
|
||||
}
|
||||
|
||||
void
|
||||
drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned int *w, unsigned int *h)
|
||||
{
|
||||
void drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned int *w,
|
||||
unsigned int *h) {
|
||||
XGlyphInfo ext;
|
||||
|
||||
if (!font || !text)
|
||||
|
@ -426,9 +391,7 @@ drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned int *w,
|
|||
*h = font->h;
|
||||
}
|
||||
|
||||
Cur *
|
||||
drw_cur_create(Drw *drw, int shape)
|
||||
{
|
||||
Cur *drw_cur_create(Drw *drw, int shape) {
|
||||
Cur *cur;
|
||||
|
||||
if (!drw || !(cur = ecalloc(1, sizeof(Cur))))
|
||||
|
@ -439,9 +402,7 @@ drw_cur_create(Drw *drw, int shape)
|
|||
return cur;
|
||||
}
|
||||
|
||||
void
|
||||
drw_cur_free(Drw *drw, Cur *cursor)
|
||||
{
|
||||
void drw_cur_free(Drw *drw, Cur *cursor) {
|
||||
if (!cursor)
|
||||
return;
|
||||
|
||||
|
|
108
dwm.c
108
dwm.c
|
@ -174,6 +174,7 @@ typedef struct {
|
|||
void (*arrange)(Monitor *);
|
||||
} Layout;
|
||||
|
||||
typedef struct Pertag Pertag;
|
||||
struct Monitor {
|
||||
char ltsymbol[16];
|
||||
float mfact;
|
||||
|
@ -193,6 +194,7 @@ struct Monitor {
|
|||
Monitor *next;
|
||||
Window barwin;
|
||||
const Layout *lt[2];
|
||||
Pertag *pertag;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
|
@ -281,6 +283,7 @@ static void pushstack(const Arg *arg);
|
|||
static void quit(const Arg *arg);
|
||||
static Monitor *recttomon(int x, int y, int w, int h);
|
||||
static void removesystrayicon(Client *i);
|
||||
static void resetnmaster(const Arg *arg);
|
||||
static void resize(Client *c, int x, int y, int w, int h, int interact);
|
||||
static void resizebarwin(Monitor *m);
|
||||
static void resizeclient(Client *c, int x, int y, int w, int h);
|
||||
|
@ -388,6 +391,20 @@ static xcb_connection_t *xcon;
|
|||
/* configuration, allows nested code to access above variables */
|
||||
#include "config.h"
|
||||
|
||||
struct Pertag {
|
||||
unsigned int curtag, prevtag; /* current and previous tag */
|
||||
int nmasters[LENGTH(tags) + 1]; /* number of windows in master area */
|
||||
float mfacts[LENGTH(tags) + 1]; /* mfacts per tag */
|
||||
unsigned int sellts[LENGTH(tags) + 1]; /* selected layouts */
|
||||
const Layout *ltidxs[LENGTH(tags) + 1][2]; /* matrix of tags and layouts indexes */
|
||||
int showbars[LENGTH(tags) + 1]; /* display bar for the current tag */
|
||||
};
|
||||
|
||||
static char *colors[] = {
|
||||
color0, color1, color2, color3, color4, color5, color6, color7,
|
||||
color8, color9, color10, color11, color12, color13, color14, color15,
|
||||
};
|
||||
|
||||
/* compile-time check if all tags fit into an unsigned int bit array. */
|
||||
struct NumTags {
|
||||
char limitexceeded[LENGTH(tags) > 31 ? -1 : 1];
|
||||
|
@ -1063,6 +1080,7 @@ void configurerequest(XEvent *e) {
|
|||
|
||||
Monitor *createmon(void) {
|
||||
Monitor *m;
|
||||
unsigned int i;
|
||||
|
||||
m = ecalloc(1, sizeof(Monitor));
|
||||
m->tagset[0] = m->tagset[1] = 1;
|
||||
|
@ -1073,6 +1091,20 @@ Monitor *createmon(void) {
|
|||
m->lt[0] = &layouts[0];
|
||||
m->lt[1] = &layouts[1 % LENGTH(layouts)];
|
||||
strncpy(m->ltsymbol, layouts[0].symbol, sizeof m->ltsymbol);
|
||||
m->pertag = ecalloc(1, sizeof(Pertag));
|
||||
m->pertag->curtag = m->pertag->prevtag = 1;
|
||||
|
||||
for (i = 0; i <= LENGTH(tags); i++) {
|
||||
m->pertag->nmasters[i] = m->nmaster;
|
||||
m->pertag->mfacts[i] = m->mfact;
|
||||
|
||||
m->pertag->ltidxs[i][0] = m->lt[0];
|
||||
m->pertag->ltidxs[i][1] = m->lt[1];
|
||||
m->pertag->sellts[i] = m->sellt;
|
||||
|
||||
m->pertag->showbars[i] = m->showbar;
|
||||
}
|
||||
|
||||
return m;
|
||||
}
|
||||
|
||||
|
@ -1600,7 +1632,8 @@ void grabkeys(void) {
|
|||
}
|
||||
|
||||
void incnmaster(const Arg *arg) {
|
||||
selmon->nmaster = MAX(selmon->nmaster + arg->i, 0);
|
||||
selmon->nmaster = selmon->pertag->nmasters[selmon->pertag->curtag] =
|
||||
MAX(selmon->nmaster + arg->i, 0);
|
||||
arrange(selmon);
|
||||
}
|
||||
|
||||
|
@ -1928,6 +1961,11 @@ void removesystrayicon(Client *i) {
|
|||
free(i);
|
||||
}
|
||||
|
||||
void resetnmaster(const Arg *arg) {
|
||||
selmon->nmaster = selmon->pertag->nmasters[selmon->pertag->curtag] = 1;
|
||||
arrange(selmon);
|
||||
}
|
||||
|
||||
void resize(Client *c, int x, int y, int w, int h, int interact) {
|
||||
if (applysizehints(c, &x, &y, &w, &h, interact))
|
||||
resizeclient(c, x, y, w, h);
|
||||
|
@ -2190,9 +2228,10 @@ void setfullscreen(Client *c, int fullscreen) {
|
|||
|
||||
void setlayout(const Arg *arg) {
|
||||
if (!arg || !arg->v || arg->v != selmon->lt[selmon->sellt])
|
||||
selmon->sellt ^= 1;
|
||||
selmon->sellt = selmon->pertag->sellts[selmon->pertag->curtag] ^= 1;
|
||||
if (arg && arg->v)
|
||||
selmon->lt[selmon->sellt] = (Layout *)arg->v;
|
||||
selmon->lt[selmon->sellt] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt] =
|
||||
(Layout *)arg->v;
|
||||
strncpy(selmon->ltsymbol, selmon->lt[selmon->sellt]->symbol, sizeof selmon->ltsymbol);
|
||||
if (selmon->sel)
|
||||
arrange(selmon);
|
||||
|
@ -2209,7 +2248,7 @@ void setmfact(const Arg *arg) {
|
|||
f = arg->f < 1.0 ? arg->f + selmon->mfact : arg->f - 1.0;
|
||||
if (f < 0.05 || f > 0.95)
|
||||
return;
|
||||
selmon->mfact = f;
|
||||
selmon->mfact = selmon->pertag->mfacts[selmon->pertag->curtag] = f;
|
||||
arrange(selmon);
|
||||
}
|
||||
|
||||
|
@ -2276,6 +2315,7 @@ void setup(void) {
|
|||
scheme[i] = drw_scm_create(drw, barschemes[i], 3);
|
||||
|
||||
barclrs = ecalloc(LENGTH(colors), sizeof(Clr));
|
||||
|
||||
for (i = 0; i < LENGTH(colors); i++)
|
||||
drw_clr_create(drw, &barclrs[i], colors[i]);
|
||||
|
||||
|
@ -2345,8 +2385,6 @@ void sigterm(int unused) {
|
|||
}
|
||||
|
||||
void spawn(const Arg *arg) {
|
||||
if (arg->v == dmenucmd)
|
||||
dmenumon[0] = '0' + selmon->num;
|
||||
if (fork() == 0) {
|
||||
if (dpy)
|
||||
close(ConnectionNumber(dpy));
|
||||
|
@ -2441,7 +2479,7 @@ void tile(Monitor *m) {
|
|||
}
|
||||
|
||||
void togglebar(const Arg *arg) {
|
||||
selmon->showbar = !selmon->showbar;
|
||||
selmon->showbar = selmon->pertag->showbars[selmon->pertag->curtag] = !selmon->showbar;
|
||||
updatebarpos(selmon);
|
||||
resizebarwin(selmon);
|
||||
if (showsystray) {
|
||||
|
@ -2510,9 +2548,35 @@ void toggletag(const Arg *arg) {
|
|||
|
||||
void toggleview(const Arg *arg) {
|
||||
unsigned int newtagset = selmon->tagset[selmon->seltags] ^ (arg->ui & TAGMASK);
|
||||
int i;
|
||||
|
||||
if (newtagset) {
|
||||
selmon->tagset[selmon->seltags] = newtagset;
|
||||
|
||||
if (newtagset == ~0) {
|
||||
selmon->pertag->prevtag = selmon->pertag->curtag;
|
||||
selmon->pertag->curtag = 0;
|
||||
}
|
||||
|
||||
/* test if the user did not select the same tag */
|
||||
if (!(newtagset & 1 << (selmon->pertag->curtag - 1))) {
|
||||
selmon->pertag->prevtag = selmon->pertag->curtag;
|
||||
for (i = 0; !(newtagset & 1 << i); i++)
|
||||
;
|
||||
selmon->pertag->curtag = i + 1;
|
||||
}
|
||||
|
||||
/* apply settings for this view */
|
||||
selmon->nmaster = selmon->pertag->nmasters[selmon->pertag->curtag];
|
||||
selmon->mfact = selmon->pertag->mfacts[selmon->pertag->curtag];
|
||||
selmon->sellt = selmon->pertag->sellts[selmon->pertag->curtag];
|
||||
selmon->lt[selmon->sellt] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt];
|
||||
selmon->lt[selmon->sellt ^ 1] =
|
||||
selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt ^ 1];
|
||||
|
||||
if (selmon->showbar != selmon->pertag->showbars[selmon->pertag->curtag])
|
||||
togglebar(NULL);
|
||||
|
||||
focus(NULL);
|
||||
arrange(selmon);
|
||||
}
|
||||
|
@ -2924,11 +2988,39 @@ void updatewmhints(Client *c) {
|
|||
}
|
||||
|
||||
void view(const Arg *arg) {
|
||||
int i;
|
||||
unsigned int tmptag;
|
||||
|
||||
if ((arg->ui & TAGMASK) == selmon->tagset[selmon->seltags])
|
||||
return;
|
||||
selmon->seltags ^= 1; /* toggle sel tagset */
|
||||
if (arg->ui & TAGMASK)
|
||||
if (arg->ui & TAGMASK) {
|
||||
selmon->tagset[selmon->seltags] = arg->ui & TAGMASK;
|
||||
selmon->pertag->prevtag = selmon->pertag->curtag;
|
||||
|
||||
if (arg->ui == ~0)
|
||||
selmon->pertag->curtag = 0;
|
||||
else {
|
||||
for (i = 0; !(arg->ui & 1 << i); i++)
|
||||
;
|
||||
selmon->pertag->curtag = i + 1;
|
||||
}
|
||||
} else {
|
||||
tmptag = selmon->pertag->prevtag;
|
||||
selmon->pertag->prevtag = selmon->pertag->curtag;
|
||||
selmon->pertag->curtag = tmptag;
|
||||
}
|
||||
|
||||
selmon->nmaster = selmon->pertag->nmasters[selmon->pertag->curtag];
|
||||
selmon->mfact = selmon->pertag->mfacts[selmon->pertag->curtag];
|
||||
selmon->sellt = selmon->pertag->sellts[selmon->pertag->curtag];
|
||||
selmon->lt[selmon->sellt] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt];
|
||||
selmon->lt[selmon->sellt ^ 1] =
|
||||
selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt ^ 1];
|
||||
|
||||
if (selmon->showbar != selmon->pertag->showbars[selmon->pertag->curtag])
|
||||
togglebar(NULL);
|
||||
|
||||
focus(NULL);
|
||||
arrange(selmon);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
diff -r -u a/config.def.h b/config.def.h
|
||||
--- a/config.def.h 2022-01-07 06:42:18.000000000 -0500
|
||||
+++ b/config.def.h 2022-01-23 16:03:42.521951418 -0500
|
||||
@@ -69,6 +69,7 @@
|
||||
{ MODKEY, XK_k, focusstack, {.i = -1 } },
|
||||
{ MODKEY, XK_i, incnmaster, {.i = +1 } },
|
||||
{ MODKEY, XK_d, incnmaster, {.i = -1 } },
|
||||
+ { MODKEY, XK_o, resetnmaster, {0} },
|
||||
{ MODKEY, XK_h, setmfact, {.f = -0.05} },
|
||||
{ MODKEY, XK_l, setmfact, {.f = +0.05} },
|
||||
{ MODKEY, XK_Return, zoom, {0} },
|
||||
diff -r -u a/dwm.c b/dwm.c
|
||||
--- a/dwm.c 2022-01-23 16:06:01.221948285 -0500
|
||||
+++ b/dwm.c 2022-01-23 16:05:35.949948855 -0500
|
||||
@@ -191,6 +191,7 @@
|
||||
static void propertynotify(XEvent *e);
|
||||
static void quit(const Arg *arg);
|
||||
static Monitor *recttomon(int x, int y, int w, int h);
|
||||
+static void resetnmaster(const Arg *arg);
|
||||
static void resize(Client *c, int x, int y, int w, int h, int interact);
|
||||
static void resizeclient(Client *c, int x, int y, int w, int h);
|
||||
static void resizemouse(const Arg *arg);
|
||||
@@ -1296,6 +1297,13 @@
|
||||
}
|
||||
|
||||
void
|
||||
+resetnmaster(const Arg *arg)
|
||||
+{
|
||||
+ selmon->nmaster = selmon->pertag->nmasters[selmon->pertag->curtag] = 1;
|
||||
+ arrange(selmon);
|
||||
+}
|
||||
+
|
||||
+void
|
||||
resize(Client *c, int x, int y, int w, int h, int interact)
|
||||
{
|
||||
if (applysizehints(c, &x, &y, &w, &h, interact))
|
Loading…
Reference in New Issue