dwm

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

config.h (14917B)


      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         { "Brave-browser",           NULL,            "Outlook (PWA)",         1 << 4, 0,          0,          0,         -1 },
     54         { "Brave-browser",           NULL,            "Microsoft Teams",       1 << 5, 0,          0,          0,         -1 },
     55         { "Dragon-drag-and-drop",    NULL,            NULL,                    0,      1,          0,          1,         -1 },
     56         { "ripdrag",                 NULL,            NULL,                    0,      1,          0,          1,         -1 },
     57         { "Signal",                  "signal",        "Signal",                1 << 7, 0,          0,          0,         -1 },
     58         { "thunderbird",             NULL,            NULL,                    1 << 4, 0,          0,          0,         -1 },
     59         { "thunderbird",             "Calendar",      "Reminder",              0,      1,          0,          0,         -1 },
     60         { "thunderbird",             "Thunderbird",   "Edit Repeating Event",  0,      1,          0,          0,         -1 },
     61         { "Mattermost",              NULL,            NULL,                    1 << 5, 0,          0,          0,         -1 },
     62         { "KeePassXC",               "keepassxc",     "Passwords",             1 << 6, 0,          0,          0,         -1 },
     63         { "KeePassXC",               "keepassxc",     "KeePassXC",             1 << 6, 0,          0,          0,         -1 },
     64         { "KeePassXC",               "keepassxc",     "Auto-Type - KeePassXC", 0,      1,          0,          0,         -1 },
     65         { "KeePassXC",               "keepassxc",     "Unlock Database - KeePassXC",       0,      1,          0,          0,         -1 },
     66         { "Spotify",                 NULL,            NULL,                    1 << 3, 0,          0,          1,         -1 },
     67 };
     68 
     69 /* layout(s) */
     70 static const float mfact     = 0.50; /* factor of master area size [0.05..0.95] */
     71 static int nmaster     = 1;    /* number of clients in master area */
     72 static int resizehints = 1;    /* 1 means respect size hints in tiled resizals */
     73 static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */
     74 
     75 #define FORCE_VSPLIT 1  /* nrowgrid layout: force two clients to always split vertically */
     76 #include "vanitygaps.c"
     77 
     78 static const Layout layouts[] = {
     79         /* symbol     arrange function */
     80         { "[]=",      tile },    /* first entry is default */
     81         { "[M]",      monocle },
     82         { "[@]",      spiral },
     83         { "[\\]",     dwindle },
     84         { "H[]",      deck },
     85         { "TTT",      bstack },
     86         { "===",      bstackhoriz },
     87         { "HHH",      grid },
     88         { "###",      nrowgrid },
     89         { "---",      horizgrid },
     90         { ":::",      gaplessgrid },
     91         { "|M|",      centeredmaster },
     92         { ">M>",      centeredfloatingmaster },
     93         { "><>",      NULL },    /* no layout function means floating behavior */
     94         { NULL,       NULL },
     95 };
     96 
     97 /* key definitions */
     98 #define MODKEY Mod4Mask
     99 #define TAGKEYS(KEY,TAG) \
    100         { MODKEY,                       KEY,      view,           {.ui = 1 << TAG} }, \
    101         { MODKEY|ControlMask,           KEY,      toggleview,     {.ui = 1 << TAG} }, \
    102         { MODKEY|ShiftMask,             KEY,      tag,            {.ui = 1 << TAG} }, \
    103         { MODKEY|ControlMask|ShiftMask, KEY,      toggletag,      {.ui = 1 << TAG} },
    104 #define STACKKEYS(MOD,ACTION) \
    105         { MOD,  XK_j,   ACTION##stack,  {.i = INC(+1) } }, \
    106         { MOD,  XK_k,   ACTION##stack,  {.i = INC(-1) } }, \
    107         { MOD,  XK_v,   ACTION##stack,  {.i = 0 } }
    108 
    109 /* helper for spawning shell commands in the pre dwm-5.0 fashion */
    110 #define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
    111 
    112 #define STATUSBAR "dwmblocks"
    113 
    114 /* commands */
    115 static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
    116 static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", normbgcolor, "-nf", normfgcolor, "-sb", selbordercolor, "-sf", selfgcolor, NULL };
    117 static const char *termcmd[]  = { TERM, NULL };
    118 static const char scratchpadname[] = "scratchpad";
    119 static const char *scratchpadcmd[] = { "st", "-t", scratchpadname, "-g", "120x34", NULL };
    120 
    121 /*
    122  * Xresources preferences to load at startup
    123  */
    124 ResourcePref resources[] = {
    125 		{ "color8",		STRING,	&normbordercolor },
    126 		{ "color4",		STRING,	&selbordercolor },
    127 		{ "color0",		STRING,	&normbgcolor },
    128 		{ "color4",		STRING,	&normfgcolor },
    129 		{ "color0",		STRING,	&selfgcolor },
    130 		{ "color4",		STRING,	&selbgcolor },
    131 		{ "borderpx",		INTEGER, &borderpx },
    132 		{ "snap",		INTEGER, &snap },
    133 		{ "showbar",		INTEGER, &showbar },
    134 		{ "topbar",		INTEGER, &topbar },
    135 		{ "nmaster",		INTEGER, &nmaster },
    136 		{ "resizehints",	INTEGER, &resizehints },
    137 		{ "mfact",		FLOAT,	&mfact },
    138 		{ "gappih",		INTEGER, &gappih },
    139 		{ "gappiv",		INTEGER, &gappiv },
    140 		{ "gappoh",		INTEGER, &gappoh },
    141 		{ "gappov",		INTEGER, &gappov },
    142 		{ "swallowfloating",	INTEGER, &swallowfloating },
    143 		{ "smartgaps",		INTEGER, &smartgaps }
    144 };
    145 
    146 static Key keys[] = {
    147         /* modifier                     key        function        argument */
    148         STACKKEYS(MODKEY,                          focus),
    149         STACKKEYS(MODKEY|ShiftMask,                push),
    150         { MODKEY,                       XK_r,      spawn,          {.v = dmenucmd } },
    151 	{ MODKEY|ShiftMask,		XK_r,	   livereload_xresources,	   {.v = NULL } },
    152         { MODKEY,                       XK_Return, spawn,          {.v = termcmd } },
    153         { MODKEY|ShiftMask,             XK_minus,  togglescratch,  {.v = scratchpadcmd } },
    154         { MODKEY|ShiftMask|ControlMask,    XK_minus, toggletagscratch, {0} },
    155         { MODKEY,                       XK_b,      togglebar,      {0} },
    156         { MODKEY,                       XK_i,      incnmaster,     {.i = +1 } },
    157         { MODKEY,                       XK_d,      incnmaster,     {.i = -1 } },
    158         { Mod1Mask|ShiftMask,           XK_h,      setmfact,       {.f = -0.05} },
    159         { Mod1Mask|ShiftMask,           XK_l,      setmfact,       {.f = +0.05} },
    160         { Mod1Mask|ShiftMask,           XK_equal,  setmfact,       {.f = mfact+1} },
    161         { MODKEY|ShiftMask,             XK_Return, zoom,           {0} },
    162         { MODKEY|Mod1Mask,              XK_u,      incrgaps,       {.i = +1 } },
    163         { MODKEY|Mod1Mask|ShiftMask,    XK_u,      incrgaps,       {.i = -1 } },
    164         { MODKEY|Mod1Mask,              XK_i,      incrigaps,      {.i = +1 } },
    165         { MODKEY|Mod1Mask|ShiftMask,    XK_i,      incrigaps,      {.i = -1 } },
    166         { MODKEY|Mod1Mask,              XK_o,      incrogaps,      {.i = +1 } },
    167         { MODKEY|Mod1Mask|ShiftMask,    XK_o,      incrogaps,      {.i = -1 } },
    168         { MODKEY|Mod1Mask,              XK_6,      incrihgaps,     {.i = +1 } },
    169         { MODKEY|Mod1Mask|ShiftMask,    XK_6,      incrihgaps,     {.i = -1 } },
    170         { MODKEY|Mod1Mask,              XK_7,      incrivgaps,     {.i = +1 } },
    171         { MODKEY|Mod1Mask|ShiftMask,    XK_7,      incrivgaps,     {.i = -1 } },
    172         { MODKEY|Mod1Mask,              XK_8,      incrohgaps,     {.i = +1 } },
    173         { MODKEY|Mod1Mask|ShiftMask,    XK_8,      incrohgaps,     {.i = -1 } },
    174         { MODKEY|Mod1Mask,              XK_9,      incrovgaps,     {.i = +1 } },
    175         { MODKEY|Mod1Mask|ShiftMask,    XK_9,      incrovgaps,     {.i = -1 } },
    176         { MODKEY|Mod1Mask,              XK_0,      togglegaps,     {0} },
    177         { MODKEY|Mod1Mask|ShiftMask,    XK_0,      defaultgaps,    {0} },
    178         { MODKEY,                       XK_Tab,    view,           {0} },
    179         { MODKEY|ShiftMask,             XK_c,      killclient,     {0} },
    180         { MODKEY,                       XK_t,      setlayout,      {.v = &layouts[0]} }, // tile
    181         { MODKEY,                       XK_f,      setlayout,      {.v = &layouts[1]} }, // monocle
    182         { MODKEY|ShiftMask,             XK_f,      togglefullscr,  {0} },
    183         { MODKEY|ControlMask,           XK_f,      togglefakefullscreen, {0} },
    184         { MODKEY,                       XK_m,      setlayout,      {.v = &layouts[2]} }, // spiral
    185         { MODKEY,                       XK_s,      setlayout,      {.v = &layouts[5]} }, // bstack
    186         { MODKEY,                       XK_space,  setlayout,      {0} },
    187         { MODKEY|ShiftMask,             XK_space,  togglefloating, {0} },
    188         { MODKEY|ShiftMask,             XK_s,      togglesticky,   {0} },
    189         { MODKEY,                       XK_0,      view,           {.ui = ~0 } },
    190         { MODKEY|ShiftMask,             XK_0,      jumptotag,      {0} },
    191         { MODKEY,                       XK_comma,  focusmon,       {.i = -1 } },
    192         { MODKEY,                       XK_period, focusmon,       {.i = +1 } },
    193         { MODKEY|ShiftMask,             XK_comma,  tagmon,         {.i = -1 } },
    194         { MODKEY|ShiftMask,             XK_period, tagmon,         {.i = +1 } },
    195         { Mod1Mask|ShiftMask,           XK_q,      quit,           {0} },
    196         TAGKEYS(                        XK_1,                      0)
    197         TAGKEYS(                        XK_2,                      1)
    198         TAGKEYS(                        XK_3,                      2)
    199         TAGKEYS(                        XK_4,                      3)
    200         TAGKEYS(                        XK_5,                      4)
    201         TAGKEYS(                        XK_6,                      5)
    202         TAGKEYS(                        XK_7,                      6)
    203         TAGKEYS(                        XK_8,                      7)
    204         TAGKEYS(                        XK_9,                      8)
    205 };
    206 
    207 /* button definitions */
    208 /* click can be ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */
    209 static Button buttons[] = {
    210         /* click                event mask      button          function        argument */
    211         { ClkLtSymbol,          0,              Button1,        setlayout,      {0} },
    212         { ClkLtSymbol,          0,              Button3,        setlayout,      {.v = &layouts[2]} },
    213         { ClkLtSymbol,          0,              Button4,        focusstack,     {.i = INC(-1) } },
    214         { ClkLtSymbol,          0,              Button5,        focusstack,     {.i = INC(+1) } },
    215         { ClkWinTitle,          0,              Button2,        zoom,           {0} },
    216         { ClkStatusText,        0,              Button1,        sigstatusbar,   {.i = 1 } },
    217         { ClkStatusText,        0,              Button2,        sigstatusbar,   {.i = 2 } },
    218         { ClkStatusText,        0,              Button3,        sigstatusbar,   {.i = 3 } },
    219         { ClkStatusText,        0,              Button4,        sigstatusbar,   {.i = 4 } },
    220         { ClkStatusText,        0,              Button5,        sigstatusbar,   {.i = 5 } },
    221         { ClkStatusText,        ShiftMask,      Button1,        sigstatusbar,   {.i = 6} },
    222         { ClkStatusText,        ShiftMask,      Button3,        spawn,          SHCMD(TERM " -e vim ~/Repos/dwmblocks/blocks.h") },
    223         { ClkClientWin,         MODKEY,         Button1,        movemouse,      {0} },
    224         { ClkClientWin,         MODKEY,         Button2,        togglefloating, {0} },
    225         { ClkClientWin,         MODKEY,         Button3,        resizemouse,    {0} },
    226         { ClkTagBar,            0,              Button1,        view,           {0} },
    227         { ClkTagBar,            0,              Button3,        toggleview,     {0} },
    228         { ClkTagBar,            MODKEY,         Button1,        tag,            {0} },
    229         { ClkTagBar,            MODKEY,         Button3,        toggletag,      {0} },
    230 };
    231