From a39cf7913c5071a6f730cbd0fa8cb4792e641e24 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Tue, 31 May 2022 21:35:39 -0400 Subject: [PATCH] minimize shcmds, close #191 --- config.h | 112 +++++++++++++++++++++++++++---------------------------- 1 file changed, 56 insertions(+), 56 deletions(-) diff --git a/config.h b/config.h index 4514bd7..0d3fa3c 100644 --- a/config.h +++ b/config.h @@ -136,7 +136,7 @@ static Key keys[] = { STACKKEYS(MODKEY, focus) STACKKEYS(MODKEY|ShiftMask, push) /* { MODKEY|ShiftMask, XK_Escape, spawn, SHCMD("") }, */ - { MODKEY, XK_grave, spawn, SHCMD("dmenuunicode") }, + { MODKEY, XK_grave, spawn, {.v = (const char*[]){ "dmenuunicode", NULL } } }, /* { MODKEY|ShiftMask, XK_grave, togglescratch, SHCMD("") }, */ TAGKEYS( XK_1, 0) TAGKEYS( XK_2, 1) @@ -153,19 +153,19 @@ static Key keys[] = { { MODKEY|ShiftMask, XK_minus, spawn, SHCMD("pamixer --allow-boost -d 15; kill -44 $(pidof dwmblocks)") }, { MODKEY, XK_equal, spawn, SHCMD("pamixer --allow-boost -i 5; kill -44 $(pidof dwmblocks)") }, { MODKEY|ShiftMask, XK_equal, spawn, SHCMD("pamixer --allow-boost -i 15; kill -44 $(pidof dwmblocks)") }, - { MODKEY, XK_BackSpace, spawn, SHCMD("sysact") }, - { MODKEY|ShiftMask, XK_BackSpace, spawn, SHCMD("sysact") }, + { MODKEY, XK_BackSpace, spawn, {.v = (const char*[]){ "sysact", NULL } } }, + { MODKEY|ShiftMask, XK_BackSpace, spawn, {.v = (const char*[]){ "sysact", NULL } } }, { MODKEY, XK_Tab, view, {0} }, /* { MODKEY|ShiftMask, XK_Tab, spawn, SHCMD("") }, */ { MODKEY, XK_q, killclient, {0} }, - { MODKEY|ShiftMask, XK_q, spawn, SHCMD("sysact") }, - { MODKEY, XK_w, spawn, SHCMD("$BROWSER") }, - { MODKEY|ShiftMask, XK_w, spawn, SHCMD(TERMINAL " -e sudo nmtui") }, + { MODKEY|ShiftMask, XK_q, spawn, {.v = (const char*[]){ "sysact", NULL } } }, + { MODKEY, XK_w, spawn, {.v = (const char*[]){ BROWSER, NULL } } }, + { MODKEY|ShiftMask, XK_w, spawn, {.v = (const char*[]){ TERMINAL, "-e", "sudo", "nmtui", NULL } } }, { MODKEY, XK_e, spawn, SHCMD(TERMINAL " -e neomutt ; pkill -RTMIN+12 dwmblocks; rmdir ~/.abook") }, { MODKEY|ShiftMask, XK_e, spawn, SHCMD(TERMINAL " -e abook -C ~/.config/abook/abookrc --datafile ~/.config/abook/addressbook") }, - { MODKEY, XK_r, spawn, SHCMD(TERMINAL " -e lfub") }, - { MODKEY|ShiftMask, XK_r, spawn, SHCMD(TERMINAL " -e htop") }, + { MODKEY, XK_r, spawn, {.v = (const char*[]){ TERMINAL, "-e", "lfub", NULL } } }, + { MODKEY|ShiftMask, XK_r, spawn, {.v = (const char*[]){ TERMINAL, "-e", "htop", NULL } } }, { MODKEY, XK_t, setlayout, {.v = &layouts[0]} }, /* tile */ { MODKEY|ShiftMask, XK_t, setlayout, {.v = &layouts[1]} }, /* bstack */ { MODKEY, XK_y, setlayout, {.v = &layouts[2]} }, /* spiral */ @@ -176,12 +176,12 @@ static Key keys[] = { { MODKEY|ShiftMask, XK_i, setlayout, {.v = &layouts[7]} }, /* centeredfloatingmaster */ { MODKEY, XK_o, incnmaster, {.i = +1 } }, { MODKEY|ShiftMask, XK_o, incnmaster, {.i = -1 } }, - { MODKEY, XK_p, spawn, SHCMD("mpc toggle") }, - { MODKEY|ShiftMask, XK_p, spawn, SHCMD("mpc pause ; pauseallmpv") }, - { MODKEY, XK_bracketleft, spawn, SHCMD("mpc seek -10") }, - { MODKEY|ShiftMask, XK_bracketleft, spawn, SHCMD("mpc seek -60") }, - { MODKEY, XK_bracketright, spawn, SHCMD("mpc seek +10") }, - { MODKEY|ShiftMask, XK_bracketright, spawn, SHCMD("mpc seek +60") }, + { MODKEY, XK_p, spawn, {.v = (const char*[]){ "mpc", "toggle", NULL } } }, + { MODKEY|ShiftMask, XK_p, spawn, SHCMD("mpc pause; pauseallmpv") }, + { MODKEY, XK_bracketleft, spawn, {.v = (const char*[]){ "mpc", "seek", "-10", NULL } } }, + { MODKEY|ShiftMask, XK_bracketleft, spawn, {.v = (const char*[]){ "mpc", "seek", "-60", NULL } } }, + { MODKEY, XK_bracketright, spawn, {.v = (const char*[]){ "mpc", "seek", "+10", NULL } } }, + { MODKEY|ShiftMask, XK_bracketright, spawn, {.v = (const char*[]){ "mpc", "seek", "+60", NULL } } }, { MODKEY, XK_backslash, view, {0} }, /* { MODKEY|ShiftMask, XK_backslash, spawn, SHCMD("") }, */ @@ -189,8 +189,8 @@ static Key keys[] = { { MODKEY|ShiftMask, XK_a, defaultgaps, {0} }, { MODKEY, XK_s, togglesticky, {0} }, /* { MODKEY|ShiftMask, XK_s, spawn, SHCMD("") }, */ - { MODKEY, XK_d, spawn, SHCMD("dmenu_run") }, - { MODKEY|ShiftMask, XK_d, spawn, SHCMD("passmenu") }, + { MODKEY, XK_d, spawn, {.v = (const char*[]){ "dmenu_run", NULL } } }, + { MODKEY|ShiftMask, XK_d, spawn, {.v = (const char*[]){ "passmenu", NULL } } }, { MODKEY, XK_f, togglefullscr, {0} }, { MODKEY|ShiftMask, XK_f, setlayout, {.v = &layouts[8]} }, { MODKEY, XK_g, shiftview, { .i = -1 } }, @@ -210,19 +210,19 @@ static Key keys[] = { /* { MODKEY|ShiftMask, XK_z, spawn, SHCMD("") }, */ { MODKEY, XK_x, incrgaps, {.i = -3 } }, /* { MODKEY|ShiftMask, XK_x, spawn, SHCMD("") }, */ - /* { MODKEY, XK_c, spawn, SHCMD("") }, */ + { MODKEY, XK_c, spawn, {.v = (const char*[]){ TERMINAL, "-e", "profanity", NULL } } }, /* { MODKEY|ShiftMask, XK_c, spawn, SHCMD("") }, */ /* V is automatically bound above in STACKKEYS */ { MODKEY, XK_b, togglebar, {0} }, /* { MODKEY|ShiftMask, XK_b, spawn, SHCMD("") }, */ - { MODKEY, XK_n, spawn, SHCMD(TERMINAL " -e nvim -c VimwikiIndex") }, - { MODKEY|ShiftMask, XK_n, spawn, SHCMD(TERMINAL " -e newsboat; pkill -RTMIN+6 dwmblocks") }, - { MODKEY, XK_m, spawn, SHCMD(TERMINAL " -e ncmpcpp") }, + { MODKEY, XK_n, spawn, {.v = (const char*[]){ TERMINAL, "-e", "nvim", "-c", "VimwikiIndex", NULL } } }, + { MODKEY|ShiftMask, XK_n, spawn, SHCMD(TERMINAL " -e newsboat ; pkill -RTMIN+6 dwmblocks") }, + { MODKEY, XK_m, spawn, {.v = (const char*[]){ TERMINAL, "-e", "ncmpcpp", NULL } } }, { MODKEY|ShiftMask, XK_m, spawn, SHCMD("pamixer -t; kill -44 $(pidof dwmblocks)") }, - { MODKEY, XK_comma, spawn, SHCMD("mpc prev") }, - { MODKEY|ShiftMask, XK_comma, spawn, SHCMD("mpc seek 0%") }, - { MODKEY, XK_period, spawn, SHCMD("mpc next") }, - { MODKEY|ShiftMask, XK_period, spawn, SHCMD("mpc repeat") }, + { MODKEY, XK_comma, spawn, {.v = (const char*[]){ "mpc", "prev", NULL } } }, + { MODKEY|ShiftMask, XK_comma, spawn, {.v = (const char*[]){ "mpc", "seek", "0%", NULL } } }, + { MODKEY, XK_period, spawn, {.v = (const char*[]){ "mpc", "next", NULL } } }, + { MODKEY|ShiftMask, XK_period, spawn, {.v = (const char*[]){ "mpc", "repeat", NULL } } }, { MODKEY, XK_Left, focusmon, {.i = -1 } }, { MODKEY|ShiftMask, XK_Left, tagmon, {.i = -1 } }, @@ -236,55 +236,55 @@ static Key keys[] = { { MODKEY, XK_Insert, spawn, SHCMD("xdotool type $(grep -v '^#' ~/.local/share/larbs/snippets | dmenu -i -l 50 | cut -d' ' -f1)") }, { MODKEY, XK_F1, spawn, SHCMD("groff -mom /usr/local/share/dwm/larbs.mom -Tpdf | zathura -") }, - { MODKEY, XK_F2, spawn, SHCMD("tutorialvids") }, - { MODKEY, XK_F3, spawn, SHCMD("displayselect") }, + { MODKEY, XK_F2, spawn, {.v = (const char*[]){ "tutorialvids", NULL } } }, + { MODKEY, XK_F3, spawn, {.v = (const char*[]){ "displayselect", NULL } } }, { MODKEY, XK_F4, spawn, SHCMD(TERMINAL " -e pulsemixer; kill -44 $(pidof dwmblocks)") }, /* { MODKEY, XK_F5, xrdb, {.v = NULL } }, */ - { MODKEY, XK_F6, spawn, SHCMD("torwrap") }, - { MODKEY, XK_F7, spawn, SHCMD("td-toggle") }, - { MODKEY, XK_F8, spawn, SHCMD("mw -Y") }, - { MODKEY, XK_F9, spawn, SHCMD("dmenumount") }, - { MODKEY, XK_F10, spawn, SHCMD("dmenuumount") }, + { MODKEY, XK_F6, spawn, {.v = (const char*[]){ "torwrap", NULL } } }, + { MODKEY, XK_F7, spawn, {.v = (const char*[]){ "td-toggle", NULL } } }, + { MODKEY, XK_F8, spawn, {.v = (const char*[]){ "mw", "-Y", NULL } } }, + { MODKEY, XK_F9, spawn, {.v = (const char*[]){ "dmenumount", NULL } } }, + { MODKEY, XK_F10, spawn, {.v = (const char*[]){ "dmenuumount", NULL } } }, { MODKEY, XK_F11, spawn, SHCMD("mpv --untimed --no-cache --no-osc --no-input-default-bindings --profile=low-latency --input-conf=/dev/null --title=webcam $(ls /dev/video[0,2,4,6,8] | tail -n 1)") }, - { MODKEY, XK_F12, spawn, SHCMD("remaps & notify-send \\\"⌨️ Keyboard remapping...\\\" \\\"Re-running keyboard defaults for any newly plugged-in keyboards.\\\"") }, + { MODKEY, XK_F12, spawn, SHCMD("remaps & notify-send \"⌨️ Keyboard remapping...\" \"Re-running keyboard defaults for any newly plugged-in keyboards.\"") }, { MODKEY, XK_space, zoom, {0} }, { MODKEY|ShiftMask, XK_space, togglefloating, {0} }, { 0, XK_Print, spawn, SHCMD("maim pic-full-$(date '+%y%m%d-%H%M-%S').png") }, - { ShiftMask, XK_Print, spawn, SHCMD("maimpick") }, - { MODKEY, XK_Print, spawn, SHCMD("dmenurecord") }, - { MODKEY|ShiftMask, XK_Print, spawn, SHCMD("dmenurecord kill") }, - { MODKEY, XK_Delete, spawn, SHCMD("dmenurecord kill") }, + { ShiftMask, XK_Print, spawn, {.v = (const char*[]){ "maimpick", NULL } } }, + { MODKEY, XK_Print, spawn, {.v = (const char*[]){ "dmenurecord", NULL } } }, + { MODKEY|ShiftMask, XK_Print, spawn, {.v = (const char*[]){ "dmenurecord", "kill", NULL } } }, + { MODKEY, XK_Delete, spawn, {.v = (const char*[]){ "dmenurecord", "kill", NULL } } }, { MODKEY, XK_Scroll_Lock, spawn, SHCMD("killall screenkey || screenkey &") }, { 0, XF86XK_AudioMute, spawn, SHCMD("pamixer -t; kill -44 $(pidof dwmblocks)") }, { 0, XF86XK_AudioRaiseVolume, spawn, SHCMD("pamixer --allow-boost -i 3; kill -44 $(pidof dwmblocks)") }, { 0, XF86XK_AudioLowerVolume, spawn, SHCMD("pamixer --allow-boost -d 3; kill -44 $(pidof dwmblocks)") }, - { 0, XF86XK_AudioPrev, spawn, SHCMD("mpc prev") }, - { 0, XF86XK_AudioNext, spawn, SHCMD("mpc next") }, - { 0, XF86XK_AudioPause, spawn, SHCMD("mpc pause") }, - { 0, XF86XK_AudioPlay, spawn, SHCMD("mpc play") }, - { 0, XF86XK_AudioStop, spawn, SHCMD("mpc stop") }, - { 0, XF86XK_AudioRewind, spawn, SHCMD("mpc seek -10") }, - { 0, XF86XK_AudioForward, spawn, SHCMD("mpc seek +10") }, - { 0, XF86XK_AudioMedia, spawn, SHCMD(TERMINAL " -e ncmpcpp") }, + { 0, XF86XK_AudioPrev, spawn, {.v = (const char*[]){ "mpc", "prev", NULL } } }, + { 0, XF86XK_AudioNext, spawn, {.v = (const char*[]){ "mpc", "next", NULL } } }, + { 0, XF86XK_AudioPause, spawn, {.v = (const char*[]){ "mpc", "pause", NULL } } }, + { 0, XF86XK_AudioPlay, spawn, {.v = (const char*[]){ "mpc", "play", NULL } } }, + { 0, XF86XK_AudioStop, spawn, {.v = (const char*[]){ "mpc", "stop", NULL } } }, + { 0, XF86XK_AudioRewind, spawn, {.v = (const char*[]){ "mpc", "seek", "-10", NULL } } }, + { 0, XF86XK_AudioForward, spawn, {.v = (const char*[]){ "mpc", "seek", "+10", NULL } } }, + { 0, XF86XK_AudioMedia, spawn, {.v = (const char*[]){ TERMINAL, "-e", "ncmpcpp", NULL } } }, { 0, XF86XK_AudioMicMute, spawn, SHCMD("pactl set-source-mute @DEFAULT_SOURCE@ toggle") }, - { 0, XF86XK_PowerOff, spawn, SHCMD("sysact") }, - { 0, XF86XK_Calculator, spawn, SHCMD(TERMINAL " -e bc -l") }, - { 0, XF86XK_Sleep, spawn, SHCMD("sudo -A zzz") }, - { 0, XF86XK_WWW, spawn, SHCMD("$BROWSER") }, - { 0, XF86XK_DOS, spawn, SHCMD(TERMINAL) }, + { 0, XF86XK_PowerOff, spawn, {.v = (const char*[]){ "sysact", NULL } } }, + { 0, XF86XK_Calculator, spawn, {.v = (const char*[]){ TERMINAL, "-e", "bc", "-l", NULL } } }, + { 0, XF86XK_Sleep, spawn, {.v = (const char*[]){ "sudo", "-A", "zzz", NULL } } }, + { 0, XF86XK_WWW, spawn, {.v = (const char*[]){ BROWSER, NULL } } }, + { 0, XF86XK_DOS, spawn, {.v = termcmd } }, { 0, XF86XK_ScreenSaver, spawn, SHCMD("slock & xset dpms force off; mpc pause; pauseallmpv") }, - { 0, XF86XK_TaskPane, spawn, SHCMD(TERMINAL " -e htop") }, + { 0, XF86XK_TaskPane, spawn, {.v = (const char*[]){ TERMINAL, "-e", "htop", NULL } } }, { 0, XF86XK_Mail, spawn, SHCMD(TERMINAL " -e neomutt ; pkill -RTMIN+12 dwmblocks") }, - { 0, XF86XK_MyComputer, spawn, SHCMD(TERMINAL " -e lfub /") }, + { 0, XF86XK_MyComputer, spawn, {.v = (const char*[]){ TERMINAL, "-e", "lfub", "/", NULL } } }, /* { 0, XF86XK_Battery, spawn, SHCMD("") }, */ - { 0, XF86XK_Launch1, spawn, SHCMD("xset dpms force off") }, + { 0, XF86XK_Launch1, spawn, {.v = (const char*[]){ "xset", "dpms", "force", "off", NULL } } }, { 0, XF86XK_TouchpadToggle, spawn, SHCMD("(synclient | grep 'TouchpadOff.*1' && synclient TouchpadOff=0) || synclient TouchpadOff=1") }, - { 0, XF86XK_TouchpadOff, spawn, SHCMD("synclient TouchpadOff=1") }, - { 0, XF86XK_TouchpadOn, spawn, SHCMD("synclient TouchpadOff=0") }, - { 0, XF86XK_MonBrightnessUp, spawn, SHCMD("xbacklight -inc 15") }, - { 0, XF86XK_MonBrightnessDown, spawn, SHCMD("xbacklight -dec 15") }, + { 0, XF86XK_TouchpadOff, spawn, {.v = (const char*[]){ "synclient", "TouchpadOff=1", NULL } } }, + { 0, XF86XK_TouchpadOn, spawn, {.v = (const char*[]){ "synclient", "TouchpadOff=0", NULL } } }, + { 0, XF86XK_MonBrightnessUp, spawn, {.v = (const char*[]){ "xbacklight", "-inc", "15", NULL } } }, + { 0, XF86XK_MonBrightnessDown, spawn, {.v = (const char*[]){ "xbacklight", "-dec", "15", NULL } } }, /* { MODKEY|Mod4Mask, XK_h, incrgaps, {.i = +1 } }, */ /* { MODKEY|Mod4Mask, XK_l, incrgaps, {.i = -1 } }, */