| config.h - dotfiles - These are my dotfiles. There are many like it, but these … | |
| git clone git://jay.scot/dotfiles | |
| Log | |
| Files | |
| Refs | |
| README | |
| --- | |
| config.h (7091B) | |
| --- | |
| 1 /* See LICENSE file for copyright and license details. */ | |
| 2 | |
| 3 #include <X11/XF86keysym.h> | |
| 4 | |
| 5 /* appearance */ | |
| 6 static const unsigned int borderpx = 3; | |
| 7 static const unsigned int snap = 32; | |
| 8 static const int lockfullscreen = 1; | |
| 9 static const int showbar = 1; | |
| 10 static const int topbar = 1; | |
| 11 static const unsigned int systraypinning = 0; | |
| 12 static const unsigned int systrayonleft = 0; | |
| 13 static const unsigned int systrayspacing = 2; | |
| 14 static const int systraypinningfailfirst = 1; | |
| 15 static const int showsystray = 1; | |
| 16 | |
| 17 static const char *fonts[] = { "Hack:size=10" }; | |
| 18 static const char dmenufont[] = "Hack:size=10"; | |
| 19 static const char col_gray1[] = "#222222"; | |
| 20 static const char col_gray2[] = "#98971A"; | |
| 21 static const char col_gray3[] = "#bbbbbb"; | |
| 22 static const char col_gray4[] = "#eeeeee"; | |
| 23 static const char col_cyan[] = "#222222"; | |
| 24 static const char *colors[][3] = { | |
| 25 /* fg bg border */ | |
| 26 [SchemeNorm] = { col_gray3, col_gray1, col_cyan }, | |
| 27 [SchemeSel] = { col_gray4, col_cyan, col_gray2 }, | |
| 28 }; | |
| 29 | |
| 30 | |
| 31 /* custom functions */ | |
| 32 static void togglefullscreen(const Arg *arg); | |
| 33 static void bstack(Monitor *m); | |
| 34 static void centeredfloatingmaster(Monitor *m); | |
| 35 | |
| 36 /* custom defines for mouse buttons */ | |
| 37 /* only 1-5 are defined in X11/X.h */ | |
| 38 #define Button8 8 | |
| 39 #define Button9 9 | |
| 40 | |
| 41 /* tagging */ | |
| 42 static const char *tags[] = { "1", "2", "3", "4", "5" }; | |
| 43 | |
| 44 static Rule rules[] = { | |
| 45 /* class instance title tags mask isfloating … | |
| 46 { NULL, NULL, NULL, 0, False, … | |
| 47 }; | |
| 48 | |
| 49 /* layout(s) */ | |
| 50 static const float mfact = 0.65; | |
| 51 static const int nmaster = 1; | |
| 52 static const int resizehints = 0; | |
| 53 | |
| 54 static const Layout layouts[] = { | |
| 55 { "TTT", bstack }, | |
| 56 { "[]=", tile }, | |
| 57 { ">M>", centeredfloatingmaster }, | |
| 58 { "><>", NULL }, | |
| 59 }; | |
| 60 | |
| 61 #define MODKEY Mod1Mask | |
| 62 #define TAGKEYS(KEY,TAG) \ | |
| 63 { MODKEY, KEY, view, {.ui = 1 << TA… | |
| 64 { MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TA… | |
| 65 { MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TA… | |
| 66 { MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TA… | |
| 67 | |
| 68 #define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } } | |
| 69 | |
| 70 /* commands */ | |
| 71 static char dmenumon[2] = "0"; | |
| 72 static const char *dmenucmd[] = { "dmenu_run", NULL }; | |
| 73 static const char *termcmd[] = { "xterm", NULL }; | |
| 74 static const char *webcmd[] = { "firefox", NULL }; | |
| 75 static const char *musiccmd[] = { "/home/jay/bin/music", NULL }; | |
| 76 static const char *volup[] = { "sndioctl", "output.level=+0.1", NULL }; | |
| 77 static const char *voldown[] = { "sndioctl", "output.level=-0.1", NULL }; | |
| 78 | |
| 79 | |
| 80 static Key keys[] = { | |
| 81 /* modifier key function argum… | |
| 82 { MODKEY, XK_p, spawn, {.v =… | |
| 83 { MODKEY, XK_space, spawn, {.v =… | |
| 84 { MODKEY, XK_f, spawn, {.v =… | |
| 85 { MODKEY, XK_m, spawn, {.v =… | |
| 86 { MODKEY, XF86XK_AudioRaiseVolume, sp… | |
| 87 { MODKEY, XF86XK_AudioLowerVolume, sp… | |
| 88 { MODKEY, XK_j, focusstack, {.i =… | |
| 89 { MODKEY, XK_k, focusstack, {.i =… | |
| 90 { MODKEY, XK_h, setmfact, {.f =… | |
| 91 { MODKEY, XK_l, setmfact, {.f =… | |
| 92 { MODKEY, XK_Return, zoom, {0} }, | |
| 93 { MODKEY, XK_Tab, view, {0} }, | |
| 94 { MODKEY, XK_c, killclient, {0} }, | |
| 95 { MODKEY|ShiftMask, XK_m, togglefullscreen, {0}… | |
| 96 { MODKEY, XK_period, focusmon, {.i =… | |
| 97 { MODKEY, XK_comma, tagmon, {.i … | |
| 98 { MODKEY, XK_b, togglebar, {0} }, | |
| 99 { MODKEY, XK_x, setlayout, {.v =… | |
| 100 { MODKEY|ShiftMask, XK_x, setlayout, {.v =… | |
| 101 TAGKEYS( XK_1, 0) | |
| 102 TAGKEYS( XK_2, 1) | |
| 103 TAGKEYS( XK_3, 2) | |
| 104 TAGKEYS( XK_4, 3) | |
| 105 TAGKEYS( XK_5, 4) | |
| 106 { MODKEY|ShiftMask, XK_q, quit, {0} }, | |
| 107 }; | |
| 108 | |
| 109 /* button definitions */ | |
| 110 static Button buttons[] = { | |
| 111 { ClkRootWin, 0, Button8, spaw… | |
| 112 { ClkRootWin, 0, Button9, spaw… | |
| 113 }; | |
| 114 | |
| 115 void | |
| 116 togglefullscreen(const Arg *arg) | |
| 117 { | |
| 118 if (!selmon->sel) | |
| 119 return; | |
| 120 setfullscreen(selmon->sel, !selmon->sel->isfullscreen); | |
| 121 } | |
| 122 | |
| 123 static void | |
| 124 bstack(Monitor *m) { | |
| 125 int w, h, mh, mx, tx, ty, tw; | |
| 126 unsigned int i, n; | |
| 127 Client *c; | |
| 128 | |
| 129 for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next)… | |
| 130 if (n == 0) | |
| 131 return; | |
| 132 if (n > m->nmaster) { | |
| 133 mh = m->nmaster ? m->mfact * m->wh : 0; | |
| 134 tw = m->ww / (n - m->nmaster); | |
| 135 ty = m->wy + mh; | |
| 136 } else { | |
| 137 mh = m->wh; | |
| 138 tw = m->ww; | |
| 139 ty = m->wy; | |
| 140 } | |
| 141 for (i = mx = 0, tx = m->wx, c = nexttiled(m->clients); c; c = n… | |
| 142 if (i < m->nmaster) { | |
| 143 w = (m->ww - mx) / (MIN(n, m->nmaster) - i); | |
| 144 resize(c, m->wx + mx, m->wy, w - (2 * c->bw), mh… | |
| 145 mx += WIDTH(c); | |
| 146 } else { | |
| 147 h = m->wh - mh; | |
| 148 resize(c, tx, ty, tw - (2 * c->bw), h - (2 * c->… | |
| 149 if (tw != m->ww) | |
| 150 tx += WIDTH(c); | |
| 151 } | |
| 152 } | |
| 153 } | |
| 154 | |
| 155 void | |
| 156 centeredfloatingmaster(Monitor *m) | |
| 157 { | |
| 158 unsigned int i, n, w, mh, mw, mx, mxo, my, myo, tx; | |
| 159 Client *c; | |
| 160 | |
| 161 /* count number of clients in the selected monitor */ | |
| 162 for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next)… | |
| 163 if (n == 0) | |
| 164 return; | |
| 165 | |
| 166 /* initialize nmaster area */ | |
| 167 if (n > m->nmaster) { | |
| 168 /* go mfact box in the center if more than nmaster clien… | |
| 169 if (m->ww > m->wh) { | |
| 170 mw = m->nmaster ? m->ww * m->mfact : 0; | |
| 171 mh = m->nmaster ? m->wh * 0.9 : 0; | |
| 172 } else { | |
| 173 mh = m->nmaster ? m->wh * m->mfact : 0; | |
| 174 mw = m->nmaster ? m->ww * 0.9 : 0; | |
| 175 } | |
| 176 mx = mxo = (m->ww - mw) / 2; | |
| 177 my = myo = (m->wh - mh) / 2; | |
| 178 } else { | |
| 179 /* go fullscreen if all clients are in the master area */ | |
| 180 mh = m->wh; | |
| 181 mw = m->ww; | |
| 182 mx = mxo = 0; | |
| 183 my = myo = 0; | |
| 184 } | |
| 185 | |
| 186 for(i = tx = 0, c = nexttiled(m->clients); c; c = nexttiled(c->n… | |
| 187 if (i < m->nmaster) { | |
| 188 /* nmaster clients are stacked horizontally, in the cent… | |
| 189 * of the screen */ | |
| 190 w = (mw + mxo - mx) / (MIN(n, m->nmaster) - i); | |
| 191 resize(c, m->wx + mx, m->wy + my, w - (2*c->bw), | |
| 192 mh - (2*c->bw), 0); | |
| 193 mx += WIDTH(c); | |
| 194 } else { | |
| 195 /* stack clients are stacked horizontally */ | |
| 196 w = (m->ww - tx) / (n - i); | |
| 197 resize(c, m->wx + tx, m->wy, w - (2*c->bw), | |
| 198 m->wh - (2*c->bw), 0); | |
| 199 tx += WIDTH(c); | |
| 200 } | |
| 201 } |