From d0acbada9f143108608ebae521eddb7214bcac99 Mon Sep 17 00:00:00 2001 From: lhark Date: Wed, 25 Jan 2023 17:50:13 +0100 Subject: [PATCH] Gruvbox theme --- config.def.h | 43 ++++++++++++++++++++++++++++--------------- dwm.c | 14 ++++++++------ 2 files changed, 36 insertions(+), 21 deletions(-) diff --git a/config.def.h b/config.def.h index 3efc3ce..0f6458c 100644 --- a/config.def.h +++ b/config.def.h @@ -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 showbar = 1; /* 0 means no bar */ static const int topbar = 1; /* 0 means bottom bar */ -static const char *fonts[] = { "Hack:size=10" }; -static const char dmenufont[] = "Hack:size=10"; -static const char col_gray1[] = "#222222"; -static const char col_gray2[] = "#444444"; -static const char col_gray3[] = "#bbbbbb"; -static const char col_gray4[] = "#eeeeee"; -static const char col_cyan[] = "#005577"; +static const char *fonts[] = { + "Hack:style=Bold:size=10", + "DejaVuSans:style=Bold:size=12", /* For the symbols */ +}; +static const char dmenufont[] = "Hack:style=Bold:size=10"; +static const char col_dark[] = "#282828"; +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] = { - /* fg bg border */ - [SchemeNorm] = { col_gray3, col_gray1, col_gray2 }, - [SchemeSel] = { col_gray4, col_cyan, col_cyan }, + /* fg bg border */ + [SchemeNorm] = { col_gray, col_dark, col_dark }, + [SchemeSel] = { col_gray1, col_orange, col_gray2 }, + [SchemeSystray] = { col_invalid, col_orange, col_invalid }, }; /* tagging */ @@ -32,9 +40,11 @@ static const Rule rules[] = { * WM_NAME(STRING) = title */ /* 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 }, { "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) */ @@ -62,7 +72,9 @@ static const Layout layouts[] = { /* commands */ 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 *backlightinccmd[] = { "light", "-A", "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, XK_l, spawn, {.v = slock } }, { 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_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_space, setlayout, {0} }, { MODKEY|ShiftMask, XK_space, togglefloating, {0} }, - { MODKEY, XK_agrave, view, {.ui = ~0 } }, - { MODKEY|ShiftMask, XK_agrave, tag, {.ui = ~0 } }, + /* Remove "show all tags" binding as it crashes X */ + // { MODKEY, XK_agrave, view, {.ui = ~0 } }, + // { MODKEY|ShiftMask, XK_agrave, tag, {.ui = ~0 } }, { MODKEY, XK_comma, focusmon, {.i = -1 } }, { MODKEY, XK_semicolon, focusmon, {.i = +1 } }, { MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } }, diff --git a/dwm.c b/dwm.c index 0047f89..48829a0 100644 --- a/dwm.c +++ b/dwm.c @@ -77,7 +77,7 @@ /* enums */ enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */ -enum { SchemeNorm, SchemeSel, SchemeLast }; /* color schemes */ +enum { SchemeNorm, SchemeSel, SchemeSystray, SchemeLast }; /* color schemes */ enum { NetSupported, NetWMName, NetWMState, NetWMCheck, NetSystemTray, NetSystemTrayOP, NetSystemTrayOrientation, NetSystemTrayOrientationHorz, NetWMFullscreen, NetActiveWindow, NetWMWindowType, @@ -627,7 +627,7 @@ clientmessage(XEvent *e) XSelectInput(dpy, c->win, StructureNotifyMask | PropertyChangeMask | ResizeRedirectMask); XReparentWindow(dpy, c->win, systray->win, 0, 0); /* use parents background color */ - swa.background_pixel = scheme[SchemeNorm][ColBg].pixel; + swa.background_pixel = scheme[SchemeSystray][ColBg].pixel; XChangeWindowAttributes(dpy, c->win, CWBackPixel, &swa); 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 */ @@ -651,6 +651,8 @@ clientmessage(XEvent *e) if (c != selmon->sel && !c->isurgent) { seturgent(c, 1); for(i=0; !(c->tags & 1 << i); i++); + if (c->mon != selmon) + selmon = c->mon; view(&(Arg){.ui = 1 << i}); } } @@ -885,7 +887,7 @@ drawstatusbar(Monitor *m, int bh, char* stext) { isCode = 0; text = p; - w += 2; /* 1px padding on both sides */ + w += 1; /* 1px padding on the left side */ ret = m->ww - w; 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); wa.event_mask = ButtonPressMask | ExposureMask; wa.override_redirect = True; - wa.background_pixel = scheme[SchemeNorm][ColBg].pixel; + wa.background_pixel = scheme[SchemeSystray][ColBg].pixel; XSelectInput(dpy, systray->win, SubstructureNotifyMask); XChangeProperty(dpy, systray->win, netatom[NetSystemTrayOrientation], XA_CARDINAL, 32, PropModeReplace, (unsigned char *)&netatom[NetSystemTrayOrientationHorz], 1); @@ -2556,7 +2558,7 @@ updatesystray(void) } for (w = 0, i = systray->icons; i; i = i->next) { /* 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); XMapRaised(dpy, i->win); w += systrayspacing; @@ -2575,7 +2577,7 @@ updatesystray(void) XMapWindow(dpy, systray->win); XMapSubwindows(dpy, systray->win); /* 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); XSync(dpy, False); }