dwm

personal fork of dwm (rnpnr branch)
git clone anongit@rnpnr.xyz:dwm.git
Log | Files | Refs | Feed | README | LICENSE

config.def.h (9485B)


      1 /* See LICENSE file for copyright and license details. */
      2 
      3 /* Allow use of special keys */
      4 #include <X11/XF86keysym.h>
      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 int padbar             = 2;        /* padding around bar text */
     10 static const int showbar            = 1;        /* 0 means no bar */
     11 static const int topbar             = 1;        /* 0 means bottom bar */
     12 static const unsigned int gappih    = 10;       /* horiz inner gap between windows */
     13 static const unsigned int gappiv    = 10;       /* vert inner gap between windows */
     14 static const unsigned int gappoh    = 10;       /* horiz outer gap between windows and screen edge */
     15 static const unsigned int gappov    = 10;       /* vert outer gap between windows and screen edge */
     16 static       int smartgaps          = 1;        /* 1 means no outer gap when there is only one window */
     17 static const char *fonts[]          = { "monospace:size=10" };
     18 static const char dmenufont[]       = "monospace:size=10";
     19 static const char col_gray1[]       = "#222222";
     20 static const char col_gray2[]       = "#444444";
     21 static const char col_gray3[]       = "#bbbbbb";
     22 static const char col_gray4[]       = "#eeeeee";
     23 static const char col_cyan[]        = "#005577";
     24 static const char col_black[]       = "#000000";
     25 static const char col_red[]         = "#ff0000";
     26 static const char col_yellow[]      = "#ffff00";
     27 static const char col_white[]       = "#ffffff";
     28 
     29 static const char *colors[][3]      = {
     30 	/*               fg         bg         border   */
     31 	[SchemeNorm]   = { col_gray3, col_gray1,  col_gray2 },
     32 	[SchemeSel]    = { col_gray4, col_cyan,   col_cyan },
     33 	[SchemeWarn]   = { col_black, col_yellow, col_red },
     34 	[SchemeUrgent] = { col_white, col_red,    col_red },
     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   monitor */
     46 	{ "Gimp",     NULL,       NULL,       0,            1,           -1 },
     47 	{ "Firefox",  NULL,       NULL,       1 << 8,       0,           -1 },
     48 	{ NULL,       "spterm",   NULL,	      SPTAG(0),	    1,           -1 },
     49 };
     50 
     51 /* layout(s) */
     52 static const float mfact     = 0.60; /* 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 = 1;    /* 1 means respect size hints in tiled resizals */
     55 static int fakefullscreen    = 1;
     56 
     57 /* HACK: doing this properly would make it hard to merge upstream commits */
     58 #include "gaps.c"
     59 #include "layouts.c"
     60 
     61 static const Layout layouts[] = {
     62 	/* symbol     arrange function */
     63 	{ "[]=",      tile },    /* first entry is default */
     64 	{ "[M]",      monocle },
     65 	{ "TTT",      bstack },
     66 	{ "===",      bstackhoriz },
     67 	{ "---",      horizgrid },
     68 	{ "M[]",      deck },
     69 	{ "|M|",      centeredmaster },
     70 	{ "><>",      NULL },    /* no layout function means floating behavior */
     71 	{ NULL,       NULL },    /* terminator for {next,prev}layout() */
     72 };
     73 
     74 /* key definitions */
     75 #define MODKEY Mod1Mask
     76 #define ALTKEY Mod1Mask
     77 #define SUPKEY Mod4Mask
     78 #define TAGKEYS(KEY,TAG) \
     79 	{ MODKEY,                       KEY,      view,           {.ui = 1 << TAG} }, \
     80 	{ MODKEY|ControlMask,           KEY,      toggleview,     {.ui = 1 << TAG} }, \
     81 	{ MODKEY|ShiftMask,             KEY,      tag,            {.ui = 1 << TAG} }, \
     82 	{ MODKEY|ControlMask|ShiftMask, KEY,      toggletag,      {.ui = 1 << TAG} },
     83 
     84 /* helper for spawning shell commands in the pre dwm-5.0 fashion */
     85 #define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
     86 
     87 /* commands */
     88 static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
     89 static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL };
     90 static const char *termcmd[]  = { "st", NULL };
     91 
     92 /* scratchpads */
     93 typedef struct {
     94 	const char *name;
     95 	const void *cmd;
     96 } Sp;
     97 const char *spcmd1[] = {"st", "-n", "spterm", "-g", "120x34", NULL };
     98 const char *spcmd2[] = {"st", "-n", "spcalc", "-g", "50x20", "-z", "16", "-e", "bc", "-lq", NULL };
     99 static Sp scratchpads[] = {
    100 	/* name          cmd  */
    101 	{"spterm",      spcmd1},
    102 	{"spcalc",      spcmd2},
    103 };
    104 
    105 static const Key keys[] = {
    106 	/* modifier                     key        function        argument */
    107 	{ MODKEY,                       XK_d,      spawn,          {.v = dmenucmd } },
    108 	{ MODKEY,                       XK_Return, spawn,          {.v = termcmd } },
    109 	{ MODKEY|ShiftMask,             XK_Return, togglescratch,  {.ui = 0 } },
    110 
    111 	{ MODKEY|ShiftMask,             XK_b,          togglebar,    {0} },
    112 	{ MODKEY,                       XK_j,          focusstack,   {.i = +1 } },
    113 	{ MODKEY,                       XK_k,          focusstack,   {.i = -1 } },
    114 	{ MODKEY,                       XK_i,          incnmaster,   {.i = +1 } },
    115 	{ MODKEY|ShiftMask,             XK_i,          incnmaster,   {.i = -1 } },
    116 	{ MODKEY,                       XK_h,          setmfact,     {.f = -0.01} },
    117 	{ MODKEY,                       XK_l,          setmfact,     {.f = +0.01} },
    118 	{ MODKEY,                       XK_w,          zoom,         {0} },
    119 	{ MODKEY,                       XK_Tab,        view,         {0} },
    120 	{ MODKEY|ShiftMask,             XK_c,          killclient,   {0} },
    121 
    122 	/* Layouts */
    123 	{ MODKEY,                       XK_t,      setlayout,      {.v = &layouts[0]} }, /* tiled */
    124 	{ MODKEY,                       XK_y,      setlayout,      {.v = &layouts[1]} }, /* monocole */
    125 	{ MODKEY|ShiftMask,             XK_t,      setlayout,      {.v = &layouts[2]} }, /* bstack */
    126 	{ MODKEY|ShiftMask,             XK_u,      setlayout,      {.v = &layouts[3]} }, /* bstack h */
    127 	{ MODKEY,                       XK_r,      setlayout,      {.v = &layouts[4]} }, /* horizgrid */
    128 	{ MODKEY|ShiftMask,             XK_r,      setlayout,      {.v = &layouts[5]} }, /* deck */
    129 	{ MODKEY,                       XK_u,      setlayout,      {.v = &layouts[6]} }, /* centermaster */
    130 	{ MODKEY|ShiftMask,             XK_y,      setlayout,      {.v = &layouts[7]} }, /* float */
    131 	{ MODKEY,                       XK_space,  nextlayout,     {0} },
    132 	{ MODKEY|ControlMask,           XK_space,  prevlayout,     {0} },
    133 	{ MODKEY|ShiftMask,             XK_space,  togglefloating, {0} },
    134 	{ MODKEY,                       XK_f,      togglefullscr,  {0} },
    135 	{ MODKEY|ShiftMask,             XK_f,      togglefakefull, {0} },
    136 
    137 	/* gaps */
    138 	{ MODKEY,                       XK_z,      incrgaps,       {.i = +2 } },
    139 	{ MODKEY|ShiftMask,             XK_z,      incrgaps,       {.i = -2 } },
    140 	{ MODKEY,                       XK_s,      incrigaps,      {.i = +2 } },
    141 	{ MODKEY|ShiftMask,             XK_s,      incrigaps,      {.i = -2 } },
    142 	{ MODKEY,                       XK_x,      incrogaps,      {.i = +2 } },
    143 	{ MODKEY|ShiftMask,             XK_x,      incrogaps,      {.i = -2 } },
    144 	{ SUPKEY,                       XK_0,      togglegaps,     {0} },
    145 	{ SUPKEY|ShiftMask,             XK_0,      defaultgaps,    {0} },
    146 
    147 	{ MODKEY,                       XK_0,      view,           {.ui = ~0 } },
    148 	{ MODKEY|ShiftMask,             XK_0,      tag,            {.ui = ~0 } },
    149 	{ MODKEY,                       XK_comma,  focusmon,       {.i = -1 } },
    150 	{ MODKEY,                       XK_period, focusmon,       {.i = +1 } },
    151 	{ MODKEY|ShiftMask,             XK_comma,  tagmon,         {.i = -1 } },
    152 	{ MODKEY|ShiftMask,             XK_period, tagmon,         {.i = +1 } },
    153 	TAGKEYS(                        XK_1,                      0)
    154 	TAGKEYS(                        XK_2,                      1)
    155 	TAGKEYS(                        XK_3,                      2)
    156 	TAGKEYS(                        XK_4,                      3)
    157 	TAGKEYS(                        XK_5,                      4)
    158 	TAGKEYS(                        XK_6,                      5)
    159 	TAGKEYS(                        XK_7,                      6)
    160 	TAGKEYS(                        XK_8,                      7)
    161 	TAGKEYS(                        XK_9,                      8)
    162 	{ MODKEY|ShiftMask,             XK_q,      quit,           {0} },
    163 };
    164 
    165 /* button definitions */
    166 /* click can be ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */
    167 static const Button buttons[] = {
    168 	/* click                event mask      button          function        argument */
    169 	{ ClkLtSymbol,          0,              Button1,        setlayout,      {0} },
    170 	{ ClkLtSymbol,          0,              Button3,        setlayout,      {.v = &layouts[2]} },
    171 	{ ClkWinTitle,          0,              Button2,        zoom,           {0} },
    172 	{ ClkStatusText,        0,              Button2,        spawn,          {.v = termcmd } },
    173 	{ ClkClientWin,         MODKEY,         Button1,        movemouse,      {0} },
    174 	{ ClkClientWin,         MODKEY,         Button2,        togglefloating, {0} },
    175 	{ ClkClientWin,         MODKEY,         Button3,        resizemouse,    {0} },
    176 	{ ClkTagBar,            0,              Button1,        view,           {0} },
    177 	{ ClkTagBar,            0,              Button3,        toggleview,     {0} },
    178 	{ ClkTagBar,            MODKEY,         Button1,        tag,            {0} },
    179 	{ ClkTagBar,            MODKEY,         Button3,        toggletag,      {0} },
    180 };
    181