Gruvbox theme

This commit is contained in:
lhark 2023-01-25 17:50:13 +01:00
parent ed47e657c2
commit d0acbada9f
2 changed files with 36 additions and 21 deletions

View file

@ -10,17 +10,25 @@ static const int systraypinningfailfirst = 1; /* 1: if pinning fails, display
static const int showsystray = 1; /* 0 means no systray */ static const int showsystray = 1; /* 0 means no systray */
static const int showbar = 1; /* 0 means no bar */ static const int showbar = 1; /* 0 means no bar */
static const int topbar = 1; /* 0 means bottom bar */ static const int topbar = 1; /* 0 means bottom bar */
static const char *fonts[] = { "Hack:size=10" }; static const char *fonts[] = {
static const char dmenufont[] = "Hack:size=10"; "Hack:style=Bold:size=10",
static const char col_gray1[] = "#222222"; "DejaVuSans:style=Bold:size=12", /* For the symbols */
static const char col_gray2[] = "#444444"; };
static const char col_gray3[] = "#bbbbbb"; static const char dmenufont[] = "Hack:style=Bold:size=10";
static const char col_gray4[] = "#eeeeee"; static const char col_dark[] = "#282828";
static const char col_cyan[] = "#005577"; static const char col_gray[] = "#928374";
static const char col_gray1[] = "#3c3836";
static const char col_gray2[] = "#504945";
static const char col_gray3[] = "#7c6f64";
static const char col_clear[] = "#ebdbd2";
static const char col_orange[] = "#fe8019";
static const char col_dark_orange[] = "#d65d0e";
static const char col_invalid[] = "#ff00ff";
static const char *colors[][3] = { static const char *colors[][3] = {
/* fg bg border */ /* fg bg border */
[SchemeNorm] = { col_gray3, col_gray1, col_gray2 }, [SchemeNorm] = { col_gray, col_dark, col_dark },
[SchemeSel] = { col_gray4, col_cyan, col_cyan }, [SchemeSel] = { col_gray1, col_orange, col_gray2 },
[SchemeSystray] = { col_invalid, col_orange, col_invalid },
}; };
/* tagging */ /* tagging */
@ -32,9 +40,11 @@ static const Rule rules[] = {
* WM_NAME(STRING) = title * WM_NAME(STRING) = title
*/ */
/* class instance title tags mask isfloating monitor */ /* class instance title tags mask isfloating monitor */
{ "Gimp", NULL, NULL, 0, 1, -1 }, { "mpv", NULL, NULL, 0, 1, -1 },
{ "Firefox", NULL, NULL, 0, 0, -1 }, { "Firefox", NULL, NULL, 0, 0, -1 },
{ "KeePass2", NULL, NULL, 1<<8, 0, -1 }, { "KeePass2", NULL, NULL, 1<<8, 0, -1 },
/* Add the " - " at the start to match only the main window */
{ " - KeePassXC",NULL, NULL, 1<<8, 0, -1 },
}; };
/* layout(s) */ /* layout(s) */
@ -62,7 +72,9 @@ static const Layout layouts[] = {
/* commands */ /* commands */
static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */ static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL }; static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, \
"-nb", col_dark, "-nf", col_gray, \
"-sb", col_orange, "-sf", col_gray1, NULL };
static const char *termcmd[] = { "/usr/bin/kitty", "--single-instance", NULL }; static const char *termcmd[] = { "/usr/bin/kitty", "--single-instance", NULL };
static const char *backlightinccmd[] = { "light", "-A", "5", NULL }; static const char *backlightinccmd[] = { "light", "-A", "5", NULL };
static const char *backlightdeccmd[] = { "light", "-U", "5", NULL }; static const char *backlightdeccmd[] = { "light", "-U", "5", NULL };
@ -98,7 +110,7 @@ static Key keys[] = {
{ MODKEY|ShiftMask, XK_less, spawn, {.v = mpdnext } }, { MODKEY|ShiftMask, XK_less, spawn, {.v = mpdnext } },
{ MODKEY, XK_l, spawn, {.v = slock } }, { MODKEY, XK_l, spawn, {.v = slock } },
{ MODKEY, XK_v, spawn, {.v = clipqr } }, { MODKEY, XK_v, spawn, {.v = clipqr } },
{ MODKEY, XK_e, spawn, {.v = splatmoji } }, //{ MODKEY, XK_e, spawn, {.v = splatmoji } },
{ MODKEY, XK_b, togglebar, {0} }, { MODKEY, XK_b, togglebar, {0} },
{ MODKEY, XK_Tab, focusstack, {.i = +1 } }, { MODKEY, XK_Tab, focusstack, {.i = +1 } },
{ MODKEY|ShiftMask, XK_Tab, focusstack, {.i = -1 } }, { MODKEY|ShiftMask, XK_Tab, focusstack, {.i = -1 } },
@ -114,8 +126,9 @@ static Key keys[] = {
{ MODKEY, XK_m, setlayout, {.v = &layouts[2]} }, { MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
{ MODKEY, XK_space, setlayout, {0} }, { MODKEY, XK_space, setlayout, {0} },
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} }, { MODKEY|ShiftMask, XK_space, togglefloating, {0} },
{ MODKEY, XK_agrave, view, {.ui = ~0 } }, /* Remove "show all tags" binding as it crashes X */
{ MODKEY|ShiftMask, XK_agrave, tag, {.ui = ~0 } }, // { MODKEY, XK_agrave, view, {.ui = ~0 } },
// { MODKEY|ShiftMask, XK_agrave, tag, {.ui = ~0 } },
{ MODKEY, XK_comma, focusmon, {.i = -1 } }, { MODKEY, XK_comma, focusmon, {.i = -1 } },
{ MODKEY, XK_semicolon, focusmon, {.i = +1 } }, { MODKEY, XK_semicolon, focusmon, {.i = +1 } },
{ MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } }, { MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },

14
dwm.c
View file

@ -77,7 +77,7 @@
/* enums */ /* enums */
enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */ enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
enum { SchemeNorm, SchemeSel, SchemeLast }; /* color schemes */ enum { SchemeNorm, SchemeSel, SchemeSystray, SchemeLast }; /* color schemes */
enum { NetSupported, NetWMName, NetWMState, NetWMCheck, enum { NetSupported, NetWMName, NetWMState, NetWMCheck,
NetSystemTray, NetSystemTrayOP, NetSystemTrayOrientation, NetSystemTrayOrientationHorz, NetSystemTray, NetSystemTrayOP, NetSystemTrayOrientation, NetSystemTrayOrientationHorz,
NetWMFullscreen, NetActiveWindow, NetWMWindowType, NetWMFullscreen, NetActiveWindow, NetWMWindowType,
@ -627,7 +627,7 @@ clientmessage(XEvent *e)
XSelectInput(dpy, c->win, StructureNotifyMask | PropertyChangeMask | ResizeRedirectMask); XSelectInput(dpy, c->win, StructureNotifyMask | PropertyChangeMask | ResizeRedirectMask);
XReparentWindow(dpy, c->win, systray->win, 0, 0); XReparentWindow(dpy, c->win, systray->win, 0, 0);
/* use parents background color */ /* use parents background color */
swa.background_pixel = scheme[SchemeNorm][ColBg].pixel; swa.background_pixel = scheme[SchemeSystray][ColBg].pixel;
XChangeWindowAttributes(dpy, c->win, CWBackPixel, &swa); XChangeWindowAttributes(dpy, c->win, CWBackPixel, &swa);
sendevent(c->win, netatom[Xembed], StructureNotifyMask, CurrentTime, XEMBED_EMBEDDED_NOTIFY, 0 , systray->win, XEMBED_EMBEDDED_VERSION); sendevent(c->win, netatom[Xembed], StructureNotifyMask, CurrentTime, XEMBED_EMBEDDED_NOTIFY, 0 , systray->win, XEMBED_EMBEDDED_VERSION);
/* FIXME not sure if I have to send these events, too */ /* FIXME not sure if I have to send these events, too */
@ -651,6 +651,8 @@ clientmessage(XEvent *e)
if (c != selmon->sel && !c->isurgent) { if (c != selmon->sel && !c->isurgent) {
seturgent(c, 1); seturgent(c, 1);
for(i=0; !(c->tags & 1 << i); i++); for(i=0; !(c->tags & 1 << i); i++);
if (c->mon != selmon)
selmon = c->mon;
view(&(Arg){.ui = 1 << i}); view(&(Arg){.ui = 1 << i});
} }
} }
@ -885,7 +887,7 @@ drawstatusbar(Monitor *m, int bh, char* stext) {
isCode = 0; isCode = 0;
text = p; text = p;
w += 2; /* 1px padding on both sides */ w += 1; /* 1px padding on the left side */
ret = m->ww - w; ret = m->ww - w;
x = m->ww - w - getsystraywidth(); x = m->ww - w - getsystraywidth();
@ -2536,7 +2538,7 @@ updatesystray(void)
systray->win = XCreateSimpleWindow(dpy, root, x, m->by, w, bh, 0, 0, scheme[SchemeSel][ColBg].pixel); systray->win = XCreateSimpleWindow(dpy, root, x, m->by, w, bh, 0, 0, scheme[SchemeSel][ColBg].pixel);
wa.event_mask = ButtonPressMask | ExposureMask; wa.event_mask = ButtonPressMask | ExposureMask;
wa.override_redirect = True; wa.override_redirect = True;
wa.background_pixel = scheme[SchemeNorm][ColBg].pixel; wa.background_pixel = scheme[SchemeSystray][ColBg].pixel;
XSelectInput(dpy, systray->win, SubstructureNotifyMask); XSelectInput(dpy, systray->win, SubstructureNotifyMask);
XChangeProperty(dpy, systray->win, netatom[NetSystemTrayOrientation], XA_CARDINAL, 32, XChangeProperty(dpy, systray->win, netatom[NetSystemTrayOrientation], XA_CARDINAL, 32,
PropModeReplace, (unsigned char *)&netatom[NetSystemTrayOrientationHorz], 1); PropModeReplace, (unsigned char *)&netatom[NetSystemTrayOrientationHorz], 1);
@ -2556,7 +2558,7 @@ updatesystray(void)
} }
for (w = 0, i = systray->icons; i; i = i->next) { for (w = 0, i = systray->icons; i; i = i->next) {
/* make sure the background color stays the same */ /* make sure the background color stays the same */
wa.background_pixel = scheme[SchemeNorm][ColBg].pixel; wa.background_pixel = scheme[SchemeSystray][ColBg].pixel;
XChangeWindowAttributes(dpy, i->win, CWBackPixel, &wa); XChangeWindowAttributes(dpy, i->win, CWBackPixel, &wa);
XMapRaised(dpy, i->win); XMapRaised(dpy, i->win);
w += systrayspacing; w += systrayspacing;
@ -2575,7 +2577,7 @@ updatesystray(void)
XMapWindow(dpy, systray->win); XMapWindow(dpy, systray->win);
XMapSubwindows(dpy, systray->win); XMapSubwindows(dpy, systray->win);
/* redraw background */ /* redraw background */
XSetForeground(dpy, drw->gc, scheme[SchemeNorm][ColBg].pixel); XSetForeground(dpy, drw->gc, scheme[SchemeSystray][ColBg].pixel);
XFillRectangle(dpy, systray->win, drw->gc, 0, 0, w, bh); XFillRectangle(dpy, systray->win, drw->gc, 0, 0, w, bh);
XSync(dpy, False); XSync(dpy, False);
} }