enable control fonts with xresources

This commit is contained in:
mrsu 2024-06-15 21:58:05 +01:00
parent 16b3c79086
commit b5ad778728
2 changed files with 28 additions and 22 deletions

View File

@ -9,9 +9,9 @@ static unsigned int snap = 32; /* snap pixel */
static const int swallowfloating = 0; /* 1 means swallow floating windows by default */ static const int swallowfloating = 0; /* 1 means swallow floating windows by default */
static int showbar = 1; /* 0 means no bar */ static int showbar = 1; /* 0 means no bar */
static int topbar = 1; /* 0 means bottom bar */ static int topbar = 1; /* 0 means bottom bar */
static const char font[] = "monospace:size=14"; static char font[] = "monospace:size=14";
static const char dmenufont[] = "monospace:size=14"; static char dmenufont[] = "monospace:size=14";
static const char *fonts[] = { "monospace:size=14", "NotoColorEmoji:pixelsize=14:antialias=true:autohint=true" }; static const char *fonts[] = { font };
// base 16 scheme: "Kanagawa" // base 16 scheme: "Kanagawa"
static char col_base00[] = "#1F1F28"; static char col_base00[] = "#1F1F28";
@ -101,6 +101,7 @@ static const char *termcmd[] = { "st", NULL };
* Xresources preferences to load at startup * Xresources preferences to load at startup
*/ */
ResourcePref resources[] = { ResourcePref resources[] = {
{ "font", STRING, &font },
{ "col_base00", STRING, &col_base00 }, { "col_base00", STRING, &col_base00 },
{ "col_base03", STRING, &col_base03 }, { "col_base03", STRING, &col_base03 },
{ "col_base04", STRING, &col_base04 }, { "col_base04", STRING, &col_base04 },

View File

@ -1,20 +1,20 @@
From 2832bd78a690606a48a7e1d370cd60fd92ee4988 Mon Sep 17 00:00:00 2001 From f30583c6e2ab5e7de6ef4ebf156076ac0f6e69fc Mon Sep 17 00:00:00 2001
From: MLquest8 <miskuzius@gmail.com> From: Jack Bird <jack.bird@durham.ac.uk>
Date: Fri, 12 Jun 2020 15:43:31 +0400 Date: Fri, 27 Aug 2021 00:53:14 +0100
Subject: [PATCH] handle various setting of various types from Xresources Subject: [PATCH] xresources updated for 138b405
--- ---
config.def.h | 54 ++++++++++++++++++++++++++------------- config.def.h | 61 ++++++++++++++++++++++++++++++--------------
drw.c | 2 +- drw.c | 2 +-
drw.h | 2 +- drw.h | 2 +-
dwm.c | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++++ dwm.c | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 111 insertions(+), 19 deletions(-) 4 files changed, 116 insertions(+), 21 deletions(-)
diff --git a/config.def.h b/config.def.h diff --git a/config.def.h b/config.def.h
index 1c0b587..e69f288 100644 index a2ac963..87ac198 100644
--- a/config.def.h --- a/config.def.h
+++ b/config.def.h +++ b/config.def.h
@@ -1,21 +1,22 @@ @@ -1,21 +1,23 @@
/* See LICENSE file for copyright and license details. */ /* See LICENSE file for copyright and license details. */
/* appearance */ /* appearance */
@ -22,12 +22,8 @@ index 1c0b587..e69f288 100644
-static const unsigned int snap = 32; /* snap pixel */ -static const unsigned int snap = 32; /* snap pixel */
-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 unsigned int borderpx = 1; /* border pixel of windows */ -static const char *fonts[] = { "monospace:size=10" };
+static unsigned int snap = 32; /* snap pixel */ -static const char dmenufont[] = "monospace:size=10";
+static int showbar = 1; /* 0 means no bar */
+static int topbar = 1; /* 0 means bottom bar */
static const char *fonts[] = { "monospace:size=10" };
static const char dmenufont[] = "monospace:size=10";
-static const char col_gray1[] = "#222222"; -static const char col_gray1[] = "#222222";
-static const char col_gray2[] = "#444444"; -static const char col_gray2[] = "#444444";
-static const char col_gray3[] = "#bbbbbb"; -static const char col_gray3[] = "#bbbbbb";
@ -37,6 +33,13 @@ index 1c0b587..e69f288 100644
- /* fg bg border */ - /* fg bg border */
- [SchemeNorm] = { col_gray3, col_gray1, col_gray2 }, - [SchemeNorm] = { col_gray3, col_gray1, col_gray2 },
- [SchemeSel] = { col_gray4, col_cyan, col_cyan }, - [SchemeSel] = { col_gray4, col_cyan, col_cyan },
+static unsigned int borderpx = 1; /* border pixel of windows */
+static unsigned int snap = 32; /* snap pixel */
+static int showbar = 1; /* 0 means no bar */
+static int topbar = 1; /* 0 means bottom bar */
+static char font[] = "monospace:size=10";
+static char dmenufont[] = "monospace:size=10";
+static const char *fonts[] = { font };
+static char normbgcolor[] = "#222222"; +static char normbgcolor[] = "#222222";
+static char normbordercolor[] = "#444444"; +static char normbordercolor[] = "#444444";
+static char normfgcolor[] = "#bbbbbb"; +static char normfgcolor[] = "#bbbbbb";
@ -50,7 +53,7 @@ index 1c0b587..e69f288 100644
}; };
/* tagging */ /* tagging */
@@ -32,9 +33,9 @@ static const Rule rules[] = { @@ -32,9 +34,9 @@ static const Rule rules[] = {
}; };
/* layout(s) */ /* layout(s) */
@ -60,10 +63,10 @@ index 1c0b587..e69f288 100644
+static float mfact = 0.55; /* factor of master area size [0.05..0.95] */ +static float mfact = 0.55; /* factor of master area size [0.05..0.95] */
+static int nmaster = 1; /* number of clients in master area */ +static int nmaster = 1; /* number of clients in master area */
+static int resizehints = 1; /* 1 means respect size hints in tiled resizals */ +static int resizehints = 1; /* 1 means respect size hints in tiled resizals */
static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */
static const Layout layouts[] = { static const Layout layouts[] = {
/* symbol arrange function */ @@ -57,9 +59,30 @@ static const Layout layouts[] = {
@@ -56,9 +57,28 @@ 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() */
@ -75,6 +78,8 @@ index 1c0b587..e69f288 100644
+ * Xresources preferences to load at startup + * Xresources preferences to load at startup
+ */ + */
+ResourcePref resources[] = { +ResourcePref resources[] = {
+ { "font", STRING, &font },
+ { "dmenufont", STRING, &dmenufont },
+ { "normbgcolor", STRING, &normbgcolor }, + { "normbgcolor", STRING, &normbgcolor },
+ { "normbordercolor", STRING, &normbordercolor }, + { "normbordercolor", STRING, &normbordercolor },
+ { "normfgcolor", STRING, &normfgcolor }, + { "normfgcolor", STRING, &normfgcolor },
@ -120,7 +125,7 @@ index 4bcd5ad..42b04ce 100644
/* Cursor abstraction */ /* Cursor abstraction */
Cur *drw_cur_create(Drw *drw, int shape); Cur *drw_cur_create(Drw *drw, int shape);
diff --git a/dwm.c b/dwm.c diff --git a/dwm.c b/dwm.c
index 9fd0286..dc0d219 100644 index 5e4d494..2214b19 100644
--- a/dwm.c --- a/dwm.c
+++ b/dwm.c +++ b/dwm.c
@@ -36,6 +36,7 @@ @@ -36,6 +36,7 @@
@ -231,5 +236,5 @@ index 9fd0286..dc0d219 100644
#ifdef __OpenBSD__ #ifdef __OpenBSD__
if (pledge("stdio rpath proc exec", NULL) == -1) if (pledge("stdio rpath proc exec", NULL) == -1)
-- --
2.26.2 2.33.0