From 1e36be78dfd59325cc2d4d633a16121291d5774d Mon Sep 17 00:00:00 2001 From: stderr64 Date: Wed, 9 Sep 2026 20:09:24 +0300 Subject: Changed color scheme to gruvbox style colors and fixed strncpy not ensuring terminating NULL byte in ltsymbol in Monitor struct --- Makefile | 2 +- config.h | 25 +++++++++++++++---------- config.mk | 3 ++- dwm.c | 6 +++--- 4 files changed, 21 insertions(+), 15 deletions(-) diff --git a/Makefile b/Makefile index ffa69b4..285852b 100644 --- a/Makefile +++ b/Makefile @@ -20,7 +20,7 @@ dwm: ${OBJ} ${CC} -o $@ ${OBJ} ${LDFLAGS} clean: - rm -f dwm ${OBJ} dwm-${VERSION}.tar.gz + rm -f dwm ${OBJ} dist: clean mkdir -p dwm-${VERSION} diff --git a/config.h b/config.h index 0e6dfac..a80b247 100644 --- a/config.h +++ b/config.h @@ -5,8 +5,9 @@ static const unsigned int borderpx = 1; /* border pixel of windows */ static const unsigned int snap = 32; /* snap pixel */ static const int showbar = 1; /* 0 means no bar */ static const int topbar = 1; /* 0 means bottom bar */ -static const char *fonts[] = { "FreeSans:regular:size=14" }; -static const char dmenufont[] = "FreeSans:bold:size=14"; +static const char *fonts[] = { "FreeMono:bold:size=14" }; +static const char dmenufont[] = "FreeMono:bold:size=14"; +/* static const char col_gray1[] = "#222222"; static const char col_gray2[] = "#444444"; static const char col_gray3[] = "#bbbbbb"; @@ -15,13 +16,17 @@ static const char col_cyan[] = "#005577"; static const char col_orange[] = "#FF9900"; static const char col_indigo[] = "#1F1F33"; static const char col_black[] = "#000000"; +*/ +static const char col_gruvbox_bg[] = "#282828"; +static const char col_gruvbox_fg[] = "#bdae93"; +static const char col_gruvbox_ie[] = "#928374"; static const char *colors[][3] = { /* fg bg border */ - [SchemeNorm] = { col_orange, col_indigo, col_indigo }, - [SchemeSel] = { col_black, col_orange, col_orange }, - [SchemeHid] = { col_orange, col_indigo, col_orange }, - [SchemeStatusbar] = { col_indigo, col_black, col_indigo }, - [SchemeStatusbarText] = { col_orange, col_indigo, col_indigo } + [SchemeNorm] = { col_gruvbox_fg, col_gruvbox_bg, col_gruvbox_ie }, + [SchemeSel] = { col_gruvbox_bg, col_gruvbox_fg, col_gruvbox_fg }, + [SchemeHid] = { col_gruvbox_fg, col_gruvbox_bg, col_gruvbox_fg }, + [SchemeStatusbar] = { col_gruvbox_bg, col_gruvbox_bg, col_gruvbox_bg }, + [SchemeStatusbarText] = { col_gruvbox_fg, col_gruvbox_bg, col_gruvbox_bg } }; /* tagging */ @@ -69,13 +74,13 @@ static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, static const char *termcmd[] = { "/usr/bin/xterm", "-fg", - "#FF9900", + "#bdae93", "-bg", - "#1A1A2C", + "#282828", "-T", "Terminal", "-fa", - "Inconsolata Medium:regular:size=14", + "FreeMono:bold:size=14", "-geometry", "80x25", "+sb", diff --git a/config.mk b/config.mk index 8579ed5..0bc1b6f 100644 --- a/config.mk +++ b/config.mk @@ -28,7 +28,8 @@ LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS} # flags CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE=700L -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS} #CFLAGS = -g -std=c99 -pedantic -Wall -O0 ${INCS} ${CPPFLAGS} -CFLAGS = -std=c99 -pedantic -Wall -Wno-deprecated-declarations -Os ${INCS} ${CPPFLAGS} +#CFLAGS = -std=c99 -pedantic -Wall -Wno-deprecated-declarations -O2 -march=native -mtune=native ${INCS} ${CPPFLAGS} +CFLAGS = -std=c99 -pedantic -Wall -O2 -march=native -mtune=native ${INCS} ${CPPFLAGS} LDFLAGS = ${LIBS} # Solaris diff --git a/dwm.c b/dwm.c index 72a826f..fa44763 100644 --- a/dwm.c +++ b/dwm.c @@ -113,7 +113,7 @@ typedef struct { } Layout; struct Monitor { - char ltsymbol[16]; + char ltsymbol[17]; float mfact; int nmaster; int num; @@ -410,7 +410,7 @@ arrange(Monitor *m) void arrangemon(Monitor *m) { - strncpy(m->ltsymbol, m->lt[m->sellt]->symbol, sizeof m->ltsymbol); + strncpy(m->ltsymbol, m->lt[m->sellt]->symbol, sizeof(m->ltsymbol) - 1); if (m->lt[m->sellt]->arrange) m->lt[m->sellt]->arrange(m); } @@ -1636,7 +1636,7 @@ setlayout(const Arg *arg) selmon->sellt ^= 1; if (arg && arg->v) selmon->lt[selmon->sellt] = (Layout *)arg->v; - strncpy(selmon->ltsymbol, selmon->lt[selmon->sellt]->symbol, sizeof selmon->ltsymbol); + strncpy(selmon->ltsymbol, selmon->lt[selmon->sellt]->symbol, sizeof(selmon->ltsymbol) - 1); if (selmon->sel) arrange(selmon); else -- cgit v1.3.1-9-g1d36