dwm

my heavily-patched and customized dwm build
git clone git://git.kocotian.pl/dwm.git
Log | Files | Refs | README | LICENSE

config.def.h (19147B)


      1 /* See LICENSE file for copyright and license details. */
      2 
      3 /* functions */
      4 static void modmove(const Arg *arg);
      5 
      6 /* appearance */
      7 static const unsigned int borderpx  = 2;        /* border pixel of windows */
      8 static const unsigned int snap      = 32;       /* snap pixel */
      9 static const unsigned int smartgaps = 0;        /* smart gaps */
     10 static const unsigned int smartbord = 1;        /* smart borders */
     11 static const unsigned int ogappx    = 30;       /* outer gaps */
     12 static const unsigned int igappx    = 3;        /* inner gaps */
     13 static const int swallowfloating    = 0;        /* 1 means swallow floating windows by default */
     14 static const int showbar            = 1;        /* 0 means no bar */
     15 static const int topbar             = 1;        /* 0 means bottom bar */
     16 static const int barheight          = 25;       /* height of a bar; 0 equals autocalculation */
     17 static const int attachdirection    = 0;        /* 0 default, 1 above, 2 aside, 3 below, 4 bottom, 5 top */
     18 static const int centerwindowname   = 0;        /* 0 means window name on the left */
     19 static const char statussep         = ';';      /* separator between status bars */
     20 static const char *fonts[]          = { "monospace:size=8:antialias=true:autohint=true", "JoyPixels:pixelsize=10:antialias=true:autohint=true" };
     21 static const char dmenufont[]       = "monospace:size=10:antialias=true:autohint=true";
     22 
     23 /* color customization */
     24 static const char col_gray1[]       = "#000000";
     25 static const char col_gray2[]       = "#222222";
     26 static const char col_gray3[]       = "#ebdbb2";
     27 static const char col_gray4[]       = "#fffff7";
     28 /* static const char col_acc1[]        = "#640008"; */
     29 /* static const char col_acc2[]        = "#97111b"; */
     30 static const char col_acc1[]        = "#99010a";
     31 static const char col_acc2[]        = "#cc241d";
     32 
     33 static const char col_stat0[]       = "#000000";
     34 static const char col_stat1[]       = "#fb4934";
     35 static const char col_stat2[]       = "#98971a";
     36 static const char col_stat3[]       = "#d79921";
     37 static const char col_stat4[]       = "#458588";
     38 static const char col_stat5[]       = "#b16286";
     39 static const char col_stat6[]       = "#689d6a";
     40 static const char col_stat7[]       = "#a89984";
     41 
     42 static const char *colors[][3]      = {
     43 	/*                       fg         bg         border   */
     44 	[SchemeNorm]         = { col_gray3, col_gray1, col_gray2 },
     45 	[SchemeSel]          = { col_gray4, col_acc2,  col_acc2  },
     46 	[SchemeStatus]       = { col_gray3, col_gray1, "#000000" }, /* Status              */
     47 	[SchemeTagsNorm]     = { col_gray3, col_gray1, "#000000" }, /* Tagbar l unselected */
     48 	[SchemeTagsSel]      = { col_gray4, col_gray2, "#000000" }, /* Tagbar l selected   */
     49 	[SchemeTagLnNorm]    = { col_gray2, col_gray2, "#000000" }, /* Top Line normal     */
     50 	[SchemeTagLnOcc]     = { col_acc1,  col_acc1,  "#000000" }, /* Top Line occupied   */
     51 	[SchemeTagLnSel]     = { col_acc2,  col_acc2,  "#000000" }, /* Top Line selected   */
     52 	[SchemeInfoNorm]     = { col_gray3, col_gray1, "#000000" }, /* Infbar m unselected */
     53 	[SchemeInfoSel]      = { col_gray3, col_gray1, "#000000" }, /* Infbar m selected   */
     54 
     55 	/* Terminal colors, see drw.c for customizing @term */
     56 	[SchemeTermNorm]     = { col_gray3, col_gray1, "@term"   },
     57 	[SchemeTermSel]      = { col_gray4, col_acc2,  col_acc2  },
     58 
     59 	/* Statusbar colors */
     60 	[StatusLn]           = { col_gray2, col_gray1, "#000000" },
     61 	[StatusBlack]        = { col_stat0, col_gray1, "#000000" },
     62 	[StatusRed]          = { col_stat1, col_gray1, "#000000" },
     63 	[StatusGreen]        = { col_stat2, col_gray1, "#000000" },
     64 	[StatusYellow]       = { col_stat3, col_gray1, "#000000" },
     65 	[StatusBlue]         = { col_stat4, col_gray1, "#000000" },
     66 	[StatusMagenta]      = { col_stat5, col_gray1, "#000000" },
     67 	[StatusCyan]         = { col_stat6, col_gray1, "#000000" },
     68 	[StatusWhite]        = { col_stat7, col_gray1, "#000000" },
     69 };
     70 
     71 
     72 /* tagging */
     73 static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
     74 
     75 static const Rule rules[] = {
     76 	/* xprop(1):
     77 	 *	WM_CLASS(STRING) = instance, class
     78 	 *	WM_NAME(STRING) = title
     79 	 */
     80 	/* class              instance    title       tags mask     isfloating   isterminal   noswallow    monitor */
     81 	{ "st",               NULL,       NULL,       0 << 0,       0,           1,           0,           -1 },
     82 	{ "St",               NULL,       NULL,       0 << 0,       0,           1,           0,           -1 },
     83 	{ "Gimp",             NULL,       NULL,       1 << 8,       0,           0,           0,           -1 },
     84 	{ "Mumble",           NULL,       NULL,       1 << 8,       0,           0,           0,            1 },
     85 	{ "discord",          NULL,       NULL,       1 << 7,       0,           1,           0,           -1 },
     86 	{ "st-256color",      NULL,       NULL,       0 << 0,       0,           1,           0,           -1 },
     87 	{ "TelegramDesktop",  NULL,       NULL,       1 << 6,       0,           0,           0,           -1 },
     88 	{ "Microsoft Teams - Preview",    NULL, NULL, 1 << 0,       0,           0,           0,            1 },
     89 	{ NULL,               NULL,   "Event Tester", 0,            0,           0,           1,           -1 },
     90 };
     91 
     92 /* layout(s) */
     93 static const float mfact     = 0.50;     /* factor of master area size [0.05..0.95] */
     94 static const int nmaster     = 1;        /* number of clients in master area */
     95 static const int resizehints = 0;        /* 1 means respect size hints in tiled resizals */
     96 
     97 static const Layout layouts[] = {
     98 	/* symbol     arrange function */
     99 	{ "###",      dynamiclayout },    /* first entry is default */
    100 	{ "[]=",      tile },
    101 	{ "TTT",      bstack },
    102 	{ "===",      bstackhoriz },
    103 	{ "[M]",      monocle },
    104 	{ "|M|",      centeredmaster },
    105 	{ ">M>",      centeredfloatingmaster },
    106 	{ "><>",      NULL },    /* no layout function means floating behavior */
    107 };
    108 
    109 static const Direction directions[] = {
    110 	/* symbol     arrange function */
    111 	{ "replace",  attach },    /* first entry is default */
    112 	{ "aside",    attachaside },
    113 	{ "-^-",      attachabove },
    114 	{ "-v-",      attachbelow },
    115 	{ "vvv",      attachbottom },
    116 	{ "^^^",      attachtop },
    117 };
    118 
    119 /* key definitions */
    120 #define MODKEY Mod4Mask /* WinKey; Change to Mod1Mask if you want AltKey as Modifier */
    121 #define TAGKEYS(KEY,TAG) \
    122 	{ MODKEY,                       KEY,      view,           {.ui = 1 << TAG} }, \
    123 	{ MODKEY|ControlMask,           KEY,      toggleview,     {.ui = 1 << TAG} }, \
    124 	{ MODKEY|ShiftMask,             KEY,      tag,            {.ui = 1 << TAG} }, \
    125 	{ MODKEY|ControlMask|ShiftMask, KEY,      toggletag,      {.ui = 1 << TAG} }, \
    126 	{ MODKEY|ShiftMask|Mod1Mask,    KEY,      swaptags,       {.ui = 1 << TAG} },
    127 
    128 /* helper for spawning shell commands in the pre dwm-5.0 fashion */
    129 #define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
    130 
    131 /* commands */
    132 static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
    133 static const char *dmenucmd[] = { "dmenu_run", /* "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_acc, "-sf", col_gray4, */ NULL };
    134 static const char *termcmd[]  = { "st", NULL };
    135 
    136 #include "movestack.c"
    137 static Key keys[] = {
    138 	/* modifier                     key        function        argument */
    139 	{ MODKEY|ShiftMask,             XK_F1,     quit,           {1} }, /* restart */
    140 	{ MODKEY|ControlMask|ShiftMask, XK_F1,     quit,           {0} }, /* quit */
    141 	{ MODKEY,                       XK_F4,     spawn,          SHCMD("st -e alsamixer; kill -44 $(pidof dwmblocks)") },
    142 	{ MODKEY|ShiftMask,             XK_F4,     spawn,          SHCMD("st -e pulsemixer; kill -44 $(pidof dwmblocks)") },
    143 
    144 	{ MODKEY,                       XK_F5,     setlayout,      {.v = &layouts[0]} },
    145 	{ MODKEY|ShiftMask,             XK_F5,     setlayout,      {.v = &layouts[1]} },
    146 	{ MODKEY,                       XK_F6,     setlayout,      {.v = &layouts[2]} },
    147 	{ MODKEY|ShiftMask,             XK_F6,     setlayout,      {.v = &layouts[3]} },
    148 	{ MODKEY,                       XK_F7,     setlayout,      {.v = &layouts[4]} },
    149 	{ MODKEY|ShiftMask,             XK_F7,     setlayout,      {.v = &layouts[5]} },
    150 
    151 	{ MODKEY,                       XK_F9,     spawn,          SHCMD("dmenumount") },
    152 	{ MODKEY,                       XK_F10,    spawn,          SHCMD("dmenuumount") },
    153 	{ MODKEY,                       XK_F11,    spawn,          SHCMD("mpv --no-cache --no-osc --no-input-default-bindings --input-conf=/dev/null --title=webcam $(ls /dev/video[0,2,4,6,8] | tail -n 1)") },
    154 	{ MODKEY,                       XK_F12,    spawn,          SHCMD("sudo notifytog") },
    155 
    156 	{ MODKEY,                       XK_Insert, spawn,          SHCMD("xdotool type \"$(xclip -selection primary -o)\"") },
    157 	{ MODKEY|ShiftMask,             XK_Insert, spawn,          SHCMD("xdotool type \"$(xclip -selection clipboard -o)\"") },
    158 
    159 	{ MODKEY,                       XK_grave,  spawn,          SHCMD("dmenuunicode") },
    160 	{ MODKEY,                       XK_minus,  spawn,          SHCMD("volumectl dec") },
    161 	{ MODKEY|ShiftMask,             XK_minus,  spawn,          SHCMD("volumectl DEC") },
    162 	{ MODKEY,                       XK_equal,  spawn,          SHCMD("volumectl inc") },
    163 	{ MODKEY|ShiftMask,             XK_equal,  spawn,          SHCMD("volumectl INC") },
    164 	{ MODKEY,                       XK_BackSpace, spawn,       SHCMD("sysact") },
    165 	{ MODKEY|ShiftMask,             XK_BackSpace, spawn,       SHCMD("sysact") },
    166 
    167 	{ MODKEY,                       XK_Tab,    view,           {0} },
    168 	{ MODKEY,                       XK_q,      killclient,     {0} },
    169 	{ MODKEY,                       XK_w,      spawn,          SHCMD("$BROWSER") },
    170 	{ MODKEY|ShiftMask,             XK_w,      spawn,          SHCMD("st -e sudo nmtui") },
    171 	{ MODKEY,                       XK_e,      spawn,          SHCMD("st -e neomutt ; pkill -RTMIN+12 dwmblocks; rmdir ~/.abook") },
    172 	{ MODKEY|ShiftMask,             XK_e,      spawn,          SHCMD("st -e abook -C ~/.config/abook/abookrc --datafile ~/.config/abook/addressbook") },
    173 	{ MODKEY,                       XK_r,      reorganizetags, {0} },
    174 	{ MODKEY|ShiftMask,             XK_r,      setcfact,       {.f =  0.00} },
    175 
    176 	{ MODKEY,                       XK_t,      spawn,          SHCMD("st -e gotop") },
    177 	{ MODKEY|ShiftMask,             XK_t,      spawn,          SHCMD("st -e htop") },
    178 	{ MODKEY|ControlMask,           XK_t,      spawn,          SHCMD("st -e bpytop") },
    179 	{ MODKEY|Mod1Mask,              XK_t,      spawn,          SHCMD("st -e top") },
    180 	{ MODKEY,                       XK_y,      spawn,          SHCMD("mpvclip") },
    181 	{ MODKEY|ShiftMask,             XK_y,      spawn,          SHCMD("ytdlclip") },
    182 	{ MODKEY|ControlMask,           XK_y,      spawn,          SHCMD("youtube-viewer") },
    183 
    184 	{ MODKEY,                       XK_o,      incnmaster,     {.i = +1 } },
    185 	{ MODKEY|ShiftMask,             XK_o,      incnmaster,     {.i = -1 } },
    186 	{ MODKEY,                       XK_p,      spawn,          SHCMD("mpc toggle") },
    187 	{ MODKEY|ShiftMask,             XK_p,      spawn,          SHCMD("mpc pause ; pauseallmpv") },
    188 	{ MODKEY,                       XK_bracketleft, spawn,     SHCMD("mpc seek -10") },
    189 	{ MODKEY|ShiftMask,             XK_bracketleft, spawn,     SHCMD("mpc seek -60") },
    190 	{ MODKEY,                       XK_bracketright, spawn,    SHCMD("mpc seek +10") },
    191 	{ MODKEY|ShiftMask,             XK_bracketright, spawn,    SHCMD("mpc seek +60") },
    192 
    193 	{ MODKEY,                       XK_a,      gaptog,         {0} },
    194 	{ MODKEY|ShiftMask,             XK_a,      gaptog,         {1} },
    195 	{ MODKEY|ControlMask,           XK_a,      sbtog,          {0} },
    196 	{ MODKEY|ShiftMask,             XK_s,      spawn,          SHCMD("st -e scratch") },
    197 	{ MODKEY,                       XK_d,      spawn,          {.v = dmenucmd } },
    198 	{ MODKEY|ShiftMask,             XK_d,      spawn,          SHCMD("cd ~/.local/symlinks && st -e nvim -c DiredHere") },
    199 	{ MODKEY,                       XK_f,      togglefullscr,  {0} },
    200 
    201 	/* bits: [hk/jl], [jk/hl], [withControl] */
    202 
    203 	{ MODKEY|ShiftMask,             XK_j,      modmove,        {.i = (0 + (0 << 1) + (0 << 2))} },
    204 	{ MODKEY|ShiftMask,             XK_k,      modmove,        {.i = (0 + (0 << 1) + (1 << 2))} },
    205 	{ MODKEY|ShiftMask,             XK_h,      modmove,        {.i = (0 + (1 << 1) + (0 << 2))} },
    206 	{ MODKEY|ShiftMask,             XK_l,      modmove,        {.i = (0 + (1 << 1) + (1 << 2))} },
    207 	{ MODKEY|ControlMask,           XK_j,      modmove,        {.i = (1 + (0 << 1) + (0 << 2))} },
    208 	{ MODKEY|ControlMask,           XK_k,      modmove,        {.i = (1 + (0 << 1) + (1 << 2))} },
    209 	{ MODKEY|ControlMask,           XK_h,      modmove,        {.i = (1 + (1 << 1) + (0 << 2))} },
    210 	{ MODKEY|ControlMask,           XK_l,      modmove,        {.i = (1 + (1 << 1) + (1 << 2))} },
    211 
    212 	{ MODKEY,                       XK_j,      focusstack,     {.i = +1 } },
    213 	{ MODKEY,                       XK_k,      focusstack,     {.i = -1 } },
    214 	{ MODKEY,                       XK_h,      setmfact,       {.f = -0.05} },
    215 	{ MODKEY,                       XK_l,      setmfact,       {.f = +0.05} },
    216 	{ MODKEY|Mod1Mask,              XK_j,      focusmon,       {.i = -1 } },
    217 	{ MODKEY|Mod1Mask,              XK_k,      focusmon,       {.i = +1 } },
    218 	{ MODKEY|Mod1Mask|ShiftMask,    XK_j,      tagmon,         {.i = -1 } },
    219 	{ MODKEY|Mod1Mask|ShiftMask,    XK_k,      tagmon,         {.i = +1 } },
    220 
    221 	{ MODKEY,                       XK_semicolon,  spawn,      SHCMD("dmenize") },
    222 	{ MODKEY|ShiftMask,             XK_semicolon,  spawn,      SHCMD("dmenize") },
    223 	{ MODKEY,                       XK_apostrophe, spawn,      SHCMD("st -e bc -l") },
    224 
    225 	{ MODKEY,                       XK_Return, spawn,          {.v = termcmd } },
    226 
    227 	{ MODKEY,                       XK_z,      setattach,      {0} },
    228 	{ MODKEY|ShiftMask,             XK_z,      setattach,      {.i = -1} },
    229 	{ MODKEY,                       XK_x,      spawn,          SHCMD("st -e calcurse") },
    230 	{ MODKEY,                       XK_c,      setigappx,      {.i = +3} },
    231 	{ MODKEY,                       XK_v,      setigappx,      {.i = -3} },
    232 	{ MODKEY|ShiftMask,             XK_c,      setogappx,      {.i = +3} },
    233 	{ MODKEY|ShiftMask,             XK_v,      setogappx,      {.i = -3} },
    234 	{ MODKEY,                       XK_b,      togglebar,      {0} },
    235 	{ MODKEY|ShiftMask,             XK_b,      spawn,          SHCMD("setbg") },
    236 	{ MODKEY,                       XK_n,      spawn,          SHCMD("st -e newsboat; pkill -RTMIN+6 dwmblocks") },
    237 	{ MODKEY|ShiftMask,             XK_n,      spawn,          SHCMD("st -e nvim -c VimwikiIndex") },
    238 	{ MODKEY,                       XK_m,      spawn,          SHCMD("st -e ncmpcpp") },
    239 	{ MODKEY|ShiftMask,             XK_m,      spawn,          SHCMD("volumectl toggle") },
    240 	{ MODKEY,                       XK_comma,  spawn,          SHCMD("mpc prev") },
    241 	{ MODKEY|ShiftMask,             XK_comma,  spawn,          SHCMD("mpc seek 0%") },
    242 	{ MODKEY,                       XK_period, spawn,          SHCMD("mpc next") },
    243 	{ MODKEY|ShiftMask,             XK_period, spawn,          SHCMD("mpc repeat") },
    244 
    245 	{ MODKEY,                       XK_space,  zoom,           {0} },
    246 	{ MODKEY|ShiftMask,             XK_space,  togglefloating, {1} },
    247 	{ MODKEY|ShiftMask|ControlMask, XK_space,  togglefloating, {0} },
    248 
    249 	{ 0,                            XK_Print,  spawn,          SHCMD("maim /usr/kocotian/pix/screen/pic-full-$(date '+%y%m%d-%H%M-%S').png") },
    250 	{ ShiftMask,                    XK_Print,  spawn,          SHCMD("maimpick") },
    251 	{ MODKEY,                       XK_Print,  spawn,          SHCMD("dmenurecord") },
    252 	{ MODKEY|ShiftMask,             XK_Print,  spawn,          SHCMD("dmenurecord kill") },
    253 	{ MODKEY,                       XK_Delete, spawn,          SHCMD("dmenurecord kill") },
    254 	{ MODKEY,                       XK_Scroll_Lock, spawn,     SHCMD("killall screenkey || screenkey &") },
    255 
    256 	{ MODKEY,                       XK_0,      view,           {.ui = ~0 } },
    257 	{ MODKEY|ShiftMask,             XK_0,      tag,            {.ui = ~0 } },
    258 	TAGKEYS(                        XK_1,                      0)
    259 	TAGKEYS(                        XK_2,                      1)
    260 	TAGKEYS(                        XK_3,                      2)
    261 	TAGKEYS(                        XK_4,                      3)
    262 	TAGKEYS(                        XK_5,                      4)
    263 	TAGKEYS(                        XK_6,                      5)
    264 	TAGKEYS(                        XK_7,                      6)
    265 	TAGKEYS(                        XK_8,                      7)
    266 	TAGKEYS(                        XK_9,                      8)
    267 };
    268 
    269 /* button definitions */
    270 /* click can be ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */
    271 static Button buttons[] = {
    272 	/* click                event mask      button          function        argument */
    273 	{ ClkLtSymbol,          0,              Button1,        setlayout,      {0} },
    274 	{ ClkLtSymbol,          0,              Button3,        setlayout,      {.v = &layouts[2]} },
    275 	{ ClkWinTitle,          0,              Button2,        zoom,           {0} },
    276 	{ ClkStatusText,        0,              Button1,        sigdwmblocks,   {.i = 1} },
    277 	{ ClkStatusText,        0,              Button2,        sigdwmblocks,   {.i = 2} },
    278 	{ ClkStatusText,        0,              Button3,        sigdwmblocks,   {.i = 3} },
    279 	{ ClkClientWin,         MODKEY,         Button1,        movemouse,      {0} },
    280 	{ ClkClientWin,         MODKEY|ShiftMask, Button1,      movemouse,      {.i = 1} },
    281 	{ ClkClientWin,         MODKEY,         Button2,        togglefloating, {0} },
    282 	{ ClkClientWin,         MODKEY,         Button3,        resizemouse,    {0} },
    283 	{ ClkClientWin,         MODKEY|ShiftMask, Button3,      resizemouse,    {.i = 1} },
    284 	{ ClkTagBar,            0,              Button1,        view,           {0} },
    285 	{ ClkTagBar,            0,              Button3,        toggleview,     {0} },
    286 	{ ClkTagBar,            MODKEY,         Button1,        tag,            {0} },
    287 	{ ClkTagBar,            MODKEY,         Button3,        toggletag,      {0} },
    288 	{ ClkRootWin,           0,              Button1,        spawn,          SHCMD("st") },
    289 	{ ClkRootWin,           MODKEY,         Button1,        spawn,          { .v = dmenucmd} },
    290 	{ ClkRootWin,           0,              Button3,        spawn,          SHCMD("dmenize-rightclick") },
    291 };
    292 
    293 static void modmove(const Arg *arg)
    294 {
    295 	int f;
    296 	f = selmon->sel->isfloating;
    297 	Arg a;
    298 
    299 	if (arg->i & 1 && !f) togglefloating(0), f = 1;
    300 	/* bits: [hk/jl], [jk/hl], [withControl] */
    301 	if ((arg->i >> 1) & 1) { /* hl */
    302 		if ((arg->i >> 2) & 1) { /* l */
    303 			if (f) a.v = (arg->i & 1 ? "0x 0y 25w 0h" : "25x 0y 0w 0h"), moveresize(&a);
    304 			else a.f = +0.25, setcfact(&a);
    305 		} else { /* h */
    306 			if (f) a.v = (arg->i & 1 ? "0x 0y -25w 0h" : "-25x 0y 0w 0h"), moveresize(&a);
    307 			else a.f = -0.25, setcfact(&a);
    308 		}
    309 	} else { /* jk */
    310 		if ((arg->i >> 2) & 1) { /* k */
    311 			if (f) a.v = (arg->i & 1 ? "0x 0y 0w -25h" : "0x -25y 0w 0h"), moveresize(&a);
    312 			else a.f = -1, movestack(&a);
    313 		} else { /* j */
    314 			if (f) a.v = (arg->i & 1 ? "0x 0y 0w 25h" : "0x 25y 0w 0h"), moveresize(&a);
    315 			else a.f = +1, movestack(&a);
    316 		}
    317 	}
    318 }