dwm-old

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

config.def.h (19483B)


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