aboutsummaryrefslogtreecommitdiff
path: root/config.h
blob: 97054a8a0802b1988018e1b4068fa624a2587e12 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
/* See LICENSE file for copyright and license details. */

/* Appearance. */
static unsigned int borderpx  = 8;        /* border pixel of windows */
const static unsigned int snap= 48;       /* snap pixel */
static unsigned int gappx     = 32;

static const int swallowfloating = 1;     /* Swallow floating windows by default. */
static const int showbar      = 1;        /* 0 means no bar */
static const int topbar       = 1;        /* 0 means bottom bar */
static int sidepad            = 0;
static int vertpad            = 0;

static char font[]            = "Hack Nerd Font 12";
static char dmenufont[]       = "Hack Nerd Font:size=12";

static char norm_bg_col[]     = "#282828";
static char norm_bor_col[]    = "#928374";
static char norm_fg_col[]     = "#ebdbb2";

static char sel_bg_col[]      = "#83a598";
static char sel_bor_col[]     = "#83a598";
static char sel_fg_col[]      = "#282828";

static char title_bg_col[]    = "#282828";
static char title_fg_col[]    = "#83a598";

static char *colors[][3]      = {
   /* Scheme,         fg,           bg,            border. */
   [SchemeNorm]   = { norm_fg_col,  norm_bg_col,   norm_bor_col },
   [SchemeSel]    = { sel_fg_col,   sel_bg_col,    sel_bor_col },
   [SchemeTitle]  = { title_fg_col, title_bg_col,  NULL },
};

/* Layouts. */
static float mfact               = 0.55;  /* Factor of master area size [0.05..0.95]. */
static const int nmaster         = 1;     /* Number of clients in master area. */
static const int resizehints     = 0;     /* 1 means respect size hints in tiled resizals. */
static const int lockfullscreen  = 1;     /* 1 will force focus on the fullscreen window */

static const Layout layouts[] = {
   /* Symbol,     layout. */
   { "[]=",       tile },                    /* First entry is default. */
   { "><>",       NULL },                    /* No layout function means floating behavior. */
   { "[M]",       monocle },                 /* Active window fills all available space. */  
   { "|M|",       centeredmaster },          /* Centered master window. */
   { "-M-",       centeredfloatingmaster },  /* Floating centered master window. */
};

/* Xresources. */
ResourcePref resources[] = {
   {"norm_bg_col",      STRING,  &norm_bg_col },
   {"norm_bor_col",     STRING,  &norm_bor_col },
   {"norm_fg_col",      STRING,  &norm_fg_col },
   {"sel_bg_col",       STRING,  &sel_bg_col },
   {"sel_bor_col",      STRING,  &sel_bor_col },
   {"sel_fg_col",       STRING,  &sel_fg_col },
   {"bor_px",           INTEGER, &borderpx },
   {"sidepad",          INTEGER, &sidepad },
   {"vertpad",          INTEGER, &vertpad },
   {"gap_px",           INTEGER, &gappx },
   {"mfact",            FLOAT,   &mfact },
   {"font",             STRING,  &font },
   {"dmenufont",        STRING,  &dmenufont },
};

/* Tags. */
static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };

/* Window rules. */
static const Rule rules[] = {
	/* xprop(1):
	 *	WM_CLASS(STRING) = instance, class
	 *	WM_NAME(STRING) = title
	 */
	/* Class,      instance,   title,                  tags mask,  isfloating, isterminal, noswallow,  monitor. */
	{ NULL,        NULL,       "Event Tester",         0,          0,          0,          1,          -1 }, /* xev. */
   { "dolphin",   NULL,       NULL,                   0,          1,          0,          0,          -1 }, /* Dolphin. */
   { "firefox",   NULL,       "Picture-in-Picture",   0,          1,          0,          0,          -1 }, /* Firefox PIP. */
   { "Alacritty", NULL,       NULL,                   0,          0,          1,          0,          -1 }, /* Alacritty. */
   { "zoom",      NULL,       NULL,                   0,          1,          0,          0,          -1 }, /* Zoom popups. */
   { "zoom",      NULL,       "Zoom Meeting",         0,          1,          0,          0,          -1 }, /* Zooom window. */
};

/* Key definitions. */
#define MODKEY Mod4Mask
#define TAGKEYS(KEY,TAG) \
   { MODKEY,                        KEY,  view,       {.ui = 1 << TAG} },  /* View tag tag. */ \
   { MODKEY|ControlMask,            KEY,  toggleview, {.ui = 1 << TAG} },  /* Toggle view tag. */ \
   { MODKEY|ShiftMask,              KEY,  tag,        {.ui = 1 << TAG} },  /* Add window to tag. */ \
   { MODKEY|ControlMask|ShiftMask,  KEY,  toggletag,  {.ui = 1 << TAG} },  /* Add window to tag and toggle view tag. */

/* Helper for spawning shell commands in the pre dwm-5.0 fashion. */
#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }

/* Commands. */

/* Scripts directory. */
#define SCR "/home/c/.local/bin/"

static char dmenumon[2] = "0"; /* Component of dmenucmd, manipulated in spawn(). */
static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, NULL };
static const char *termcmd[]  = { SCR "launchers/term.sh", NULL };
static const char *webcmd[]   = { SCR "launchers/web.sh", NULL };
static const char *passcmd[]  = { SCR "/sbin/passmenu", NULL };
static const char *bmkscmd[]  = { SCR "bmks", NULL };
static const char *bmkaddcmd[]= { SCR "bmks", "dadd", NULL };
static const char *scrshotcmd[]= { "flameshot", "gui", NULL };
static const char *fscrshotcmd[]= { "flameshot", "full", NULL };

static const char *papercmd[] = { SCR "wallpaper.sh", NULL };

#include "movestack.c"

static const Key keys[] = {
   /* Modifier,         key,        function,         argument. */

   /* Spawn commands. */
   { MODKEY,            XK_space,   spawn,            {.v = dmenucmd } },
   { MODKEY,            XK_Return,  spawn,            {.v = termcmd } },
   { MODKEY,            XK_w,       spawn,            {.v = webcmd } },
   { MODKEY,            XK_c,       spawn,            {.v = passcmd } },
   { MODKEY,            XK_m,       spawn,            {.v = bmkscmd } },
   { MODKEY|ShiftMask,  XK_m,       spawn,            {.v = bmkaddcmd } },

   /* Window navigation. */
   { MODKEY,            XK_j,       focusstack,       {.i = +1 } },
   { MODKEY,            XK_k,       focusstack,       {.i = -1 } },
   { MODKEY|ShiftMask,  XK_j,       movestack,        {.i = +1 } },
   { MODKEY|ShiftMask,  XK_k,       movestack,        {.i = -1 } },
   { MODKEY,            XK_z,       incnmaster,       {.i = +1 } },     /* Increase the number of master windows.  */
   { MODKEY|ShiftMask,  XK_z,       incnmaster,       {.i = -1 } },     /* Decrease the number of master windows.  */
   { MODKEY,            XK_h,       setmfact,         {.f = -0.05} },   /* Increase master/stack ratio. */
   { MODKEY,            XK_l,       setmfact,         {.f = +0.05} },   /* Decrease master/stack ratio. */
   { MODKEY,            XK_q,       killclient,       {0} },            /* Kill active window. */
   { MODKEY,            XK_x,       movecenter,       {0} },            /* Move window to center of screen. */

   /* Floating window navigation. */
   { MODKEY,            XK_Down,    moveresize,       {.v = (int []){ 0, snap, 0, 0 }} },
   { MODKEY,            XK_Up,      moveresize,       {.v = (int []){ 0, -snap, 0, 0 }} },
   { MODKEY,            XK_Right,   moveresize,       {.v = (int []){ snap, 0, 0, 0 }} },
   { MODKEY,            XK_Left,    moveresize,       {.v = (int []){ -snap, 0, 0, 0 }} },
   { MODKEY|ShiftMask,  XK_Down,    moveresize,       {.v = (int []){ snap/2, snap/2, -snap, -snap }} },
   { MODKEY|ShiftMask,  XK_Up,      moveresize,       {.v = (int []){ -snap/2, -snap/2, snap, snap }} },
   { MODKEY|ShiftMask,  XK_Right,   moveresize,       {.v = (int []){ -snap/2, 0, snap, 0 }} },
   { MODKEY|ShiftMask,  XK_Left,    moveresize,       {.v = (int []){ snap/2, 0, -snap, 0 }} },

   /* Layouts. */
   { MODKEY,            XK_t,       setlayout,        {.v = &layouts[0]} },   /* Default master/stack layout. */
   { MODKEY,            XK_y,       setlayout,        {.v = &layouts[1]} },   /* Floating layout. */
   { MODKEY,            XK_u,       setlayout,        {.v = &layouts[2]} },   /* Monocle layout. */
   { MODKEY,            XK_i,       setlayout,        {.v = &layouts[3]} },   /* Centered master layout. */
   { MODKEY|ShiftMask,  XK_i,       setlayout,        {.v = &layouts[4]} },   /* Floating centered master layout. */
   { MODKEY|ShiftMask,  XK_f,       togglefloating,   {0} },                  /* Toggle floating layout for a window. */
   { MODKEY,            XK_f,       togglefullscr,    {0} },                  /* Toggle fullscreen for a window. */

   /* Tag/monitor navigation. */
   { MODKEY,            XK_0,       view,             {.ui = ~0 } }, /* Add all windows to current tag */
   { MODKEY,            XK_Tab,     view,             {0} },         /* Switch to previous tag. */
   { MODKEY|ShiftMask,  XK_0,       tag,              {.ui = ~0 } }, /* Add current window to all tags. */
   { MODKEY,            XK_comma,   focusmon,         {.i = -1 } },
   { MODKEY,            XK_period,  focusmon,         {.i = +1 } },
   { MODKEY|ShiftMask,  XK_comma,   tagmon,           {.i = -1 } },
   { MODKEY|ShiftMask,  XK_period,  tagmon,           {.i = +1 } },
   TAGKEYS( XK_1, 0 )
   TAGKEYS( XK_2, 1 )
   TAGKEYS( XK_3, 2 )
   TAGKEYS( XK_4, 3 )
   TAGKEYS( XK_5, 4 )
   TAGKEYS( XK_6, 5 )
   TAGKEYS( XK_7, 6 )
   TAGKEYS( XK_8, 7 )
   TAGKEYS( XK_9, 8 )

   /* Misc. */
   { MODKEY,            XK_p,       spawn,            {.v = papercmd } },  /* New random wallpaper. */
   { MODKEY,            XK_b,       togglebar,        {0} },               /* Toggle the bar. */
   { MODKEY,            XK_minus,   setgaps,          {.i = -5 } },        /* Decrease window gaps. */
   { MODKEY|ShiftMask,  XK_equal,   setgaps,          {.i = +5 } },        /* Increase window gaps. */
   { MODKEY,            XK_equal,   resetgaps,        {0} },               /* Reset window gaps. */
   { MODKEY|ShiftMask,  XK_q,       quit,             {0} },               /* Quit dwm. */
   { 0,                 XK_Print,   spawn,            {.v = scrshotcmd } },
   { ShiftMask,         XK_Print,   spawn,            {.v = fscrshotcmd} },

   /* Function keys. */
   { 0, 0x1008ff13, spawn, SHCMD(SCR "setvol.sh i") },   /* Increase volume. */
   { 0, 0x1008ff11, spawn, SHCMD(SCR "setvol.sh d") },   /* Decrease volume.  */
   { 0, 0x1008ff12, spawn, SHCMD(SCR "setvol.sh m") },   /* Toggle mute. */
   { 0, 0x1008ff02, spawn, SHCMD(SCR "setmon.sh i") },   /* Increase monitor brightness. */
   { 0, 0x1008ff03, spawn, SHCMD(SCR "setmon.sh d") },   /* Decrease monitor brightness. */
};

/* Button definitions. */
/* A click can be ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin. */
static const Button buttons[] = {
   /* Click,         mask,    button,  function,         argument. */
   { ClkLtSymbol,    0,       Button1, setlayout,        {0} },
   { ClkLtSymbol,    0,       Button3, setlayout,        {.v = &layouts[2]} },
   { ClkWinTitle,    0,       Button2, zoom,             {0} },
   { ClkStatusText,  0,       Button2, spawn,            {.v = termcmd } },
   { ClkClientWin,   MODKEY,  Button1, movemouse,        {0} },
   { ClkClientWin,   MODKEY,  Button2, togglefloating,   {0} },
   { ClkClientWin,   MODKEY,  Button3, resizemouse,      {0} },
   { ClkTagBar,      0,       Button1, view,             {0} },
   { ClkTagBar,      0,       Button3, toggleview,       {0} },
   { ClkTagBar,      MODKEY,  Button1, tag,              {0} },
   { ClkTagBar,      MODKEY,  Button3, toggletag,        {0} },
};