dwm

suckless dynamic window manager
git clone https://git.beauhilton.com/dwm.git
Log | Files | Refs | README | LICENSE

config.h (15519B)


      1 /* See LICENSE file for copyright and license details. */
      2 
      3 /* constants */
      4 #define TERMINAL "kitty"
      5 
      6 /* appearance */
      7 static const unsigned int borderpx = 1; /*[> border pixel of windows <]*/
      8 static const unsigned int snap = 32;    /* snap pixel */
      9 static const unsigned int gappih = 20;  /* horiz inner gap between windows */
     10 static const unsigned int gappiv = 10;  /* vert inner gap between windows */
     11 static const unsigned int gappoh =
     12     10; /* horiz outer gap between windows and screen edge */
     13 static const unsigned int gappov =
     14     30; /* vert outer gap between windows and screen edge */
     15 static const int smartgaps =
     16     1; /* 1 means no outer gap when there is only one window */
     17 static const int showbar = 0; /* 0 means no bar */
     18 static const int topbar = 1;  /* 0 means bottom bar */
     19 static const char *fonts[] = {
     20     "IBM Plex Mono:pixelsize=12:antialias=true:autohint=true",
     21     "Blex Mono:pixelsize=12:antialias=true:autohint=true",
     22     "JoyPixels:pixelsize=10:antialias=true:autohint=true"};
     23 static char dmenufont[] =
     24     "IBM Plex Mono:pixelsize=12:antialias=true:autohint=true";
     25 static char normbgcolor[] = "#181818";
     26 static char normbordercolor[] = "#181818";
     27 static char normfgcolor[] = "#777777";
     28 static char selfgcolor[] = "#dedede";
     29 static char selbordercolor[] = "#181818";
     30 static char selbgcolor[] = "#181818";
     31 static char *colors[][3] = {
     32     /*               fg           bg           border   */
     33     [SchemeNorm] = {normfgcolor, normbgcolor, normbordercolor},
     34     [SchemeSel] = {selfgcolor, selbgcolor, selbordercolor},
     35 };
     36 
     37 /* tagging */
     38 static const char *tags[] = {"1", "2", "3", "4", "5", "6", "7", "8", "9"};
     39 
     40 static const Rule rules[] = {
     41     /*  xprop(1):
     42      *  WM_CLASS(STRING) = instance, class
     43      *  WM_NAME(STRING) = title
     44      */
     45     /*    class     instance    title       tags  mask     isfloating isterminal
     46        noswallow monitor! */
     47     {"kitty", NULL, NULL, 0, 0, 1, 0, -1},
     48     {"Firefox", NULL, NULL, 0, 0, 0, 1, -1},
     49 };
     50 
     51 /* layout(s) */
     52 static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */
     53 static const int nmaster = 1;    /* number of clients in master area */
     54 static const int resizehints =
     55     1; /* 1 means respect size hints in tiled resizals */
     56 #define FORCE_VSPLIT                                                           \
     57   1 /* nrowgrid layout: force two clients to always split vertically */
     58 #include "vanitygaps.c"
     59 static const Layout layouts[] = {
     60     /* symbol     arrange function */
     61     {"[]=", tile},   /* Default: Master on left, stack on right */
     62     {"TTT", bstack}, /* Master on top, stack on bottom */
     63 
     64     {"[@]", spiral},   /* Fibonacci spiral */
     65     {"[\\]", dwindle}, /* Decreasing in size right and leftward */
     66 
     67     {"[D]", deck},    /* Master on left, stack in monocle-like mode on right */
     68     {"[M]", monocle}, /* All windows on top of eachother */
     69 
     70     {"|M|", centeredmaster},         /* Master in middle, stack on sides */
     71     {">M>", centeredfloatingmaster}, /* Same but master floats */
     72 
     73     {"><>", NULL}, /* no layout function means floating behavior */
     74     {NULL, NULL},
     75 };
     76 
     77 /* key definitions */
     78 #define MODKEY Mod4Mask
     79 
     80 #define TAGKEYS(KEY, TAG)                                                      \
     81   {MODKEY, KEY, view, {.ui = 1 << TAG}},                                       \
     82       {MODKEY | ControlMask, KEY, toggleview, {.ui = 1 << TAG}},               \
     83       {MODKEY | ShiftMask, KEY, tag, {.ui = 1 << TAG}},                        \
     84       {MODKEY | ControlMask | ShiftMask, KEY, toggletag, {.ui = 1 << TAG}},
     85 
     86 #define STACKKEYS(MOD, ACTION)                                                 \
     87   {MOD, XK_j, ACTION##stack, {.i = INC(+1)}},                                  \
     88       {MOD, XK_k, ACTION##stack, {.i = INC(-1)}},                              \
     89       {MOD, XK_v, ACTION##stack, {.i = 0}},
     90 
     91 /* helper for spawning shell commands in the pre dwm-5.0 fashion */
     92 #define SHCMD(cmd)                                                             \
     93   {                                                                            \
     94     .v = (const char *[]) { "/bin/sh", "-c", cmd, NULL }                       \
     95   }
     96 
     97 /* commands */
     98 static char dmenumon[2] =
     99     "0"; /* component of dmenucmd, manipulated in spawn() */
    100 static const char *dmenucmd[] = {"dmenu_run", "-fn", dmenufont,   "-nb",
    101                                  normbgcolor, "-nf", normfgcolor, "-sb",
    102                                  selbgcolor,  "-sf", selfgcolor,  NULL};
    103 static const char *termcmd[] = {TERMINAL, NULL};
    104 static const char scratchpadname[] = "scratchpad";
    105 static const char *scratchpadcmd[] = {"st", "-t",     scratchpadname,
    106                                       "-g", "120x34", NULL};
    107 
    108 #include "shiftview.c"
    109 #include <X11/XF86keysym.h>
    110 static Key keys[] = {
    111 
    112     /* modifier                     key        function        argument */
    113 
    114     STACKKEYS(MODKEY, focus) STACKKEYS(MODKEY | ShiftMask, push)
    115     /* { MODKEY|ShiftMask,		      XK_Escape,	spawn,
    116      * SHCMD("")
    117      * },
    118      */
    119     {MODKEY, XK_grave, spawn, SHCMD("dmenuunicode")},
    120     /* { MODKEY|ShiftMask,		      XK_grave,	  togglescratch,
    121      * SHCMD("")},
    122      */
    123 
    124     TAGKEYS(XK_1, 0) TAGKEYS(XK_2, 1) TAGKEYS(XK_3, 2) TAGKEYS(XK_4, 3)
    125         TAGKEYS(XK_5, 4) TAGKEYS(XK_6, 5) TAGKEYS(XK_7, 6) TAGKEYS(XK_8, 7)
    126             TAGKEYS(XK_9, 8)
    127 
    128                 {MODKEY, XK_0, view, {.ui = ~0}},
    129     {MODKEY | ShiftMask, XK_0, tag, {.ui = ~0}},
    130     {MODKEY, XK_minus, spawn,
    131      SHCMD("pamixer --allow-boost -d 5; kill -44 $(pidof dwmblocks)")},
    132     {MODKEY | ShiftMask, XK_minus, spawn,
    133      SHCMD("pamixer --allow-boost -d 15; kill -44 $(pidof dwmblocks)")},
    134     {MODKEY, XK_equal, spawn,
    135      SHCMD("pamixer --allow-boost -i 5; kill -44 $(pidof dwmblocks)")},
    136     {MODKEY | ShiftMask, XK_equal, spawn,
    137      SHCMD("pamixer --allow-boost -i 15; kill -44 $(pidof dwmblocks)")},
    138     {MODKEY, XK_BackSpace, spawn, SHCMD("dmenushutdown")},
    139     /* { MODKEY|ShiftMask,		XK_BackSpace,	spawn, SHCMD("")
    140      * },
    141      */
    142     {MODKEY, XK_Tab, view, {0}},
    143     {MODKEY | ShiftMask, XK_Tab, spawn, SHCMD("$TERMINAL -e iwgtk")},
    144     {MODKEY, XK_q, killclient, {0}},
    145     /* { MODKEY|ShiftMask,		XK_q,		spawn, SHCMD("")
    146      * },
    147      */
    148     /* { MODKEY,			XK_w,		spawn,
    149      * SHCMD("$BROWSER")
    150      * },
    151      */
    152     {MODKEY, XK_w, spawn,
    153      SHCMD("$TERMINAL -e vivaldi-stable")},
    154     /* { MODKEY|ShiftMask,		XK_w,		spawn,
    155        SHCMD(TERMINAL " -e dmenunetworks") }, */
    156     {MODKEY, XK_e, spawn,
    157      SHCMD("$TERMINAL -e neomutt ; pkill -RTMIN+12 dwmblocks; rmdir ~/.abook")},
    158     {MODKEY | ShiftMask, XK_e, spawn,
    159      SHCMD("$TERMINAL -e google-chrome-stable "
    160             "--start-fullscreen "
    161             "--incognito "
    162             "--new-window "
    163             "https://virtual.vumc.org/portal/webclient/index.html"
    164            )},
    165     {MODKEY, XK_r, spawn, SHCMD(TERMINAL " -e lfrun")},
    166     /* { MODKEY|ShiftMask,		XK_r,		quit,		{1} },
    167      */
    168     {MODKEY, XK_t, setlayout, {.v = &layouts[0]}},
    169     {MODKEY | ShiftMask, XK_t, setlayout, {.v = &layouts[1]}},
    170     {MODKEY, XK_y, setlayout, {.v = &layouts[2]}},
    171     {MODKEY | ShiftMask, XK_y, setlayout, {.v = &layouts[3]}},
    172     {MODKEY, XK_u, setlayout, {.v = &layouts[4]}},
    173     {MODKEY | ShiftMask, XK_u, setlayout, {.v = &layouts[5]}},
    174     {MODKEY, XK_i, spawn, SHCMD("$TERMINAL -e htop")},
    175     /* { MODKEY,			XK_i,		setlayout,	{.v =
    176      * &layouts[6]}
    177      * },
    178      */
    179     /* { MODKEY|ShiftMask,		XK_i,		setlayout,	{.v =
    180      * &layouts[7]}
    181      * },
    182      */
    183     {MODKEY, XK_o, incnmaster, {.i = +1}},
    184     {MODKEY | ShiftMask, XK_o, incnmaster, {.i = -1}},
    185     {MODKEY, XK_p, spawn, SHCMD("mpc toggle")},
    186     {MODKEY | ShiftMask, XK_p, spawn, SHCMD("mpc pause ; pauseallmpv")},
    187     {MODKEY, XK_bracketleft, spawn, SHCMD("mpc seek -10")},
    188     {MODKEY | ShiftMask, XK_bracketleft, spawn, SHCMD("mpc seek -120")},
    189     {MODKEY, XK_bracketright, spawn, SHCMD("mpc seek +10")},
    190     {MODKEY | ShiftMask, XK_bracketright, spawn, SHCMD("mpc seek +120")},
    191     {MODKEY, XK_backslash, view, {0}},
    192     /* { MODKEY|ShiftMask,		XK_backslash,		spawn,
    193      * SHCMD("")
    194      * },
    195      */
    196     {MODKEY, XK_a, spawn,
    197      SHCMD("$TERMINAL -e pulsemixer; kill -44 $(pidof dwmblocks)")},
    198     /* { MODKEY|ShiftMask,		XK_a,		spawn, SHCMD("")
    199      * },
    200      */
    201     {MODKEY, XK_s, togglesticky, {0}},
    202     /* { MODKEY|ShiftMask,		XK_s,		spawn, SHCMD("")
    203      * },
    204      */
    205     {MODKEY, XK_d, spawn, {.v = dmenucmd}},
    206     {MODKEY | ShiftMask, XK_d, togglegaps, {0}},
    207     {MODKEY, XK_f, togglefullscr, {0}},
    208     {MODKEY | ShiftMask, XK_f, setlayout, {.v = &layouts[8]}},
    209     {MODKEY, XK_g, shiftview, {.i = -1}},
    210     /* { MODKEY|ShiftMask,		XK_g,		spawn, SHCMD("")
    211      * },
    212      */
    213     {MODKEY, XK_h, setmfact, {.f = -0.05}},
    214     /* J and K are automatically bound above in STACKKEYS */
    215     {MODKEY, XK_l, setmfact, {.f = +0.05}},
    216     {MODKEY | ShiftMask, XK_l, spawn,
    217      SHCMD("slock & xset dpms force off; mpc pause; pauseallmpv")},
    218     {MODKEY, XK_semicolon, shiftview, {.i = 1}},
    219     /* { MODKEY|ShiftMask,		XK_semicolon,	shiftview,
    220      * SHCMD("")
    221      * },
    222      */
    223     /* { MODKEY,			XK_apostrophe,	spawn, SHCMD("")
    224      * },
    225      */
    226     /* { MODKEY|ShiftMask,		XK_apostrophe,	spawn, SHCMD("")
    227      * },
    228      */
    229     {MODKEY, XK_Return, spawn, {.v = termcmd}},
    230     {MODKEY | ShiftMask, XK_Return, togglescratch, {.v = scratchpadcmd}},
    231     {MODKEY, XK_z, incrgaps, {.i = +1}},
    232     {MODKEY | ShiftMask, XK_z, incrgaps, {.i = -1}},
    233     /* { MODKEY,			XK_x,		spawn, SHCMD("")
    234      * },
    235      */
    236     /* { MODKEY|ShiftMask,		XK_x,		spawn, SHCMD("")
    237      * },
    238      */
    239     /* { MODKEY,			XK_c,		spawn,
    240      * SHCMD("$TERMINAL -e bc -l")
    241      * },
    242      */
    243     {MODKEY | ShiftMask, XK_c, spawn,
    244      SHCMD("mpv --no-cache --no-osc --no-input-default-bindings "
    245            "--input-conf=/dev/null --title=webcam $(ls /dev/video[0,2,4,6,8] | "
    246            "tail -n 1)")},
    247     {MODKEY, XK_v, spawn, SHCMD("vmware-view")},
    248     {MODKEY | ShiftMask, XK_v, spawn,
    249      SHCMD("$TERMINAL -e $EDITOR $VIMWIKI_HOME")},
    250     {MODKEY, XK_b, togglebar, {0}},
    251     /* { MODKEY|ShiftMask,		XK_b,		spawn, SHCMD("")
    252      * },
    253      */
    254     {MODKEY, XK_n, spawn, SHCMD(TERMINAL " -e lfrun")},
    255     {MODKEY | ShiftMask, XK_n, spawn,
    256      SHCMD(TERMINAL " -e newsboat; pkill -RTMIN+6 dwmblocks")},
    257     /* { MODKEY|ShiftMask,		XK_n,		spawn, SHCMD("")
    258      * },
    259      */
    260     {MODKEY, XK_m, spawn, SHCMD("$TERMINAL -e ncmpcpp")},
    261     {MODKEY | ShiftMask, XK_m, spawn,
    262      SHCMD("pamixer -t; kill -44 $(pidof dwmblocks)")},
    263     {MODKEY, XK_comma, spawn, SHCMD("mpc prev")},
    264     {MODKEY | ShiftMask, XK_comma, spawn, SHCMD("mpc seek 0%")},
    265     {MODKEY, XK_period, spawn, SHCMD("mpc next")},
    266     {MODKEY | ShiftMask, XK_period, spawn, SHCMD("mpc repeat")},
    267     {MODKEY, XK_Left, focusmon, {.i = -1}},
    268     {MODKEY | ShiftMask, XK_Left, tagmon, {.i = -1}},
    269     {MODKEY, XK_Right, focusmon, {.i = +1}},
    270     {MODKEY | ShiftMask, XK_Right, tagmon, {.i = +1}},
    271     {MODKEY, XK_Page_Up, shiftview, {.i = -1}},
    272     {MODKEY, XK_Page_Down, shiftview, {.i = 1}},
    273     {MODKEY, XK_Insert, spawn,
    274      SHCMD("notify-send \"📋\" \"$(xclip -o -selection clipboard)\"")},
    275     {MODKEY, XK_F1, spawn,
    276      SHCMD("groff -mom /usr/local/share/dwm/help.mom -Tpdf | zathura -")},
    277     {MODKEY, XK_F2, quit, {1}},
    278     {MODKEY, XK_F3, spawn, SHCMD("displayselect")},
    279     /* { MODKEY,			XK_F4,		spawn, SHCMD("")
    280      * },
    281      */
    282     {MODKEY, XK_F5, xrdb, {.v = NULL}},
    283     {MODKEY, XK_F6, spawn, SHCMD("torwrap")},
    284     {MODKEY, XK_F7, spawn, SHCMD("td-toggle")},
    285     {MODKEY, XK_F8, spawn, SHCMD("mailsync")},
    286     {MODKEY, XK_F9, spawn, SHCMD("dmenumount")},
    287     {MODKEY, XK_F10, spawn, SHCMD("dmenuumount")},
    288     /* { MODKEY,			XK_F11,		spawn, SHCMD("")
    289      * },
    290      */
    291     /* { MODKEY,			XK_F12,		spawn, SHCMD("")
    292      * },
    293      */
    294     {MODKEY, XK_space, zoom, {0}},
    295     {MODKEY | ShiftMask, XK_space, togglefloating, {0}},
    296     {0, XK_Print, spawn, SHCMD("maim pic-full-$(date '+%y%m%d-%H%M-%S').png")},
    297     {ShiftMask, XK_Print, spawn, SHCMD("maimpick")},
    298     {MODKEY, XK_Print, spawn, SHCMD("dmenurecord")},
    299     {MODKEY | ShiftMask, XK_Print, spawn, SHCMD("dmenurecord kill")},
    300     {MODKEY, XK_Delete, spawn, SHCMD("dmenurecord kill")},
    301     {MODKEY, XK_Scroll_Lock, spawn, SHCMD("killall screenkey || screenkey &")},
    302     {0, XF86XK_AudioMute, spawn,
    303      SHCMD("pamixer -t; kill -44 $(pidof dwmblocks)")},
    304     {0, XF86XK_AudioRaiseVolume, spawn,
    305      SHCMD("pamixer --allow-boost -i 3; kill -44 $(pidof dwmblocks)")},
    306     {0, XF86XK_AudioLowerVolume, spawn,
    307      SHCMD("pamixer --allow-boost -d 3; kill -44 $(pidof dwmblocks)")},
    308     /* { 0, XF86XK_AudioPrev,		spawn,		SHCMD("mpc prev") }, */
    309     /* { 0, XF86XK_AudioNext,		spawn,		SHCMD("mpc next") }, */
    310     /* { 0, XF86XK_AudioPause,		spawn,		SHCMD("mpc pause") }, */
    311     /* { 0, XF86XK_AudioPlay,		spawn,		SHCMD("mpc play") }, */
    312     /* { 0, XF86XK_AudioStop,		spawn,		SHCMD("mpc stop") }, */
    313     /* { 0, XF86XK_AudioRewind,	spawn,		SHCMD("mpc seek -10") }, */
    314     /* { 0, XF86XK_AudioForward,	spawn,		SHCMD("mpc seek +10") },
    315      */
    316     /* { 0, XF86XK_AudioMedia,		spawn,		SHCMD("$TERMINAL -e
    317      * ncmpcpp")
    318      * },
    319      */
    320     /* { 0, XF86XK_PowerOff,		spawn,		SHCMD("[ \"$(printf
    321      * \"No\\nYes\"
    322      * |
    323      */
    324     /* dmenu -i -nb darkred -sb red -sf white -nf gray -p \"Shutdown */
    325     /* computer?\")\" = Yes ] && sudo -A shutdown -h now") }, */
    326     /* { 0, XF86XK_Calculator,		spawn,		SHCMD("$TERMINAL -e bc
    327      * -l")
    328      * },
    329      */
    330     /* { 0, XF86XK_Sleep,		spawn,		SHCMD("sudo -A zzz") },
    331      */
    332     /* { 0, XF86XK_WWW,		spawn,		SHCMD("$BROWSER") }, */
    333     /* { 0, XF86XK_DOS,		spawn,		SHCMD("$TERMINAL") }, */
    334     /* { 0, XF86XK_ScreenSaver,	spawn,		SHCMD("slock & xset dpms force
    335        off; mpc pause; pauseallmpv") }, */
    336     /* { 0, XF86XK_TaskPane,		spawn,		SHCMD("$TERMINAL -e
    337      * htop")
    338      * },
    339      */
    340     /* { 0, XF86XK_Mail,		spawn,		SHCMD("$TERMINAL -e
    341      * neomutt ; pkill
    342      */
    343     /* -RTMIN+12 dwmblocks") }, */
    344     /* { 0, XF86XK_MyComputer,		spawn,		SHCMD("$TERMINAL -e nnn
    345      * /")
    346      * },
    347      */
    348     /* { 0, XF86XK_Battery,		spawn,		SHCMD("") }, */
    349     /* { 0, XF86XK_Launch1,		spawn,		SHCMD("xset dpms force
    350      * off")
    351      * },
    352      */
    353     /* { 0, XF86XK_TouchpadToggle,	spawn,		SHCMD("(synclient | grep
    354        'TouchpadOff.*1' && synclient TouchpadOff=0) || synclient TouchpadOff=1")
    355        }, */
    356     /* { 0, XF86XK_TouchpadOff,	spawn,		SHCMD("synclient TouchpadOff=1")
    357      * },
    358      */
    359     /* { 0, XF86XK_TouchpadOn,		spawn,		SHCMD("synclient
    360      * TouchpadOff=0")
    361      * },
    362      */
    363     {0, XF86XK_MonBrightnessUp, spawn, SHCMD("brillo -e -A 10")},
    364     {0, XF86XK_MonBrightnessDown, spawn, SHCMD("brillo -e -U 10")},
    365 };
    366 
    367 /* button definitions */
    368 /* click can be ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle,
    369  * ClkClientWin, or ClkRootWin */
    370 static Button buttons[] = {
    371     /* click event            mask        button          function argument / */
    372     {ClkLtSymbol, 0, Button1, setlayout, {0}},
    373     {ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]}},
    374     {ClkWinTitle, 0, Button2, zoom, {0}},
    375     {ClkClientWin, MODKEY, Button1, movemouse, {0}},
    376     {ClkClientWin, MODKEY, Button2, togglefloating, {0}},
    377     {ClkClientWin, MODKEY, Button3, resizemouse, {0}},
    378     {ClkTagBar, 0, Button1, view, {0}},
    379     {ClkTagBar, 0, Button3, toggleview, {0}},
    380     {ClkTagBar, MODKEY, Button1, tag, {0}},
    381     {ClkTagBar, MODKEY, Button3, toggletag, {0}},
    382     {ClkTagBar, 0, Button4, shiftview, {.i = -1}},
    383     {ClkTagBar, 0, Button5, shiftview, {.i = 1}},
    384 };