config

My configuration files and custom scripts.
git clone https://git.tronto.net/config
Download | Log | Files | Refs

config.h (9693B)


      1 /* See LICENSE file for copyright and license details. */
      2 
      3 /* appearance */
      4 static const unsigned int borderpx  = 3;        /* border pixel of windows */
      5 static const unsigned int snap      = 32;       /* snap pixel */
      6 static const int showbar            = 1;        /* 0 means no bar */
      7 static const int topbar             = 1;        /* 0 means bottom bar */
      8 static const char *fonts[]          = { "monospace:size=14" };
      9 static const char dmenufont[]       = "monospace:size=14";
     10 
     11 /* Dark scheme: */
     12 /*
     13 static const char col_gray1[]       = "#141414";
     14 static const char col_gray2[]       = "#504945";
     15 static const char col_gray3[]       = "#bdae93";
     16 static const char col_gray4[]       = "#f9f9f9";
     17 static const char col_cyan[]        = "#3465a4";
     18 */
     19 
     20 /* Light theme: */
     21 static const char col_gray1[]       = "#fffff8";
     22 static const char col_gray2[]       = "#000000";
     23 static const char col_gray3[]       = "#000000";
     24 static const char col_gray4[]       = "#000000";
     25 static const char col_cyan[]        = "#f0f0f4";
     26 
     27 static const char *colors[][3]      = {
     28 	/*               fg         bg         border   */
     29 	[SchemeNorm] = { col_gray3, col_gray1, col_cyan  },
     30 	[SchemeSel]  = { col_gray4, col_cyan,  col_gray2 },
     31 };
     32 
     33 /* tagging */
     34 static const char *tags[] = { "1", "2", "3", "4" };
     35 
     36 static const Rule rules[] = {
     37 	/* xprop(1):
     38 	 *	WM_CLASS(STRING) = instance, class
     39 	 *	WM_NAME(STRING) = title
     40 	 */
     41 	/* class | instance | title | tagsmask | isfloating | monitor */
     42 	{ "TelegramDesktop", NULL, NULL,                 1 << 3,  0, -1 },
     43 	{ NULL,              NULL, "stfloat",            0,       1, -1 },
     44 	{ NULL,              NULL, "Picture-in-Picture", TAGMASK, 1, -1 },
     45 };
     46 
     47 /* layout(s) */
     48 static const float mfact        = 0.5;  /* factor of master area */
     49 static const int nmaster        = 1;    /* number of clients in master area */
     50 static const int resizehints    = 0;    /* 1 means respect size hints */
     51 static const int refreshrate    = 120;  /* refresh rate (per second) for client move/resize */
     52 static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */
     53 
     54 static const Layout layouts[] = {
     55 	/* symbol     arrange function */
     56 	{ "[]=",      tile },    /* first entry is default */
     57 	{ "><>",      NULL },    /* no layout function means floating behavior */
     58 	{ "[M]",      monocle },
     59 };
     60 
     61 /* key definitions */
     62 #define MODKEY Mod1Mask
     63 #define TAGKEYS(KEY,TAG) \
     64 	{ MODKEY,                       KEY,      view,       {.ui = 1 << TAG} }, \
     65 	{ MODKEY|ControlMask,           KEY,      toggleview, {.ui = 1 << TAG} }, \
     66 	{ MODKEY|ShiftMask,             KEY,      tag,        {.ui = 1 << TAG} }, \
     67 	{ MODKEY|ControlMask|ShiftMask, KEY,      toggletag,  {.ui = 1 << TAG} },
     68 
     69 /* helper for spawning shell commands in the pre dwm-5.0 fashion */
     70 #define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
     71 
     72 /* commands */
     73 static const char *termcmd[]  = { "st", NULL };
     74 static char dmenumon[2] = "0"; /* used in dmenucmd, manipulated in spawn() */
     75 static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon,
     76                                                "-fn", dmenufont,
     77                                                "-nb", col_gray1,
     78                                                "-nf", col_gray3,
     79                                                "-sb", col_cyan,
     80                                                "-sf", col_gray4, NULL };
     81 
     82 /* Necessary library for some multimedia key names */
     83 #include <X11/XF86keysym.h>
     84 
     85 /* My zoomstack function; passing .i=1 means always focus stack */
     86 void
     87 zoomstack(const Arg *arg)
     88 {
     89 	int s = 0;
     90 	unsigned int j;
     91 	Monitor *m = selmon;
     92 	Client *c = selmon->sel, *f, **p;
     93 
     94 	if (!m->lt[m->sellt]->arrange)
     95 		return;
     96 
     97 	if (!c || (c && c->isfloating)) {
     98 		c = nexttiled(m->clients);
     99 		s = 1;
    100 	}
    101 
    102 	for (j = 0, f = nexttiled(m->clients); f && j < m->nmaster; 
    103 	     f = nexttiled(f->next), j++) {
    104 		if (f == c) {
    105 			c = nexttiled(c->next);
    106 			s = 1;
    107 		}
    108 	}
    109 	if (c && f == c)
    110 		c = nexttiled(c->next);
    111 	for (p = &m->clients; *p && (*p)->next != f; p = &(*p)->next);
    112 	if (!*p || !c)
    113 		return;
    114 	detach(c);
    115 	c->next = (*p)->next;
    116 	(*p)->next = c;
    117 	arrange(m);
    118 	if (!s || arg->i)
    119 		focus(c);
    120 }
    121 
    122 /* Focusmater by Mateus Auler - <mateusauler at protonmail dot com>
    123  * Taken from https://dwm.suckless.org/patches/focusmaster           */
    124 void
    125 focusmaster(const Arg *arg)
    126 {
    127 	Client *c;
    128 
    129 	if (selmon->nmaster < 1)
    130 		return;
    131 
    132 	c = nexttiled(selmon->clients);
    133 
    134 	if (c)
    135 		focus(c);
    136 }
    137 
    138 static Key keys[] = {
    139 	/* modifier                     key        function        argument */
    140 	{ MODKEY,                       XK_o,      spawn,          SHCMD("open-file") },
    141 	{ MODKEY,                       XK_p,      spawn,          {.v = dmenucmd} },
    142 	{ MODKEY,                       XK_n,      togglebar,      {0} },
    143 	{ MODKEY,                       XK_j,      focusstack,     {.i = +1 } },
    144 	{ MODKEY,                       XK_k,      focusstack,     {.i = -1 } },
    145 	{ MODKEY|ControlMask,           XK_d,      incnmaster,     {.i = +1 } },
    146 	{ MODKEY|ControlMask|ShiftMask, XK_d,      incnmaster,     {.i = -1 } },
    147 	{ MODKEY,                       XK_h,      setmfact,       {.f = -0.05} },
    148 	{ MODKEY,                       XK_l,      setmfact,       {.f = +0.05} },
    149 	{ MODKEY,                       XK_Tab,    view,           {0} },
    150 	{ MODKEY|ShiftMask,             XK_c,      killclient,     {0} },
    151 	{ MODKEY,                       XK_t,      setlayout,      {.v = &layouts[0]} },
    152 	{ MODKEY,                       XK_f,      setlayout,      {.v = &layouts[1]} },
    153 	{ MODKEY,                       XK_m,      setlayout,      {.v = &layouts[2]} },
    154 	{ MODKEY,                       XK_s,      togglefloating, {0} },
    155 	{ MODKEY,                       XK_Return, zoom,           {0} },
    156 	{ MODKEY,                       XK_0,      view,           {.ui = ~0 } },
    157 	{ MODKEY|ShiftMask,             XK_0,      tag,            {.ui = ~0 } },
    158 	{ MODKEY,                       XK_comma,  focusmon,       {.i = -1 } },
    159 	{ MODKEY,                       XK_period, focusmon,       {.i = +1 } },
    160 	{ MODKEY|ShiftMask,             XK_comma,  tagmon,         {.i = -1 } },
    161 	{ MODKEY|ShiftMask,             XK_period, tagmon,         {.i = +1 } },
    162 	TAGKEYS(                        XK_1,                      0)
    163 	TAGKEYS(                        XK_2,                      1)
    164 	TAGKEYS(                        XK_3,                      2)
    165 	TAGKEYS(                        XK_4,                      3)
    166 	/*
    167 	TAGKEYS(                        XK_5,                      4)
    168 	TAGKEYS(                        XK_6,                      5)
    169 	TAGKEYS(                        XK_7,                      6)
    170 	TAGKEYS(                        XK_8,                      7)
    171 	TAGKEYS(                        XK_9,                      8)
    172 	*/
    173 
    174 	/* Session */
    175 	{ MODKEY|ShiftMask,  XK_q,  spawn, SHCMD("dmenu-dwm-sessionmanager") },
    176 	{ MODKEY|ShiftMask,  XK_z,  spawn, SHCMD("slock") },
    177 
    178 	/* Programs */
    179 	{ MODKEY|ShiftMask,  XK_Return,    spawn, SHCMD("terminal") },
    180 	{ MODKEY|ShiftMask,  XK_backslash, spawn, SHCMD("popup-terminal") },
    181 	{ MODKEY|ShiftMask,  XK_f,         spawn, SHCMD("firefox") },
    182 	{ MODKEY|ShiftMask,  XK_g,         spawn, SHCMD("xedit") },
    183 	{ MODKEY|ShiftMask,  XK_j,         spawn, SHCMD("terminal python") },
    184 	{ MODKEY,            XK_y,         spawn, SHCMD("clip") },
    185 	{ MODKEY,            XK_d,         spawn, SHCMD("popup-cal12") },
    186 	{ MODKEY,            XK_q,         spawn, SHCMD("dmenu-unmount") },
    187 	{ MODKEY,            XK_e,         spawn, SHCMD("dmenu-bookmarks") },
    188 
    189 	/* System settings */
    190 	{ MODKEY|ShiftMask,  XK_w,  spawn, SHCMD("popup-terminal iwctl") },
    191 	{ MODKEY|ShiftMask,  XK_v,  spawn, SHCMD("popup-terminal pulsemixer") },
    192 	{ MODKEY|ShiftMask,  XK_b,  spawn, SHCMD("blueman-manager") },
    193 	{ MODKEY|ShiftMask,  XK_p,  spawn, SHCMD("popup-terminal top") },
    194 	{ MODKEY,            XK_space, spawn, SHCMD("xkfix") },
    195 
    196   	/* Multimedia */
    197 	{ 0,   XK_Print,                 spawn, SHCMD("dmenu-screenshot") },
    198 	{ 0,   XF86XK_MonBrightnessUp,   spawn, SHCMD("brightnessctl set 5%+") },
    199 	{ 0,   XF86XK_MonBrightnessDown, spawn, SHCMD("brightnessctl set 5%-") },
    200 	{ 0,   XF86XK_AudioRaiseVolume,  spawn, SHCMD("pulsemixer --change-volume +5 && xroot-update") },
    201 	{ 0,   XF86XK_AudioLowerVolume,  spawn, SHCMD("pulsemixer --change-volume -5 && xroot-update") },
    202 	{ 0,   XF86XK_AudioMute,         spawn, SHCMD("pulsemixer --toggle-mute && xroot-update") },
    203 
    204 	/* zoomstack (.i = 1: always focus) and others */
    205 	{ MODKEY,              XK_backslash,  zoomstack,       {.i = 0} },
    206 	{ MODKEY|ControlMask,  XK_Return,     focusmaster,     {0} },
    207 
    208 	/* Notify */
    209 	{ ControlMask,           XK_space, spawn, SHCMD("notify clean") },
    210 	{ ControlMask|ShiftMask, XK_space, spawn, SHCMD("popup-terminal 'notify show | less'") },
    211 };
    212 
    213 /* button definitions */
    214 /* click can be ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */
    215 static Button buttons[] = {
    216 	/* click         event mask  button   function        argument */
    217 	{ ClkLtSymbol,   0,          Button1, setlayout,      {0} },
    218 	{ ClkLtSymbol,   0,          Button3, setlayout,      {.v = &layouts[2]} },
    219 	{ ClkWinTitle,   0,          Button2, zoom,           {0} },
    220 	{ ClkStatusText, 0,          Button2, spawn,          {.v = termcmd } },
    221 	{ ClkClientWin,  MODKEY,     Button1, movemouse,      {0} },
    222 	{ ClkClientWin,  MODKEY,     Button2, togglefloating, {0} },
    223 	{ ClkClientWin,  MODKEY,     Button3, resizemouse,    {0} },
    224 	{ ClkTagBar,     0,          Button1, view,           {0} },
    225 	{ ClkTagBar,     0,          Button3, toggleview,     {0} },
    226 	{ ClkTagBar,     MODKEY,     Button1, tag,            {0} },
    227 	{ ClkTagBar,     MODKEY,     Button3, toggletag,      {0} },
    228 };
    229