dwm

My fork of https://dwm.suckless.org/
git clone https://git.inz.fi/dwm/
Log | Files | Refs | README | LICENSE

config.h (9349B)


      1 /* See LICENSE file for copyright and license details. */
      2 
      3 #include <X11/XF86keysym.h>
      4 
      5 /* appearance */
      6 static const unsigned int borderpx  = 1;        /* border pixel of windows */
      7 static const unsigned int snap      = 32;       /* snap pixel */
      8 static const unsigned int systraypinning = 0;   /* 0: sloppy systray follows selected monitor, >0: pin systray to monitor X */
      9 static const unsigned int systrayonleft = 0;   	/* 0: systray in the right corner, >0: systray on left of status text */
     10 static const unsigned int systrayspacing = 2;   /* systray spacing */
     11 static const int systraypinningfailfirst = 1;   /* 1: if pinning fails, display systray on the first monitor, False: display systray on the last monitor*/
     12 static const int showsystray        = 1;     /* 0 means no systray */
     13 static const int showbar            = 1;     /* 0 means no bar */
     14 static const int topbar             = 1;     /* 0 means bottom bar */
     15 static const char *fonts[]          = { "Nova Mono:size=9",
     16 					"FontAwesome:size=9" };
     17 static const char dmenufont[]       = "Nova Mono:size=9";
     18 static const char col_gray1[]       = "#0c0c0c";
     19 static const char col_gray2[]       = "#171717";
     20 static const char col_gray3[]       = "#212121";
     21 static const char col_gray4[]       = "#999999";
     22 static const char col_green[]       = "#c6f24b";
     23 static const char *colors[][3]      = {
     24 	/*               fg         bg         border   */
     25 	[SchemeNorm] = { col_gray4, col_gray1, col_gray2 },
     26 	[SchemeSel]  = { col_green, col_gray3, col_green },
     27 };
     28 
     29 static const char *barcolors[] = {
     30 	"#000000",
     31 	"#7f0000",
     32 	"#007f00",
     33 	"#7f7f00",
     34 	"#00007f",
     35 	"#7f007f",
     36 	"#007f7f",
     37 	"#cccccc",
     38 	"#333333",
     39 	"#ff0000",
     40 	"#00ff00",
     41 	"#ffff00",
     42 	"#0000ff",
     43 	"#ff00ff",
     44 	"#00ffff",
     45 	"#ffffff",
     46 };
     47 
     48 /* tagging */
     49 static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
     50 
     51 static const Rule rules[] = {
     52 	/* xprop(1):
     53 	 *	WM_CLASS(STRING) = instance, class
     54 	 *	WM_NAME(STRING) = title
     55 	 */
     56 	/* class      instance    title       tags mask     isfloating   monitor */
     57 	{ "Gimp",     NULL,       NULL,       0,            1,           -1 },
     58 	{ "Thunderbird", NULL,    NULL,       1 << 7,       0,           -1 },
     59 	{ "Firefox",  NULL,       NULL,       1 << 8,       0,           -1 },
     60 	{ "Pale moon", NULL,      NULL,       1 << 8,       0,           -1 },
     61 	{ "Pentadactyl", NULL,    NULL,       1 << 8,       0,           -1 },
     62 };
     63 
     64 /* layout(s) */
     65 static const float mfact     = 0.55; /* factor of master area size [0.05..0.95] */
     66 static const int nmaster     = 1;    /* number of clients in master area */
     67 static const int resizehints = 1;    /* 1 means respect size hints in tiled resizals */
     68 static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */
     69 
     70 static const Layout layouts[] = {
     71 	/* symbol     arrange function */
     72 	{ "[]=",      tile },    /* first entry is default */
     73 	{ "><>",      NULL },    /* no layout function means floating behavior */
     74 	{ "[M]",      monocle },
     75 };
     76 
     77 /* key definitions */
     78 #define MODKEY Mod4Mask
     79 #define TAGKEYS(KEY,TAG) \
     80 	{ MODKEY,                       KEY,      view,           {.ui = 1 << TAG} }, \
     81 	{ MODKEY|ControlMask,           KEY,      toggleview,     {.ui = 1 << TAG} }, \
     82 	{ MODKEY|ShiftMask,             KEY,      tag,            {.ui = 1 << TAG} }, \
     83 	{ MODKEY|ControlMask|ShiftMask, KEY,      toggletag,      {.ui = 1 << TAG} },
     84 
     85 /* helper for spawning shell commands in the pre dwm-5.0 fashion */
     86 #define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
     87 
     88 /* commands */
     89 static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
     90 static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray4, "-sb", col_gray3, "-sf", col_green, NULL };
     91 static const char *termcmd[]  = { "st", NULL };
     92 
     93 static const char *volumedown[] = { "pactl", "set-sink-volume", "@DEFAULT_SINK@", "-2%", NULL };
     94 static const char *volumeup[] = { "pactl", "set-sink-volume", "@DEFAULT_SINK@", "+2%", NULL };
     95 static const char *mute[] = { "pactl", "set-sink-mute", "@DEFAULT_SINK@", "toggle", NULL };
     96 static const char *brightnessup[] = { "brightness_adjust", "+", NULL };
     97 static const char *brightnessdown[] = { "brightness_adjust", "-", NULL };
     98 
     99 #define MPRIS2(x, y) static const char *mpris_##x[] = { "playerctl", #y, NULL }
    100 #define MPRIS(x) MPRIS2(x, x)
    101 MPRIS(previous);
    102 MPRIS(play);
    103 MPRIS(pause);
    104 MPRIS(stop);
    105 MPRIS(next);
    106 MPRIS2(play_pause, play-pause);
    107 
    108 static Key keys[] = {
    109 	/* modifier                     key        function        argument */
    110 	{ MODKEY,                       XK_p,      spawn,          {.v = dmenucmd } },
    111 	{ MODKEY|ShiftMask,             XK_Return, spawn,          {.v = termcmd } },
    112 	{ MODKEY|ShiftMask,             XK_b,      togglebar,      {0} },
    113 	{ MODKEY,                       XK_j,      focusstack,     {.i = +1 } },
    114 	{ MODKEY,                       XK_k,      focusstack,     {.i = -1 } },
    115 	{ MODKEY,                       XK_i,      incnmaster,     {.i = +1 } },
    116 	{ MODKEY,                       XK_d,      incnmaster,     {.i = -1 } },
    117 	{ MODKEY,                       XK_h,      setmfact,       {.f = -0.05} },
    118 	{ MODKEY,                       XK_l,      setmfact,       {.f = +0.05} },
    119 	{ MODKEY,                       XK_Return, zoom,           {0} },
    120 	{ MODKEY,                       XK_Tab,    view,           {0} },
    121 	{ MODKEY|ShiftMask,             XK_c,      killclient,     {0} },
    122 	{ MODKEY,                       XK_t,      setlayout,      {.v = &layouts[0]} },
    123 	{ MODKEY,                       XK_f,      setlayout,      {.v = &layouts[1]} },
    124 	{ MODKEY,                       XK_m,      setlayout,      {.v = &layouts[2]} },
    125 	{ MODKEY,                       XK_space,  setlayout,      {0} },
    126 	{ MODKEY|ShiftMask,             XK_space,  togglefloating, {0} },
    127 //	{ MODKEY,                       XK_0,      view,           {.ui = ~0 } },
    128 	{ MODKEY|ShiftMask,             XK_0,      tag,            {.ui = ~0 } },
    129 	{ MODKEY,                       XK_comma,  focusmon,       {.i = -1 } },
    130 	{ MODKEY,                       XK_period, focusmon,       {.i = +1 } },
    131 	{ MODKEY|ShiftMask,             XK_comma,  tagmon,         {.i = -1 } },
    132 	{ MODKEY|ShiftMask,             XK_period, tagmon,         {.i = +1 } },
    133 	TAGKEYS(                        XK_1,                      0)
    134 	TAGKEYS(                        XK_2,                      1)
    135 	TAGKEYS(                        XK_3,                      2)
    136 	TAGKEYS(                        XK_4,                      3)
    137 	TAGKEYS(                        XK_5,                      4)
    138 	TAGKEYS(                        XK_6,                      5)
    139 	TAGKEYS(                        XK_7,                      6)
    140 	TAGKEYS(                        XK_8,                      7)
    141 	TAGKEYS(                        XK_9,                      8)
    142 	{ MODKEY|ShiftMask,             XK_q,      quit,           {0} },
    143 	{ 0,				XF86XK_AudioLowerVolume,
    144 	                                           spawn,          {.v = volumedown } },
    145 	{ 0,				XF86XK_AudioRaiseVolume,
    146 	                                           spawn,          {.v = volumeup } },
    147 	{ 0,				XF86XK_AudioMute,
    148 	                                           spawn,          {.v = mute } },
    149 	{ 0,				XF86XK_AudioPlay,
    150 						   spawn,	   {.v = mpris_play_pause } },
    151 	{ 0,				XF86XK_AudioStop,
    152 						   spawn,	   {.v = mpris_stop } },
    153 	{ 0,				XF86XK_AudioNext,
    154 						   spawn,	   {.v = mpris_next } },
    155 	{ 0,				XF86XK_AudioPrev,
    156 						   spawn,	   {.v = mpris_previous } },
    157 	{ 0,				XF86XK_MonBrightnessUp,
    158 						   spawn,	   {.v = brightnessup } },
    159 	{ 0,				XF86XK_MonBrightnessDown,
    160 						   spawn,	   {.v = brightnessdown } },
    161 	{ MODKEY|ShiftMask,		XK_Up,	   spawn,	   {.v = volumeup } },
    162 	{ MODKEY|ShiftMask,		XK_Down,   spawn,	   {.v = volumedown } },
    163 	{ MODKEY|ShiftMask,		XK_Left,   spawn,	   {.v = brightnessup } },
    164 	{ MODKEY|ShiftMask,		XK_Right,  spawn,	   {.v = brightnessdown } },
    165 	{ MODKEY,			XK_z,	   spawn,	   {.v = mpris_previous } },
    166 	{ MODKEY,			XK_x,	   spawn,	   {.v = mpris_play } },
    167 	{ MODKEY,			XK_c,	   spawn,	   {.v = mpris_pause } },
    168 	{ MODKEY,			XK_v,	   spawn,	   {.v = mpris_stop } },
    169 	{ MODKEY,			XK_b,	   spawn,	   {.v = mpris_next } },
    170 };
    171 
    172 /* button definitions */
    173 /* click can be ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */
    174 static Button buttons[] = {
    175 	/* click                event mask      button          function        argument */
    176 	{ ClkTagBar,            MODKEY,         Button1,        tag,            {0} },
    177 	{ ClkTagBar,            MODKEY,         Button3,        toggletag,      {0} },
    178 	{ ClkWinTitle,          0,              Button2,        zoom,           {0} },
    179 	{ ClkStatusText,        0,              Button2,        spawn,          {.v = termcmd } },
    180 	{ ClkClientWin,         MODKEY,         Button1,        movemouse,      {0} },
    181 	{ ClkClientWin,         MODKEY,         Button2,        togglefloating, {0} },
    182 	{ ClkClientWin,         MODKEY,         Button3,        resizemouse,    {0} },
    183 	{ ClkTagBar,            0,              Button1,        view,           {0} },
    184 	{ ClkTagBar,            0,              Button3,        toggleview,     {0} },
    185 	{ ClkTagBar,            MODKEY,         Button1,        tag,            {0} },
    186 	{ ClkTagBar,            MODKEY,         Button3,        toggletag,      {0} },
    187 };
    188