dwm

My fork of dwm.
git clone git://git.alex.balgavy.eu/dwm.git
Log | Files | Refs | README | LICENSE

config.h (14427B)


      1 /* See LICENSE file for copyright and license details. */
      2 
      3 /* appearance */
      4 static unsigned int borderpx  = 2;        /* border pixel of windows */
      5 static unsigned int snap      = 32;       /* snap pixel */
      6 static unsigned int gappih    = 20;       /* horiz inner gap between windows */
      7 static unsigned int gappiv    = 10;       /* vert inner gap between windows */
      8 static unsigned int gappoh    = 10;       /* horiz outer gap between windows and screen edge */
      9 static unsigned int gappov    = 30;       /* vert outer gap between windows and screen edge */
     10 static int swallowfloating    = 0;        /* 1 means swallow floating windows by default */
     11 static       int smartgaps          = 0;        /* 1 means no outer gap when there is only one window */
     12 static int showbar            = 1;        /* 0 means no bar */
     13 static int topbar             = 1;        /* 0 means bottom bar */
     14 static char font[]            = "MesloLGS NF:size=10";
     15 static char dmenufont[]       = "MesloLGS NF:size=10";
     16 static const char *fonts[]          = { font,
     17                                         "Noto Color Emoji:pixelsize=14:antialias=true:autohint=true",
     18                                         "Unifont:pixelsize=14:antialias=true:autohint=true" };
     19 static char normbgcolor[]           = "#222222";
     20 static char normbordercolor[]       = "#444444";
     21 static char normfgcolor[]           = "#bbbbbb";
     22 static char selfgcolor[]            = "#eeeeee";
     23 static char selbordercolor[]        = "#005577";
     24 static char selbgcolor[]            = "#005577";
     25 static char *colors[][3] = {
     26        /*               fg           bg           border   */
     27        [SchemeNorm] = { normfgcolor, normbgcolor, normbordercolor },
     28        [SchemeSel]  = { selfgcolor,  selbgcolor,  selbordercolor  },
     29 };
     30 static const XPoint stickyicon[]    = { {0,0}, {4,0}, {4,8}, {2,6}, {0,8}, {0,0} }; /* represents the icon as an array of vertices */
     31 static const XPoint stickyiconbb    = {4,8};	/* defines the bottom right corner of the polygon's bounding box (speeds up scaling) */
     32 
     33 /* tagging */
     34 // static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
     35 static const char *tags[] = { "1", "2", "3", "4 ", "5 ", "6 ", "7 ", "8", "9 " };
     36 
     37 #define TERM "st"
     38 #define TERMCLASS "St"
     39 static const Rule rules[] = {
     40 	/* xprop(1):
     41 	 *	WM_CLASS(STRING) = instance, class
     42 	 *	WM_NAME(STRING) = title
     43 	 *
     44 	 * tags: tag 1 is 000000001 (1st from the right), tag 9 is 100000000, etc. https://dwm.suckless.org/customisation/tagmask/
     45 	 *       tag 0 is the currently selected tag.
     46 	 */
     47 	/* class,                     instance,         title,                    tags,    isfloating,  isterminal,  noswallow,  monitor */
     48 	{ "Gimp",                     NULL,             NULL,                     0,       0,           0,           0,          -1 },
     49 	{ TERMCLASS,                  NULL,             NULL,                     0,       0,           1,           0,          -1 },
     50         { "Desktop-session-exit.py",  NULL,             NULL,                     0,       1,           0,           0,          -1 },
     51 	{ NULL,                       NULL,             "Event Tester",           0,       0,           0,           1,          -1 },
     52         { "Brave-browser",            "brave-browser",  NULL,                     1 << 8,  0,           0,           0,          -1 },
     53         { "Dragon-drag-and-drop",     NULL,             NULL,                     0,       1,           0,           1,          -1 },
     54         { "ripdrag",                  NULL,             NULL,                     0,       1,           0,           1,          -1 },
     55         { "Signal",                   "signal",         "Signal",                 1 << 7,  0,           0,           0,          -1 },
     56         { "thunderbird",              NULL,             NULL,                     1 << 4,  0,           0,           0,          -1 },
     57         { "thunderbird",              "Calendar",       "Reminder",               0,       1,           0,           0,          -1 },
     58         { "Mattermost",               NULL,             NULL,                     1 << 5,  0,           0,           0,          -1 },
     59         { "KeePassXC",                "keepassxc",      "Passwords",              1 << 6,  0,           0,           0,          -1 },
     60         { "KeePassXC",                "keepassxc",      "KeePassXC",              1 << 6,  0,           0,           0,          -1 },
     61         { "KeePassXC",                "keepassxc",      "Auto-Type - KeePassXC",  0,       1,           0,           0,          -1 },
     62         { "Spotify",                  NULL,             NULL,                     1 << 3,  0,           0,           1,          -1 },
     63 };
     64 
     65 /* layout(s) */
     66 static const float mfact     = 0.50; /* factor of master area size [0.05..0.95] */
     67 static int nmaster     = 1;    /* number of clients in master area */
     68 static int resizehints = 1;    /* 1 means respect size hints in tiled resizals */
     69 static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */
     70 
     71 #define FORCE_VSPLIT 1  /* nrowgrid layout: force two clients to always split vertically */
     72 #include "vanitygaps.c"
     73 
     74 static const Layout layouts[] = {
     75         /* symbol     arrange function */
     76         { "[]=",      tile },    /* first entry is default */
     77         { "[M]",      monocle },
     78         { "[@]",      spiral },
     79         { "[\\]",     dwindle },
     80         { "H[]",      deck },
     81         { "TTT",      bstack },
     82         { "===",      bstackhoriz },
     83         { "HHH",      grid },
     84         { "###",      nrowgrid },
     85         { "---",      horizgrid },
     86         { ":::",      gaplessgrid },
     87         { "|M|",      centeredmaster },
     88         { ">M>",      centeredfloatingmaster },
     89         { "><>",      NULL },    /* no layout function means floating behavior */
     90         { NULL,       NULL },
     91 };
     92 
     93 /* key definitions */
     94 #define MODKEY Mod4Mask
     95 #define TAGKEYS(KEY,TAG) \
     96         { MODKEY,                       KEY,      view,           {.ui = 1 << TAG} }, \
     97         { MODKEY|ControlMask,           KEY,      toggleview,     {.ui = 1 << TAG} }, \
     98         { MODKEY|ShiftMask,             KEY,      tag,            {.ui = 1 << TAG} }, \
     99         { MODKEY|ControlMask|ShiftMask, KEY,      toggletag,      {.ui = 1 << TAG} },
    100 #define STACKKEYS(MOD,ACTION) \
    101         { MOD,  XK_j,   ACTION##stack,  {.i = INC(+1) } }, \
    102         { MOD,  XK_k,   ACTION##stack,  {.i = INC(-1) } }, \
    103         { MOD,  XK_v,   ACTION##stack,  {.i = 0 } }
    104 
    105 /* helper for spawning shell commands in the pre dwm-5.0 fashion */
    106 #define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
    107 
    108 #define STATUSBAR "dwmblocks"
    109 
    110 /* commands */
    111 static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
    112 static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", normbgcolor, "-nf", normfgcolor, "-sb", selbordercolor, "-sf", selfgcolor, NULL };
    113 static const char *termcmd[]  = { TERM, NULL };
    114 static const char scratchpadname[] = "scratchpad";
    115 static const char *scratchpadcmd[] = { "st", "-t", scratchpadname, "-g", "120x34", NULL };
    116 
    117 /*
    118  * Xresources preferences to load at startup
    119  */
    120 ResourcePref resources[] = {
    121 		{ "color8",		STRING,	&normbordercolor },
    122 		{ "color4",		STRING,	&selbordercolor },
    123 		{ "color0",		STRING,	&normbgcolor },
    124 		{ "color4",		STRING,	&normfgcolor },
    125 		{ "color0",		STRING,	&selfgcolor },
    126 		{ "color4",		STRING,	&selbgcolor },
    127 		{ "borderpx",		INTEGER, &borderpx },
    128 		{ "snap",		INTEGER, &snap },
    129 		{ "showbar",		INTEGER, &showbar },
    130 		{ "topbar",		INTEGER, &topbar },
    131 		{ "nmaster",		INTEGER, &nmaster },
    132 		{ "resizehints",	INTEGER, &resizehints },
    133 		{ "mfact",		FLOAT,	&mfact },
    134 		{ "gappih",		INTEGER, &gappih },
    135 		{ "gappiv",		INTEGER, &gappiv },
    136 		{ "gappoh",		INTEGER, &gappoh },
    137 		{ "gappov",		INTEGER, &gappov },
    138 		{ "swallowfloating",	INTEGER, &swallowfloating },
    139 		{ "smartgaps",		INTEGER, &smartgaps }
    140 };
    141 
    142 static Key keys[] = {
    143         /* modifier                     key        function        argument */
    144         STACKKEYS(MODKEY,                          focus),
    145         STACKKEYS(MODKEY|ShiftMask,                push),
    146         { MODKEY,                       XK_r,      spawn,          {.v = dmenucmd } },
    147 	{ MODKEY|ShiftMask,		XK_r,	   livereload_xresources,	   {.v = NULL } },
    148         { MODKEY,                       XK_Return, spawn,          {.v = termcmd } },
    149         { MODKEY|ShiftMask,             XK_minus,  togglescratch,  {.v = scratchpadcmd } },
    150         { MODKEY,                       XK_b,      togglebar,      {0} },
    151         { MODKEY,                       XK_i,      incnmaster,     {.i = +1 } },
    152         { MODKEY,                       XK_d,      incnmaster,     {.i = -1 } },
    153         { Mod1Mask|ShiftMask,           XK_h,      setmfact,       {.f = -0.05} },
    154         { Mod1Mask|ShiftMask,           XK_l,      setmfact,       {.f = +0.05} },
    155         { Mod1Mask|ShiftMask,           XK_equal,  setmfact,       {.f = mfact+1} },
    156         { MODKEY|ShiftMask,             XK_Return, zoom,           {0} },
    157         { MODKEY|Mod1Mask,              XK_u,      incrgaps,       {.i = +1 } },
    158         { MODKEY|Mod1Mask|ShiftMask,    XK_u,      incrgaps,       {.i = -1 } },
    159         { MODKEY|Mod1Mask,              XK_i,      incrigaps,      {.i = +1 } },
    160         { MODKEY|Mod1Mask|ShiftMask,    XK_i,      incrigaps,      {.i = -1 } },
    161         { MODKEY|Mod1Mask,              XK_o,      incrogaps,      {.i = +1 } },
    162         { MODKEY|Mod1Mask|ShiftMask,    XK_o,      incrogaps,      {.i = -1 } },
    163         { MODKEY|Mod1Mask,              XK_6,      incrihgaps,     {.i = +1 } },
    164         { MODKEY|Mod1Mask|ShiftMask,    XK_6,      incrihgaps,     {.i = -1 } },
    165         { MODKEY|Mod1Mask,              XK_7,      incrivgaps,     {.i = +1 } },
    166         { MODKEY|Mod1Mask|ShiftMask,    XK_7,      incrivgaps,     {.i = -1 } },
    167         { MODKEY|Mod1Mask,              XK_8,      incrohgaps,     {.i = +1 } },
    168         { MODKEY|Mod1Mask|ShiftMask,    XK_8,      incrohgaps,     {.i = -1 } },
    169         { MODKEY|Mod1Mask,              XK_9,      incrovgaps,     {.i = +1 } },
    170         { MODKEY|Mod1Mask|ShiftMask,    XK_9,      incrovgaps,     {.i = -1 } },
    171         { MODKEY|Mod1Mask,              XK_0,      togglegaps,     {0} },
    172         { MODKEY|Mod1Mask|ShiftMask,    XK_0,      defaultgaps,    {0} },
    173         { MODKEY,                       XK_Tab,    view,           {0} },
    174         { MODKEY|ShiftMask,             XK_c,      killclient,     {0} },
    175         { MODKEY,                       XK_t,      setlayout,      {.v = &layouts[0]} }, // tile
    176         { MODKEY,                       XK_f,      setlayout,      {.v = &layouts[1]} }, // monocle
    177         { MODKEY|ShiftMask,             XK_f,      togglefullscr,  {0} },
    178         { MODKEY|ControlMask,           XK_f,      togglefakefullscreen, {0} },
    179         { MODKEY,                       XK_m,      setlayout,      {.v = &layouts[2]} }, // spiral
    180         { MODKEY,                       XK_s,      setlayout,      {.v = &layouts[5]} }, // bstack
    181         { MODKEY,                       XK_space,  setlayout,      {0} },
    182         { MODKEY|ShiftMask,             XK_space,  togglefloating, {0} },
    183         { MODKEY|ShiftMask,             XK_s,      togglesticky,   {0} },
    184         { MODKEY,                       XK_0,      view,           {.ui = ~0 } },
    185         { MODKEY|ShiftMask,             XK_0,      jumptotag,      {0} },
    186         { MODKEY,                       XK_comma,  focusmon,       {.i = -1 } },
    187         { MODKEY,                       XK_period, focusmon,       {.i = +1 } },
    188         { MODKEY|ShiftMask,             XK_comma,  tagmon,         {.i = -1 } },
    189         { MODKEY|ShiftMask,             XK_period, tagmon,         {.i = +1 } },
    190         { Mod1Mask|ShiftMask,           XK_q,      quit,           {0} },
    191         TAGKEYS(                        XK_1,                      0)
    192         TAGKEYS(                        XK_2,                      1)
    193         TAGKEYS(                        XK_3,                      2)
    194         TAGKEYS(                        XK_4,                      3)
    195         TAGKEYS(                        XK_5,                      4)
    196         TAGKEYS(                        XK_6,                      5)
    197         TAGKEYS(                        XK_7,                      6)
    198         TAGKEYS(                        XK_8,                      7)
    199         TAGKEYS(                        XK_9,                      8)
    200 };
    201 
    202 /* button definitions */
    203 /* click can be ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */
    204 static Button buttons[] = {
    205         /* click                event mask      button          function        argument */
    206         { ClkLtSymbol,          0,              Button1,        setlayout,      {0} },
    207         { ClkLtSymbol,          0,              Button3,        setlayout,      {.v = &layouts[2]} },
    208         { ClkLtSymbol,          0,              Button4,        focusstack,     {.i = INC(-1) } },
    209         { ClkLtSymbol,          0,              Button5,        focusstack,     {.i = INC(+1) } },
    210         { ClkWinTitle,          0,              Button2,        zoom,           {0} },
    211         { ClkStatusText,        0,              Button1,        sigstatusbar,   {.i = 1 } },
    212         { ClkStatusText,        0,              Button2,        sigstatusbar,   {.i = 2 } },
    213         { ClkStatusText,        0,              Button3,        sigstatusbar,   {.i = 3 } },
    214         { ClkStatusText,        0,              Button4,        sigstatusbar,   {.i = 4 } },
    215         { ClkStatusText,        0,              Button5,        sigstatusbar,   {.i = 5 } },
    216         { ClkStatusText,        ShiftMask,      Button1,        sigstatusbar,   {.i = 6} },
    217         { ClkStatusText,        ShiftMask,      Button3,        spawn,          SHCMD(TERM " -e vim ~/Repos/dwmblocks/blocks.h") },
    218         { ClkClientWin,         MODKEY,         Button1,        movemouse,      {0} },
    219         { ClkClientWin,         MODKEY,         Button2,        togglefloating, {0} },
    220         { ClkClientWin,         MODKEY,         Button3,        resizemouse,    {0} },
    221         { ClkTagBar,            0,              Button1,        view,           {0} },
    222         { ClkTagBar,            0,              Button3,        toggleview,     {0} },
    223         { ClkTagBar,            MODKEY,         Button1,        tag,            {0} },
    224         { ClkTagBar,            MODKEY,         Button3,        toggletag,      {0} },
    225 };
    226