From 73604d17452d26dec414bb5c3d1226c352ddc4d9 Mon Sep 17 00:00:00 2001 From: Nakidai Date: Thu, 31 Oct 2024 16:38:24 +0300 Subject: [PATCH] Some refactor in config --- config.h | 69 ++++++++++++++++++++++++++++++++------------------------ 1 file changed, 39 insertions(+), 30 deletions(-) diff --git a/config.h b/config.h index e0ed975..0ebf762 100644 --- a/config.h +++ b/config.h @@ -1,10 +1,15 @@ /* See LICENSE file for copyright and license details. */ +#define TERMINAL "st" +#define EDITOR "nvim" +#define BROWSER "firefox" +#define SCRIPTS_PATH "/home/naki/dwmscripts/" + /* appearance */ static const unsigned int borderpx = 2; /* border pixel of windows */ static const unsigned int snap = 32; /* snap pixel */ -static const unsigned int cornerrad = 0; // 15 -static const unsigned int gappih = 5; // 23 +static const unsigned int cornerrad = 0; +static const unsigned int gappih = 5; static const unsigned int gappiv = 5; static const unsigned int gappoh = 5; static const unsigned int gappov = 5; @@ -22,7 +27,6 @@ static const char *colors[][3] = { [SchemeNorm] = { col_fg, col_bg, col_bg }, [SchemeSel] = { col_fg, col_actbg, col_actwin } }; -// [SchemeSel] = { col_gray4, col_blue, col_blue }, /* tagging */ @@ -35,7 +39,6 @@ static const Rule rules[] = { */ /* class instance title tags mask isfloating monitor */ { "Gimp", NULL, NULL, 0, 1, -1 }, - // { "Firefox", NULL, NULL, 1 << 8, 0, -1 }, }; /* layout(s) */ @@ -62,42 +65,48 @@ static const Layout layouts[] = { #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_cyan, "-sf", col_gray4, NULL }; +static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */ static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_bg, "-nf", col_fg, "-sb", col_actbg, "-sf", col_fg, NULL }; -static const char *termcmd[] = { "st", NULL }; -static const char *volupcmd[] = { "amixer", "-D", "pulse", "sset", "Master", "5%+", "unmute", NULL }; +static const char *termcmd[] = { TERMINAL, NULL }; +static const char *editorcmd[] = { TERMINAL, EDITOR, NULL }; + +static const char *volupcmd[] = { "amixer", "-D", "pulse", "sset", "Master", "5%+", "unmute", NULL }; static const char *voldowncmd[] = { "amixer", "-D", "pulse", "sset", "Master", "5%-", "unmute", NULL }; -static const char *firefoxcmd[] = { "firefox-bin", NULL }; + +static const char *browsercmd[] = { BROWSER, NULL }; static const char *discordcmd[] = { "discord", NULL }; -static const char *sublcmd[] = { "subl", NULL }; -static const char *scrotshcmd[] = { "/home/naki/dwmscripts/scrot.sh", NULL }; -static const char *scrotpycmd[] = { "python", "/home/naki/dwmscripts/scrot.py", NULL }; -static const char *layoutcmd[] = { "python", "/home/naki/dwmscripts/layout.py", NULL }; -static const char *convertcmd[] = { "/home/naki/dwmscripts/convert.sh", NULL }; -static const char *calccmd[] = { "/home/naki/dwmscripts/calc.sh", NULL }; +static const char *scrotshcmd[] = { SCRIPTS_PATH "/scrot.sh", NULL }; +static const char *scrotpycmd[] = { "python", SCRIPTS_PATH "/scrot.py", NULL }; +static const char *layoutcmd[] = { "python", SCRIPTS_PATH "/layout.py", NULL }; +static const char *convertcmd[] = { SCRIPTS_PATH "/convert.sh", NULL }; +static const char *calccmd[] = { SCRIPTS_PATH "/calc.sh", NULL }; static Key keys[] = { /* modifier key function argument */ - { MODKEY, XK_F5, spawn, SHCMD("setxkbmap us") }, - { MODKEY, XK_F6, spawn, SHCMD("setxkbmap ru") }, - { MODKEY, XK_space, spawn, {.v = layoutcmd } }, - { 0, XK_Print, spawn, {.v = scrotshcmd } }, - { MODKEY, XK_p, spawn, {.v = scrotshcmd } }, - { MODKEY, XK_s, spawn, {.v = firefoxcmd } }, - { MODKEY, 0x5d, spawn, {.v = volupcmd } }, - { MODKEY, 0x5b, spawn, {.v = voldowncmd } }, - { 0, 0x1008ff11,spawn, {.v = voldowncmd } }, - { 0, 0x1008ff13,spawn, {.v = volupcmd } }, - { MODKEY, XK_x, spawn, {.v = discordcmd } }, - { MODKEY, XK_z, spawn, {.v = sublcmd } }, + /* Utilities */ + { MODKEY, XK_F5, spawn, SHCMD("setxkbmap us") }, /* | if kludge bottom doesn't work - */ + { MODKEY, XK_F6, spawn, SHCMD("setxkbmap ru") }, /* / it can change your layout */ + { MODKEY, XK_space, spawn, {.v = layoutcmd } }, /* kludge for switching layout */ + + { 0, XK_Print, spawn, {.v = scrotshcmd } }, /* print screen */ { MODKEY, XK_v, spawn, {.v = convertcmd } }, + { MODKEY, XK_d, spawn, {.v = dmenucmd } }, { MODKEY, XK_c, spawn, {.v = calccmd} }, - { MODKEY, XK_d, spawn, {.v = dmenucmd } }, - { MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } }, + { MODKEY, 0x5b, spawn, {.v = voldowncmd } }, /* | Multimedia keys */ + { MODKEY, 0x5d, spawn, {.v = volupcmd } }, /* / */ + { 0, 0x1008ff11,spawn, {.v = voldowncmd } }, /* | Wheel on my headphones */ + { 0, 0x1008ff13,spawn, {.v = volupcmd } }, /* / */ + + /* Apps */ + { MODKEY|ShiftMask, XK_x, spawn, {.v = discordcmd } }, /* I use discord, btw */ + { MODKEY|ShiftMask, XK_s, spawn, {.v = browsercmd } }, /* Browser */ + { MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } }, /* | Terminal and editor names defined in */ + { MODKEY|ShiftMask, XK_e, spawn, {.v = editorcmd } }, /* / TERMINAL and EDITOR */ + + /* Other */ { MODKEY, XK_b, togglebar, {0} }, { MODKEY, XK_j, focusstack, {.i = +1 } }, { MODKEY, XK_k, focusstack, {.i = -1 } }, @@ -126,7 +135,7 @@ static Key keys[] = { TAGKEYS( XK_8, 7) TAGKEYS( XK_9, 8) { MODKEY|ShiftMask, XK_q, quit, {0} }, - // gaps + /* gaps */ { MODKEY|ShiftMask, XK_g, togglegaps, {0} }, };