dwm

fork of dwm
git clone git://popovic.xyz/dwm.git
Log | Files | Refs | README | LICENSE

config.def.h (14023B)


      1 /* See LICENSE file for copyright and license details. */
      2 
      3 #define TERMINAL "st"
      4 #define TERMCLASS "St"
      5 
      6 #define SESSION_FILE "/tmp/dwm-session"
      7 
      8 /* appearance */
      9 static unsigned int borderpx  = 4;        /* border pixel of windows */
     10 static unsigned int snap      = 32;       /* snap pixel */
     11 static const unsigned int gappih    = 10;       /* horiz inner gap between windows */
     12 static const unsigned int gappiv    = 10;       /* vert inner gap between windows */
     13 static const unsigned int gappoh    = 10;       /* horiz outer gap between windows and screen edge */
     14 static const unsigned int gappov    = 10;       /* vert outer gap between windows and screen edge */
     15 static       int smartgaps          = 0;        /* 1 means no outer gap when there is only one window */
     16 static const int swallowfloating    = 0;        /* 1 means swallow floating windows by default */
     17 static int showbar            = 1;        /* 0 means no bar */
     18 static int topbar             = 1;        /* 0 means bottom bar */
     19 static char font0[] = "terminus:size=20";
     20 static char font1[] = "Noto Color Emoji:size=18";
     21 static const char *fonts[]            = { font1 , font0 };
     22 static char dmenufont[] = "terminus:size=20";
     23 
     24 static char normfgcolor[]       = "#ffffff";
     25 static char normbgcolor[]       = "#000000";
     26 static char normbordercolor[]   = "#263238";
     27 static char selfgcolor[]        = "#000000";
     28 static char selbgcolor[]        = "#bcbcbc";
     29 static char selbordercolor[]    = "#A96C8A";
     30 static const unsigned int baralpha = 0;
     31 static const unsigned int borderalpha = 10000;
     32 static char *colors[][3]        = {
     33 	/*               fg         bg         border   */
     34 	[SchemeNorm] = { normfgcolor, normbgcolor, normbordercolor },
     35 	[SchemeSel]  = { selfgcolor, selbgcolor,  selbordercolor },
     36 };
     37 static unsigned int alphas[][3]      = {
     38     /*               fg      bg        border*/
     39     [SchemeNorm] = { OPAQUE, 150, 125 },
     40 	[SchemeSel]  = { OPAQUE, 150, 125 },
     41 };
     42 
     43 /* tagging */
     44 static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
     45 
     46 static const Rule rules[] = {
     47 	/* xprop(1):
     48 	 *	WM_CLASS(STRING) = instance, class
     49 	 *	WM_NAME(STRING) = title
     50 	 */
     51 	/* class     instance  title           tags mask  isfloating  isterminal  noswallow  monitor */
     52 	{ "Gimp",    NULL,     NULL,           0,         1,          0,           0,        -1 },
     53 	{ "Firefox", NULL,     NULL,           0,         1,          0,           0,        -1 },
     54 	{ "Zathura", NULL,     NULL,           0,         0,          0,          -1,        -1 },
     55 	{ "St",      NULL,     NULL,           0,         0,          1,           0,        -1 },
     56 	{ NULL,      NULL,     "Event Tester", 0,         0,          0,           1,        -1 }, /* xev */
     57 };
     58 
     59 /* layout(s) */
     60 static float mfact     = 0.55; /* factor of master area size [0.05..0.95] */
     61 static int nmaster     = 1;    /* number of clients in master area */
     62 static int resizehints = 1;    /* 1 means respect size hints in tiled resizals */
     63 
     64 #define FORCE_VSPLIT 1  /* nrowgrid layout: force two clients to always split vertically */
     65 #include "vanitygaps.c"
     66 
     67 static const Layout layouts[] = {
     68 	/* symbol     arrange function */
     69 	{ "[]=",      tile },    /* first entry is default */
     70 	{ "[M]",      monocle },
     71 	{ "[@]",      spiral },
     72 	{ "[\\]",     dwindle },
     73 	{ "H[]",      deck },
     74 	{ "TTT",      bstack },
     75 	{ "===",      bstackhoriz },
     76 	{ "HHH",      grid },
     77 	{ "###",      nrowgrid },
     78 	{ "---",      horizgrid },
     79 	{ ":::",      gaplessgrid },
     80 	{ "|M|",      centeredmaster },
     81 	{ ">M>",      centeredfloatingmaster },
     82 	{ "><>",      NULL },    /* no layout function means floating behavior */
     83 	{ NULL,       NULL },
     84 };
     85 
     86 /*
     87  * Xresources preferences to load at startup
     88  */
     89 ResourcePref resources[] = {
     90         { "font0",              STRING,  &font0},
     91         { "font1",              STRING,  &font1},
     92         { "dmenufont",          STRING,  &dmenufont},
     93 		{ "normbgcolor",        STRING,  &normbgcolor },
     94 		{ "normbordercolor",    STRING,  &normbordercolor },
     95 		{ "normfgcolor",        STRING,  &normfgcolor },
     96 		{ "selbgcolor",         STRING,  &selbgcolor },
     97 		{ "selbordercolor",     STRING,  &selbordercolor },
     98 		{ "selfgcolor",         STRING,  &selfgcolor },
     99 		{ "borderpx",          	INTEGER, &borderpx },
    100 		{ "snap",          		INTEGER, &snap },
    101 		{ "showbar",          	INTEGER, &showbar },
    102 		{ "topbar",          	INTEGER, &topbar },
    103 		{ "nmaster",          	INTEGER, &nmaster },
    104 		{ "resizehints",       	INTEGER, &resizehints },
    105 		{ "baralpha",       	INTEGER, &alphas[SchemeSel][1] },
    106 		{ "borderalpha",       	INTEGER, &alphas[SchemeSel][2] },
    107 		{ "baralpha",       	INTEGER, &alphas[SchemeNorm][1] },
    108 		{ "borderalpha",       	INTEGER, &alphas[SchemeNorm][2] },
    109 		{ "mfact",      	 	FLOAT,   &mfact },
    110 };
    111 
    112 
    113 /* key definitions */
    114 #define MODKEY Mod4Mask
    115 #define TAGKEYS(KEY,TAG) \
    116 	{ MODKEY,                       KEY,      view,           {.ui = 1 << TAG} }, \
    117 	{ MODKEY|ControlMask,           KEY,      toggleview,     {.ui = 1 << TAG} }, \
    118 	{ MODKEY|ShiftMask,             KEY,      tag,            {.ui = 1 << TAG} }, \
    119 	{ MODKEY|ControlMask|ShiftMask, KEY,      toggletag,      {.ui = 1 << TAG} },
    120 #define STACKKEYS(MOD,ACTION) \
    121 	{ MOD, XK_j,     ACTION##stack, {.i = INC(+1) } }, \
    122 	{ MOD, XK_k,     ACTION##stack, {.i = INC(-1) } }, \
    123 	{ MOD, XK_grave, ACTION##stack, {.i = PREVSEL } }, \
    124 	{ MOD, XK_q,     ACTION##stack, {.i = 0 } }, \
    125 	{ MOD, XK_a,     ACTION##stack, {.i = 1 } }, \
    126 	{ MOD, XK_z,     ACTION##stack, {.i = 2 } }, \
    127 	{ MOD, XK_x,     ACTION##stack, {.i = -1 } },
    128 
    129 /* helper for spawning shell commands in the pre dwm-5.0 fashion */
    130 #define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
    131 
    132 /* commands */
    133 static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
    134 static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, NULL };
    135 static const char *termcmd[]  = { "st", NULL };
    136 static const char scratchpadname[] = "scratchpad";
    137 static const char *scratchpadcmd[] = { "st", "-t", scratchpadname, "-g", "120x34", NULL };
    138 
    139 /* commands spawned when clicking statusbar, the mouse button pressed is exported as BUTTON */
    140 static char *statuscmds[] = { "notify-send Mouse$BUTTON" };
    141 static char *statuscmd[] = { "/bin/sh", "-c", NULL, NULL };
    142 
    143 
    144 static Key keys[] = {
    145 	/* modifier                     key        function        argument */
    146 	STACKKEYS(MODKEY,                          focus)
    147 	STACKKEYS(MODKEY|ShiftMask,                push)
    148 	{ MODKEY,                       XK_Return,      spawn,          {.v = termcmd }},
    149 	{ MODKEY,                       XK_grave,       togglescratch,  {.v = scratchpadcmd } },
    150 	{ MODKEY,                       XK_d,           spawn,          SHCMD("dmenu_run")},
    151 	{ ControlMask,                  XK_space,       spawn,          SHCMD("dunstctl close")},
    152 	{ ControlMask,                  XK_grave,       spawn,          SHCMD("dunstctl close-all")},
    153 	{ MODKEY,                       XK_p,           spawn,          SHCMD("passmenu-otp")},
    154 	{ MODKEY|ShiftMask,             XK_b,           spawn,          SHCMD("nautilus")},
    155 	{ MODKEY,                       XK_b,           spawn,          SHCMD("dmenu-bluetooth")},
    156 	{ MODKEY,                       XK_n,           spawn,          SHCMD(TERMINAL " -e newsboat")},
    157 	{ MODKEY,                       XK_c,           spawn,          SHCMD("firefox")},
    158 	{ MODKEY|ShiftMask,             XK_p,           spawn,          SHCMD("pavucontrol")},
    159 	{ MODKEY|ShiftMask,             XK_c,           spawn,          SHCMD(TERMINAL " -e calcurse")},
    160 	{ MODKEY,                       XK_m,           spawn,          SHCMD("TZ=Europe/Berlin " TERMINAL " -e  neomutt")},
    161 	{ MODKEY|ShiftMask,             XK_w,           spawn,          SHCMD(TERMINAL " -e sudo nmtui")},
    162 	{ MODKEY,                       XK_w,           spawn,          SHCMD("xdotool key Super_L+9 && spotify-launcher")},
    163     { ShiftMask,                    XK_Shift_R,     spawn,          SHCMD("pkill -RTMIN+11 dwmblocks")},
    164 	{ MODKEY,                       XK_F1,          spawn,          SHCMD("pkill -RTMIN+8 dwmblocks ; toggle volume")},
    165 	{ MODKEY,                       XK_F2,          spawn,          SHCMD("pkill -RTMIN+8 dwmblocks ; volume down 5")},
    166 	{ MODKEY,                       XK_F3,          spawn,          SHCMD("pkill -RTMIN+8 dwmblocks ; volume up 5")},
    167 /*  { MODKEY,                       XK_F4,          spawn,          SHCMD("pkill -RTMIN+8 dwmblocks ; toggle sink")}, */
    168 	{ MODKEY,                       XK_F4,          spawn,          SHCMD("sudo xbacklight -dec 1")},
    169 	{ MODKEY,                       XK_F5,          spawn,          SHCMD("sudo xbacklight -inc 1")},
    170 	{ MODKEY|Mod1Mask,              XK_l,           spawn,          SHCMD("slock")},
    171 	{ MODKEY|ShiftMask,             XK_z,           togglebar,      {0}},
    172 	{ MODKEY|Mod1Mask,              XK_i,           incnmaster,     {.i = +1 }},
    173 	{ MODKEY|Mod1Mask,              XK_d,           incnmaster,     {.i = -1 }},
    174 	{ MODKEY,                       XK_comma,       setmfact,       {.f = -0.05}},
    175     { MODKEY,                       XK_period,      setmfact,       {.f = +0.05}},
    176 	{ MODKEY|ShiftMask,             XK_f,           zoom,           {0} },
    177 	{ MODKEY|Mod1Mask,              XK_k,           incrgaps,       {.i = +1 }},
    178 	{ MODKEY|Mod1Mask,              XK_j,           incrgaps,       {.i = -1 }},
    179 	{ MODKEY|Mod1Mask,              XK_i,           incrigaps,      {.i = +1 }},
    180 	{ MODKEY|Mod1Mask|ShiftMask,    XK_i,           incrigaps,      {.i = -1 }},
    181 	{ MODKEY|Mod1Mask,              XK_o,           incrogaps,      {.i = +1 }},
    182 	{ MODKEY|Mod1Mask|ShiftMask,    XK_o,           incrogaps,      {.i = -1 }},
    183 	{ MODKEY|Mod1Mask,              XK_6,           incrihgaps,     {.i = +1 }},
    184 	{ MODKEY|Mod1Mask|ShiftMask,    XK_6,           incrihgaps,     {.i = -1 }},
    185 	{ MODKEY|Mod1Mask,              XK_7,           incrivgaps,     {.i = +1 }},
    186 	{ MODKEY|Mod1Mask|ShiftMask,    XK_7,           incrivgaps,     {.i = -1 }},
    187 	{ MODKEY|Mod1Mask,              XK_8,           incrohgaps,     {.i = +1 }},
    188 	{ MODKEY|Mod1Mask|ShiftMask,    XK_8,           incrohgaps,     {.i = -1 }},
    189 	{ MODKEY|Mod1Mask,              XK_9,           incrovgaps,     {.i = +1 }},
    190 	{ MODKEY|Mod1Mask|ShiftMask,    XK_9,           incrovgaps,     {.i = -1 }},
    191 	{ MODKEY|Mod1Mask,              XK_0,           togglegaps,     {0} },
    192 	{ MODKEY|Mod1Mask|ShiftMask,    XK_0,           defaultgaps,    {0} },
    193 	{ MODKEY|ShiftMask,             XK_q,           killclient,     {0} },
    194 	{ MODKEY,                       XK_F9,          setlayout,      {.v = &layouts[0]}},
    195 	{ MODKEY,                       XK_F10,         setlayout,      {.v = &layouts[7]}},
    196 	{ MODKEY,                       XK_F11,         setlayout,      {.v = &layouts[9]}},
    197 	{ MODKEY,                       XK_F12,         setlayout,      {.v = &layouts[11]}},
    198 	{ MODKEY,                       XK_Tab,         view,           {0} },
    199 	{ MODKEY,                       XK_space,       setlayout,      {0} },
    200 	{ MODKEY|ShiftMask,             XK_space,       togglefloating, {0} },
    201 	{ MODKEY,                       XK_f,           togglefullscr,  {0} },
    202 	{ MODKEY,                       XK_0,           view,           {.ui = ~0 } },
    203 	{ MODKEY|ShiftMask,             XK_0,           tag,            {.ui = ~0 } },
    204 	{ MODKEY,                       XK_l,           focusmon,       {.i = -1 } },
    205 	{ MODKEY,                       XK_h,           focusmon,       {.i = +1 } },
    206 	{ MODKEY|ShiftMask,             XK_l,           tagmon,         {.i = -1 } },
    207 	{ MODKEY|ShiftMask,             XK_h,           tagmon,         {.i = +1 } },
    208 	TAGKEYS(                        XK_1,           0)
    209 	TAGKEYS(                        XK_2,           1)
    210 	TAGKEYS(                        XK_3,           2)
    211 	TAGKEYS(                        XK_4,           3)
    212 	TAGKEYS(                        XK_5,           4)
    213 	TAGKEYS(                        XK_6,           5)
    214 	TAGKEYS(                        XK_7,           6)
    215 	TAGKEYS(                        XK_8,           7)
    216 	TAGKEYS(                        XK_9,           8)
    217 //	{ MODKEY|ShiftMask,             XK_r,           quit,           {0}},
    218 	{ MODKEY|ShiftMask,             XK_r,           quit,           {1} },
    219 	{ MODKEY|ShiftMask,             XK_e,           spawn,          SHCMD("killall xinit")},
    220 };
    221 
    222 /* button definitions */
    223 /* click can be ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */
    224 static Button buttons[] = {
    225 	/* click                event mask      button          function        argument */
    226 	{ ClkLtSymbol,          0,              Button1,        setlayout,      {0} },
    227 	{ ClkLtSymbol,          0,              Button3,        setlayout,      {.v = &layouts[13]} },
    228 	{ ClkWinTitle,          0,              Button2,        zoom,           {0} },
    229 	{ ClkStatusText,        0,              Button1,        sigdwmblocks,   {.i = 1} },
    230 	{ ClkStatusText,        0,              Button2,        sigdwmblocks,   {.i = 2} },
    231 	{ ClkStatusText,        0,              Button3,        sigdwmblocks,   {.i = 3} },
    232 	{ ClkStatusText,        0,              Button4,        sigdwmblocks,   {.i = 4} },
    233 	{ ClkStatusText,        0,              Button5,        sigdwmblocks,   {.i = 5} },
    234 	{ ClkStatusText,        ShiftMask,      Button1,        sigdwmblocks,   {.i = 6} },
    235 	{ ClkStatusText,        ShiftMask,      Button3,        spawn,          SHCMD(TERMINAL " -e nvim ~/.local/src/dwmblocks/config.h") },
    236 	{ ClkClientWin,         MODKEY,         Button1,        movemouse,      {0} },
    237 	{ ClkClientWin,         MODKEY,         Button2,        togglefloating, {0} },
    238 	{ ClkClientWin,         MODKEY,         Button3,        resizemouse,    {0} },
    239 	{ ClkTagBar,            0,              Button1,        view,           {0} },
    240 	{ ClkTagBar,            0,              Button3,        toggleview,     {0} },
    241 	{ ClkTagBar,            MODKEY,         Button1,        tag,            {0} },
    242 	{ ClkTagBar,            MODKEY,         Button3,        toggletag,      {0} },
    243 };
    244