Merge branch 'refactor-terminal-strings-into-constant' of https://github.com/temetvince/dwm into temetvince-refactor-terminal-strings-into-constant

This commit is contained in:
Luke Smith 2020-09-12 09:32:44 -04:00
commit 8f3797c9f0
No known key found for this signature in database
GPG key ID: 4C50B54A911F6252

View file

@ -1,5 +1,9 @@
/* See LICENSE file for copyright and license details. */ /* See LICENSE file for copyright and license details. */
/* Constants */
#define TERMINAL "st"
#define TERM_CAP "St"
/* appearance */ /* appearance */
static const unsigned int borderpx = 3; /* border pixel of windows */ static const unsigned int borderpx = 3; /* border pixel of windows */
static const unsigned int snap = 32; /* snap pixel */ static const unsigned int snap = 32; /* snap pixel */
@ -29,8 +33,8 @@ typedef struct {
const char *name; const char *name;
const void *cmd; const void *cmd;
} Sp; } Sp;
const char *spcmd1[] = {"st", "-n", "spterm", "-g", "120x34", NULL }; const char *spcmd1[] = {TERMINAL, "-n", "spterm", "-g", "120x34", NULL };
const char *spcmd2[] = {"st", "-n", "spcalc", "-f", "monospace:size=16", "-g", "50x20", "-e", "bc", "-lq", NULL }; const char *spcmd2[] = {TERMINAL, "-n", "spcalc", "-f", "monospace:size=16", "-g", "50x20", "-e", "bc", "-lq", NULL };
static Sp scratchpads[] = { static Sp scratchpads[] = {
/* name cmd */ /* name cmd */
{"spterm", spcmd1}, {"spterm", spcmd1},
@ -47,7 +51,7 @@ static const Rule rules[] = {
*/ */
/* class instance title tags mask isfloating isterminal noswallow monitor */ /* class instance title tags mask isfloating isterminal noswallow monitor */
{ "Gimp", NULL, NULL, 1 << 8, 0, 0, 0, -1 }, { "Gimp", NULL, NULL, 1 << 8, 0, 0, 0, -1 },
{ "St", NULL, NULL, 0, 0, 1, 0, -1 }, { TERM_CAP, NULL, NULL, 0, 0, 1, 0, -1 },
{ NULL, NULL, "Event Tester", 0, 0, 0, 1, -1 }, { NULL, NULL, "Event Tester", 0, 0, 0, 1, -1 },
{ NULL, "spterm", NULL, SPTAG(0), 1, 1, 0, -1 }, { NULL, "spterm", NULL, SPTAG(0), 1, 1, 0, -1 },
{ NULL, "spcalc", NULL, SPTAG(1), 1, 1, 0, -1 }, { NULL, "spcalc", NULL, SPTAG(1), 1, 1, 0, -1 },
@ -99,7 +103,7 @@ static const Layout layouts[] = {
/* commands */ /* commands */
static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */ static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", normbgcolor, "-nf", normfgcolor, "-sb", selbgcolor, "-sf", selfgcolor, NULL }; static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", normbgcolor, "-nf", normfgcolor, "-sb", selbgcolor, "-sf", selfgcolor, NULL };
static const char *termcmd[] = { "st", NULL }; static const char *termcmd[] = { TERMINAL, NULL };
#include <X11/XF86keysym.h> #include <X11/XF86keysym.h>
#include "shiftview.c" #include "shiftview.c"
@ -133,11 +137,11 @@ static Key keys[] = {
{ MODKEY, XK_q, killclient, {0} }, { MODKEY, XK_q, killclient, {0} },
{ MODKEY|ShiftMask, XK_q, spawn, SHCMD("sysact") }, { MODKEY|ShiftMask, XK_q, spawn, SHCMD("sysact") },
{ MODKEY, XK_w, spawn, SHCMD("$BROWSER") }, { MODKEY, XK_w, spawn, SHCMD("$BROWSER") },
{ MODKEY|ShiftMask, XK_w, spawn, SHCMD("st -e sudo nmtui") }, { MODKEY|ShiftMask, XK_w, spawn, SHCMD(TERMINAL " -e sudo nmtui") },
{ MODKEY, XK_e, spawn, SHCMD("st -e neomutt ; pkill -RTMIN+12 dwmblocks; rmdir ~/.abook") }, { MODKEY, XK_e, spawn, SHCMD(TERMINAL " -e neomutt ; pkill -RTMIN+12 dwmblocks; rmdir ~/.abook") },
{ MODKEY|ShiftMask, XK_e, spawn, SHCMD("st -e abook -C ~/.config/abook/abookrc --datafile ~/.config/abook/addressbook") }, { MODKEY|ShiftMask, XK_e, spawn, SHCMD(TERMINAL " -e abook -C ~/.config/abook/abookrc --datafile ~/.config/abook/addressbook") },
{ MODKEY, XK_r, spawn, SHCMD("st -e lf") }, { MODKEY, XK_r, spawn, SHCMD(TERMINAL " -e lf") },
{ MODKEY|ShiftMask, XK_r, spawn, SHCMD("st -e htop") }, { MODKEY|ShiftMask, XK_r, spawn, SHCMD(TERMINAL " -e htop") },
{ MODKEY, XK_t, setlayout, {.v = &layouts[0]} }, /* tile */ { MODKEY, XK_t, setlayout, {.v = &layouts[0]} }, /* tile */
{ MODKEY|ShiftMask, XK_t, setlayout, {.v = &layouts[1]} }, /* bstack */ { MODKEY|ShiftMask, XK_t, setlayout, {.v = &layouts[1]} }, /* bstack */
{ MODKEY, XK_y, setlayout, {.v = &layouts[2]} }, /* spiral */ { MODKEY, XK_y, setlayout, {.v = &layouts[2]} }, /* spiral */
@ -186,9 +190,9 @@ static Key keys[] = {
/* V is automatically bound above in STACKKEYS */ /* V is automatically bound above in STACKKEYS */
{ MODKEY, XK_b, togglebar, {0} }, { MODKEY, XK_b, togglebar, {0} },
/* { MODKEY|ShiftMask, XK_b, spawn, SHCMD("") }, */ /* { MODKEY|ShiftMask, XK_b, spawn, SHCMD("") }, */
{ MODKEY, XK_n, spawn, SHCMD("st -e nvim -c VimwikiIndex") }, { MODKEY, XK_n, spawn, SHCMD(TERMINAL " -e nvim -c VimwikiIndex") },
{ MODKEY|ShiftMask, XK_n, spawn, SHCMD("st -e newsboat; pkill -RTMIN+6 dwmblocks") }, { MODKEY|ShiftMask, XK_n, spawn, SHCMD(TERMINAL " -e newsboat; pkill -RTMIN+6 dwmblocks") },
{ MODKEY, XK_m, spawn, SHCMD("st -e ncmpcpp") }, { MODKEY, XK_m, spawn, SHCMD(TERMINAL " -e ncmpcpp") },
{ MODKEY|ShiftMask, XK_m, spawn, SHCMD("pamixer -t; kill -44 $(pidof dwmblocks)") }, { MODKEY|ShiftMask, XK_m, spawn, SHCMD("pamixer -t; kill -44 $(pidof dwmblocks)") },
{ MODKEY, XK_comma, spawn, SHCMD("mpc prev") }, { MODKEY, XK_comma, spawn, SHCMD("mpc prev") },
{ MODKEY|ShiftMask, XK_comma, spawn, SHCMD("mpc seek 0%") }, { MODKEY|ShiftMask, XK_comma, spawn, SHCMD("mpc seek 0%") },
@ -209,7 +213,7 @@ static Key keys[] = {
{ MODKEY, XK_F1, spawn, SHCMD("groff -mom /usr/local/share/dwm/larbs.mom -Tpdf | zathura -") }, { MODKEY, XK_F1, spawn, SHCMD("groff -mom /usr/local/share/dwm/larbs.mom -Tpdf | zathura -") },
{ MODKEY, XK_F2, spawn, SHCMD("tutorialvids") }, { MODKEY, XK_F2, spawn, SHCMD("tutorialvids") },
{ MODKEY, XK_F3, spawn, SHCMD("displayselect") }, { MODKEY, XK_F3, spawn, SHCMD("displayselect") },
{ MODKEY, XK_F4, spawn, SHCMD("st -e pulsemixer; kill -44 $(pidof dwmblocks)") }, { MODKEY, XK_F4, spawn, SHCMD(TERMINAL " -e pulsemixer; kill -44 $(pidof dwmblocks)") },
{ MODKEY, XK_F5, xrdb, {.v = NULL } }, { MODKEY, XK_F5, xrdb, {.v = NULL } },
{ MODKEY, XK_F6, spawn, SHCMD("torwrap") }, { MODKEY, XK_F6, spawn, SHCMD("torwrap") },
{ MODKEY, XK_F7, spawn, SHCMD("td-toggle") }, { MODKEY, XK_F7, spawn, SHCMD("td-toggle") },
@ -238,17 +242,17 @@ static Key keys[] = {
{ 0, XF86XK_AudioStop, spawn, SHCMD("mpc stop") }, { 0, XF86XK_AudioStop, spawn, SHCMD("mpc stop") },
{ 0, XF86XK_AudioRewind, spawn, SHCMD("mpc seek -10") }, { 0, XF86XK_AudioRewind, spawn, SHCMD("mpc seek -10") },
{ 0, XF86XK_AudioForward, spawn, SHCMD("mpc seek +10") }, { 0, XF86XK_AudioForward, spawn, SHCMD("mpc seek +10") },
{ 0, XF86XK_AudioMedia, spawn, SHCMD("st -e ncmpcpp") }, { 0, XF86XK_AudioMedia, spawn, SHCMD(TERMINAL " -e ncmpcpp") },
{ 0, XF86XK_AudioMicMute, spawn, SHCMD("pactl set-source-mute @DEFAULT_SOURCE@ toggle") }, { 0, XF86XK_AudioMicMute, spawn, SHCMD("pactl set-source-mute @DEFAULT_SOURCE@ toggle") },
{ 0, XF86XK_PowerOff, spawn, SHCMD("sysact") }, { 0, XF86XK_PowerOff, spawn, SHCMD("sysact") },
{ 0, XF86XK_Calculator, spawn, SHCMD("st -e bc -l") }, { 0, XF86XK_Calculator, spawn, SHCMD(TERMINAL " -e bc -l") },
{ 0, XF86XK_Sleep, spawn, SHCMD("sudo -A zzz") }, { 0, XF86XK_Sleep, spawn, SHCMD("sudo -A zzz") },
{ 0, XF86XK_WWW, spawn, SHCMD("$BROWSER") }, { 0, XF86XK_WWW, spawn, SHCMD("$BROWSER") },
{ 0, XF86XK_DOS, spawn, SHCMD("st") }, { 0, XF86XK_DOS, spawn, SHCMD(TERMINAL) },
{ 0, XF86XK_ScreenSaver, spawn, SHCMD("slock & xset dpms force off; mpc pause; pauseallmpv") }, { 0, XF86XK_ScreenSaver, spawn, SHCMD("slock & xset dpms force off; mpc pause; pauseallmpv") },
{ 0, XF86XK_TaskPane, spawn, SHCMD("st -e htop") }, { 0, XF86XK_TaskPane, spawn, SHCMD(TERMINAL " -e htop") },
{ 0, XF86XK_Mail, spawn, SHCMD("st -e neomutt ; pkill -RTMIN+12 dwmblocks") }, { 0, XF86XK_Mail, spawn, SHCMD(TERMINAL " -e neomutt ; pkill -RTMIN+12 dwmblocks") },
{ 0, XF86XK_MyComputer, spawn, SHCMD("st -e lf /") }, { 0, XF86XK_MyComputer, spawn, SHCMD(TERMINAL " -e lf /") },
/* { 0, XF86XK_Battery, spawn, SHCMD("") }, */ /* { 0, XF86XK_Battery, spawn, SHCMD("") }, */
{ 0, XF86XK_Launch1, spawn, SHCMD("xset dpms force off") }, { 0, XF86XK_Launch1, spawn, SHCMD("xset dpms force off") },
{ 0, XF86XK_TouchpadToggle, spawn, SHCMD("(synclient | grep 'TouchpadOff.*1' && synclient TouchpadOff=0) || synclient TouchpadOff=1") }, { 0, XF86XK_TouchpadToggle, spawn, SHCMD("(synclient | grep 'TouchpadOff.*1' && synclient TouchpadOff=0) || synclient TouchpadOff=1") },
@ -288,7 +292,7 @@ static Button buttons[] = {
{ ClkStatusText, 0, Button5, sigdwmblocks, {.i = 5} }, { ClkStatusText, 0, Button5, sigdwmblocks, {.i = 5} },
{ ClkStatusText, ShiftMask, Button1, sigdwmblocks, {.i = 6} }, { ClkStatusText, ShiftMask, Button1, sigdwmblocks, {.i = 6} },
#endif #endif
{ ClkStatusText, ShiftMask, Button3, spawn, SHCMD("st -e nvim ~/.local/src/dwmblocks/config.h") }, { ClkStatusText, ShiftMask, Button3, spawn, SHCMD(TERMINAL " -e nvim ~/.local/src/dwmblocks/config.h") },
{ ClkClientWin, MODKEY, Button1, movemouse, {0} }, { ClkClientWin, MODKEY, Button1, movemouse, {0} },
{ ClkClientWin, MODKEY, Button2, defaultgaps, {0} }, { ClkClientWin, MODKEY, Button2, defaultgaps, {0} },
{ ClkClientWin, MODKEY, Button3, resizemouse, {0} }, { ClkClientWin, MODKEY, Button3, resizemouse, {0} },