dwm

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

config.h (13601B)


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