dwm

Mahdi's build of dwm
git clone git://mahdi.pw/dwm.git
Log | Files | Refs | README | LICENSE

config.h (15312B)


      1 /* See LICENSE file for copyright and license details. */
      2 
      3 /* Load essentials */
      4 #include <X11/XF86keysym.h>             /* For XF86 multimedia binds */
      5 
      6 /* appearance */
      7 static const char *fonts[]              = {
      8 	"JetBrainsMono Nerd Font:size=9",
      9 	"Vazirmatn:size=9",
     10 	"Noto Sans Mono CJK JP:size=9",
     11 	"Noto Sans Mono CJK KR:size=9",
     12 	"Noto Sans Mono CJK HK:size=9",
     13 	"Noto Sans Mono CJK SC:size=9",
     14 	"Noto Sans Mono CJK TC:size=9",
     15 	"Noto Color Emoji:size=9"
     16 };
     17 static const unsigned int borderpx      = 2;	/* border pixel of windows */
     18 static const unsigned int snap          = 32;   /* snap pixel */
     19 static const int showbar                = 1;    /* 0 means no bar */
     20 static const int topbar                 = 1;    /* 0 means bottom bar */
     21 static const int barheight              = 3;	/* Spacing around the bar's font */
     22 static const int hidevacanttags         = 0;    /* 1 means hide empty tags / 0: show every tag */
     23 static const int showtitle              = 0;    /* 1 means show WM_NAME of the currently selected window */
     24 static const int truecenteredtitle      = 0;    /* 1 means center the WM_NAME on the status bar */
     25 static char fgcolor[]                   = "#D8DEE9";
     26 static char bgcolor[]                   = "#2E3440";
     27 static char color0[]                    = "#3B4252";
     28 static char color1[]                    = "#BF616A";
     29 static char color2[]                    = "#A3BE8C";
     30 static char color3[]                    = "#EBCB8B";
     31 static char color4[]                    = "#81A1C1";
     32 static char color5[]                    = "#B48EAD";
     33 static char color6[]                    = "#88C0D0";
     34 static char color7[]                    = "#E5E9F0";
     35 static char color8[]                    = "#4C566A";
     36 static char color9[]                    = "#BF616A";
     37 static char color10[]                   = "#A3BE8C";
     38 static char color11[]                   = "#EBCB8B";
     39 static char color12[]                   = "#81A1C1";
     40 static char color13[]                   = "#B48EAD";
     41 static char color14[]                   = "#8FBCBB";
     42 static char color15[]                   = "#ECEFF4";
     43 
     44 /* Underline active tags (only works if hidevacanttags == 0) */
     45 static const unsigned int ulinepad	= 5;	/* horizontal padding between the underline and tag */
     46 static const unsigned int ulinestroke	= 1;	/* thickness / height of the underline */
     47 static const unsigned int ulinevoffset	= 2;	/* how far above the bottom of the bar the line should appear */
     48 
     49 /*
     50  * Xresources preferences to load at startup
     51  */
     52 ResourcePref resources[] = {
     53 	{ "foreground",		STRING, &fgcolor},
     54 	{ "background",		STRING, &bgcolor},
     55 	{ "color0",		STRING, &color0},
     56 	{ "color1",		STRING, &color1},
     57 	{ "color2",		STRING, &color2},
     58 	{ "color3",		STRING, &color3},
     59 	{ "color4",		STRING, &color4},
     60 	{ "color5",		STRING, &color5},
     61 	{ "color6",		STRING, &color6},
     62 	{ "color7",		STRING, &color7},
     63 	{ "color8",		STRING, &color8},
     64 	{ "color9",		STRING, &color9},
     65 	{ "color10",		STRING, &color10},
     66 	{ "color11",		STRING, &color11},
     67 	{ "color12",		STRING, &color12},
     68 	{ "color13",		STRING, &color13},
     69 	{ "color14",		STRING, &color14},
     70 	{ "color15",		STRING, &color15},
     71 };
     72 
     73 static const char *colors[][3]          = {
     74         /*                  fg          bg         border   */
     75         [SchemeNorm]    = { color7,     color0,    color0  },
     76         [SchemeSel]     = { color0,     color7,    color7  },
     77         [SchemeLayout]  = { color7,     color0,    color0  },
     78 };
     79 
     80 /* tagging */
     81 static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
     82 
     83 static const Rule rules[] = {
     84 	/* xprop(1):
     85 	 *	WM_CLASS(STRING) = instance, class
     86 	 *	WM_NAME(STRING) = title
     87 	 */
     88 	/* class        instance    title           tags mask   isfloating  monitor */
     89 	//{ "mpv",        NULL,       NULL,           0,          1,          -1 },
     90 	//{ "Gimp",       NULL,       NULL,           0,          1,          -1 },
     91 	//{ "Firefox",    NULL,       NULL,           1 << 8,     0,          -1 },
     92         { "st-float",   NULL,       NULL,           0,          1,          -1 },
     93         { NULL,		"st-float", NULL,           0,          1,          -1 },
     94 	{ NULL,         NULL,       "Event Tester", 0,          0,          -1 }, /* xev */
     95 };
     96 
     97 /* layout(s) */
     98 static const float mfact        = 0.5; 	/* factor of master area size [0.05..0.95] */
     99 static const int nmaster        = 1;    /* number of clients in master area */
    100 static const int resizehints    = 0;    /* 1 means respect size hints in tiled resizals */
    101 static const int lockfullscreen = 1; 	/* 1 will force focus on the fullscreen window */
    102 static int layouts_default      = 0;    /* Default layout */
    103 static const int layouts_floating   = 2;/* Layout number for floating mode */
    104 
    105 static const Layout layouts[] = {
    106 	/* symbol       arrange function */
    107         { "[]=",     tile },    /* first entry is default */
    108         { "[M]",     monocle },
    109         { "><>",     NULL },    /* no layout function means floating behavior */
    110         { NULL,      NULL },
    111 };
    112 
    113 /* key definitions */
    114 #define MODKEY Mod4Mask
    115 #define ALTMOD Mod1Mask
    116 #define TAGKEYS(KEY,TAG) \
    117 	{ MODKEY,                       KEY,      view,           {.ui = 1 << TAG} }, \
    118 	{ MODKEY|ControlMask,           KEY,      toggleview,     {.ui = 1 << TAG} }, \
    119 	{ MODKEY|ShiftMask,             KEY,      tag,            {.ui = 1 << TAG} }, \
    120 	{ MODKEY|ControlMask|ShiftMask, KEY,      toggletag,      {.ui = 1 << TAG} }, \
    121 	{ ALTMOD,                       KEY,      focusnthmon,    {.i  = TAG } }, \
    122 	{ ALTMOD|ShiftMask,             KEY,      tagnthmon,      {.i  = TAG } },
    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 const char *dmenucmd[] = { "dmenu_run", "-i", "-p", "Run:", NULL };
    129 //static const char *termcmd[]  = { "st", NULL };
    130 //static const char *termcmdfloat[]  = { "st", "-c", "st-float", NULL };
    131 static const char *termcmd[]  = { "tabbed", "-cd", "-r", "2", "st", "-w", "''", NULL };
    132 static const char *termcmdfloat[]  = { "tabbed", "-cd", "-n", "st-float", "-r", "2", "st", "-w", "''", NULL };
    133 
    134 static const Key keys[] = {
    135 	/* modifier                     key         function        argument */
    136 	{ MODKEY,                       XK_a,       spawn,          SHCMD("dmenu_drun") },
    137 	{ MODKEY,                       XK_c,       spawn,          {.v = dmenucmd } },
    138 	{ MODKEY,                       XK_Return,  spawn,          {.v = termcmd } },
    139 	{ MODKEY|ShiftMask,             XK_Return,  spawn,          SHCMD("konsole") },
    140 	//{ MODKEY|ShiftMask,             XK_Return,  spawn,          {.v = termcmdfloat } },
    141 	{ MODKEY,                       XK_b,       togglebar,      {0} },
    142 	{ MODKEY,                       XK_j,       focusstack,     {.i = +1 } },
    143 	{ MODKEY,                       XK_k,       focusstack,     {.i = -1 } },
    144 	{ MODKEY,                       XK_i,       incnmaster,     {.i = +1 } },
    145 	{ MODKEY,                       XK_d,       incnmaster,     {.i = -1 } },
    146 	{ MODKEY,                       XK_h,       setmfact,       {.f = -0.05} },
    147 	{ MODKEY,                       XK_l,       setmfact,       {.f = +0.05} },
    148 	{ MODKEY|ShiftMask,             XK_j,       movestack,      {.i = +1 } },
    149 	{ MODKEY|ShiftMask,             XK_k,       movestack,      {.i = -1 } },
    150 	{ MODKEY,                       XK_space,   zoom,           {0} },
    151 	{ MODKEY,                       XK_Tab,     view,           {0} },
    152 	{ MODKEY,                       XK_t,       setlayout,      {.v = &layouts[0]} },
    153 	{ MODKEY,                       XK_m,       setlayout,      {.v = &layouts[1]} },
    154 	{ MODKEY,                       XK_f,       setlayout,      {.v = &layouts[2]} },
    155 	{ MODKEY|ControlMask,           XK_comma,   cyclelayout,    {.i = -1 } },
    156 	{ MODKEY|ControlMask,           XK_period,  cyclelayout,    {.i = +1 } },
    157 	{ MODKEY|ShiftMask,             XK_space,   togglefloating, {0} },
    158 	{ MODKEY|ShiftMask,             XK_f,       togglefullscr,  {0} },
    159 	{ MODKEY,                       XK_s,       togglesticky,   {0} },
    160 	{ MODKEY,                       XK_0,       view,           {.ui = ~0 } },
    161 	{ MODKEY|ShiftMask,             XK_0,       tag,            {.ui = ~0 } },
    162 	{ MODKEY,                       XK_comma,   focusmon,       {.i = -1 } },
    163 	{ MODKEY,                       XK_period,  focusmon,       {.i = +1 } },
    164 	{ MODKEY|ShiftMask,             XK_comma,   tagmon,         {.i = -1 } },
    165 	{ MODKEY|ShiftMask,             XK_period,  tagmon,         {.i = +1 } },
    166 	{ MODKEY|ShiftMask,             XK_h,       shiftview,      {.i = -1 } },
    167 	{ MODKEY|ShiftMask,             XK_l,       shiftview,      {.i = +1 } },
    168 	TAGKEYS(                        XK_1,                       0)
    169 	TAGKEYS(                        XK_2,                       1)
    170 	TAGKEYS(                        XK_3,                       2)
    171 	TAGKEYS(                        XK_4,                       3)
    172 	TAGKEYS(                        XK_5,                       4)
    173 	TAGKEYS(                        XK_6,                       5)
    174 	TAGKEYS(                        XK_7,                       6)
    175 	TAGKEYS(                        XK_8,                       7)
    176 	TAGKEYS(                        XK_9,                       8)
    177 	{ MODKEY,                       XK_F5,      live_reload_xresources,{0} },
    178 	{ MODKEY|ShiftMask,             XK_r,       restart,        {0} },
    179 	{ MODKEY,			XK_q,       killclient,     {0} },
    180 	{ MODKEY|ControlMask,           XK_q,       quit,           {0} },
    181 	{ MODKEY|ShiftMask,             XK_b,       spawn,          SHCMD("dwm-bar -M") },
    182 	{ MODKEY|ShiftMask,             XK_q,       spawn,          SHCMD("dmenu-power") },
    183 	{ MODKEY,                       XK_r,       spawn,          SHCMD("dmenu-record") },
    184 	{ MODKEY,                       XK_w,       spawn,          SHCMD("surf-open") },
    185 	{ MODKEY|ControlMask,           XK_w,       spawn,          SHCMD("surf") },
    186 	{ MODKEY|ShiftMask,             XK_e,       spawn,          SHCMD("st -e sh -c \"mutt\"") },
    187 	{ MODKEY|ShiftMask,             XK_m,       spawn,          SHCMD("dmenu-man") },
    188 	{ MODKEY|ShiftMask,             XK_w,       spawn,          SHCMD("st -c \"st-float\" -g \"100x20\" -e sh -c \"SET_BG_SELECT=1 bg-set\"") },
    189 	{ MODKEY|ShiftMask,             XK_u,       spawn,          SHCMD("st -c \"st-float\" -g \"100x28\" -e sh -c \"doas pacman -Syu --noconfirm && rm ~/.cache/pkg_updates\"") },
    190 	{ MODKEY|ShiftMask,             XK_t,       spawn,          SHCMD("theme-sel -s") },
    191 	{ MODKEY|ShiftMask,             XK_g,       spawn,          SHCMD("gtt") },
    192 	{ MODKEY|ShiftMask,             XK_y,       spawn,          SHCMD("myt -d") },
    193 	{ MODKEY|ControlMask,           XK_l,       spawn,          SHCMD("slock") },
    194 	{ MODKEY,                       XK_grave,   spawn,          SHCMD("dmenu-emoji insert") },
    195 	{ MODKEY|ControlMask,           XK_grave,   spawn,          SHCMD("dmenu-emoji clipboard") },
    196 	{ 0,                            XK_Print,   spawn,          SHCMD("screenshot -xc") },
    197 	{ ShiftMask,                    XK_Print,   spawn,          SHCMD("screenshot -xc -t 5") },
    198 	{ ControlMask,                  XK_Print,   spawn,          SHCMD("screenshot -xc -s yes") },
    199 	{ ControlMask|ShiftMask,        XK_Print,   spawn,          SHCMD("screenshot -xc -s yes -t 5") },
    200 
    201 	{ MODKEY,			XK_F11,     spawn,          SHCMD("bright -nd") },
    202 	{ MODKEY,			XK_F12,     spawn,          SHCMD("bright -ni") },
    203 
    204 	{ 0,            XF86XK_WebCam,              spawn,          SHCMD("webcam") },
    205 	{ 0,            XF86XK_TouchpadToggle,      spawn,          SHCMD("toggle-touch") },
    206 	{ 0,            XF86XK_TouchpadOn,          spawn,          SHCMD("toggle-touch") },
    207 	{ 0,            XF86XK_TouchpadOff,         spawn,          SHCMD("toggle-touch") },
    208 	{ 0,            XF86XK_AudioPlay,           spawn,          SHCMD("media-controller toggle") },
    209 	{ 0,            XF86XK_AudioPause,          spawn,          SHCMD("media-controller toggle") },
    210 	{ 0,            XF86XK_AudioNext,           spawn,          SHCMD("media-controller next") },
    211 	{ 0,            XF86XK_AudioPrev,           spawn,          SHCMD("media-controller prev") },
    212 	{ ShiftMask,    XF86XK_AudioPlay,           spawn,          SHCMD("media-controller pause-all") },
    213 	{ ShiftMask,    XF86XK_AudioPause,          spawn,          SHCMD("media-controller pause-all") },
    214 	{ ShiftMask,    XF86XK_AudioNext,           spawn,          SHCMD("media-controller seek-fwd") },
    215 	{ ShiftMask,    XF86XK_AudioPrev,           spawn,          SHCMD("media-controller seek-bwd") },
    216 	{ 0,            XF86XK_MonBrightnessUp,     spawn,          SHCMD("bright -ni") },
    217 	{ 0,            XF86XK_MonBrightnessDown,   spawn,          SHCMD("bright -nd") },
    218 	{ 0,            XF86XK_AudioRaiseVolume,    spawn,          SHCMD("snd -ni") },
    219 	{ 0,            XF86XK_AudioLowerVolume,    spawn,          SHCMD("snd -nd") },
    220 	{ 0,		XF86XK_AudioMute,           spawn,          SHCMD("snd -nm") },
    221 	{ ShiftMask,	XF86XK_AudioRaiseVolume,    spawn,          SHCMD("snd -nI") },
    222 	{ ShiftMask,	XF86XK_AudioLowerVolume,    spawn,          SHCMD("snd -nD") },
    223 	{ ShiftMask,	XF86XK_AudioMute,           spawn,          SHCMD("snd -nM") },
    224 	{ 0,		XF86XK_AudioMicMute,        spawn,          SHCMD("snd -nM") },
    225 };
    226 
    227 /* button definitions */
    228 /* click can be ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */
    229 static const Button buttons[] = {
    230 	/* click                event mask      button          function        argument */
    231 	/* placemouse options, choose which feels more natural:
    232 	 *    0 - tiled position is relative to mouse cursor
    233 	 *    1 - tiled postiion is relative to window center
    234 	 *    2 - mouse pointer warps to window center
    235 	 *
    236 	 * The moveorplace uses movemouse or placemouse depending on the floating state
    237 	 * of the selected client. Set up individual keybindings for the two if you want
    238 	 * to control these separately (i.e. to retain the feature to move a tiled window
    239 	 * into a floating position).
    240 	 */
    241 	{ ClkClientWin,         MODKEY,         Button1,        moveorplace,    {.i = 1} },
    242 	{ ClkClientWin,         MODKEY,         Button3,        resizemouse,    {0} },
    243 	{ ClkClientWin,         MODKEY,         Button2,        togglefloating, {0} },
    244 	{ ClkTagBar,            0,              Button1,        view,           {0} },
    245 	{ ClkTagBar,            0,              Button3,        toggleview,     {0} },
    246 	{ ClkTagBar,            MODKEY,         Button1,        tag,            {0} },
    247 	{ ClkTagBar,            MODKEY,         Button3,        toggletag,      {0} },
    248 	{ ClkTagBar,            0,              Button4,        shiftview,      {.i = -1} },
    249 	{ ClkTagBar,            0,              Button5,        shiftview,      {.i = +1} },
    250 	{ ClkLtSymbol,          0,              Button1,        cyclelayout,    {.i = +1} },
    251 	{ ClkLtSymbol,          0,              Button3,        cyclelayout,    {.i = -1} },
    252 	{ ClkLtSymbol,          0,              Button2,        setlayout,      {.v = &layouts[0]} },
    253 	{ ClkLtSymbol,          0,              Button4,        cyclelayout,    {.i = -1} },
    254 	{ ClkLtSymbol,          0,              Button5,        cyclelayout,    {.i = +1} },
    255 	{ ClkWinTitle,          0,              Button2,        togglesticky,   {0} },
    256 	{ ClkStatusText,        0,              Button3,        spawn,          SHCMD("dwm-bar -M") },
    257 };
    258