aboutsummaryrefslogtreecommitdiffstats
path: root/x.c
diff options
context:
space:
mode:
authorNikita Langer <nikitalanger@icloud.com>2026-05-31 15:33:29 +0200
committerNikita Langer <nikitalanger@icloud.com>2026-05-31 15:33:29 +0200
commit066416f76425a2784ef880826f47ad7b5fac7d43 (patch)
tree3b0ccd97f400b03dd1847011b975238be64fa402 /x.c
parent22c5f5f866d967d3d41f651c14f3a2fd11da0038 (diff)
downloadst-066416f76425a2784ef880826f47ad7b5fac7d43.tar.gz
st-066416f76425a2784ef880826f47ad7b5fac7d43.tar.bz2
st-066416f76425a2784ef880826f47ad7b5fac7d43.tar.xz
st-066416f76425a2784ef880826f47ad7b5fac7d43.zip
Cycle Fonts
Diffstat (limited to 'x.c')
-rw-r--r--x.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/x.c b/x.c
index 57ca715..8ff82cf 100644
--- a/x.c
+++ b/x.c
@@ -60,6 +60,7 @@ static void zoom(const Arg *);
static void zoomabs(const Arg *);
static void zoomreset(const Arg *);
static void ttysend(const Arg *);
+static void cyclefonts(const Arg *);
/* config.h for applying patches and the configuration. */
#include "config.h"
@@ -337,11 +338,7 @@ void
zoomreset(const Arg *arg)
{
Arg larg;
-
- if (defaultfontsize > 0) {
- larg.f = defaultfontsize;
- zoomabs(&larg);
- }
+ zoomabs(&larg);
}
void
@@ -350,6 +347,17 @@ ttysend(const Arg *arg)
ttywrite(arg->s, strlen(arg->s), 1);
}
+void
+cyclefonts(const Arg *arg)
+{
+ currentfont++;
+ currentfont %= (sizeof fonts / sizeof fonts[0]);
+ usedfont = fonts[currentfont];
+ Arg larg;
+ larg.f = usedfontsize;
+ zoomabs(&larg);
+}
+
int
evcol(XEvent *e)
{
@@ -1299,7 +1307,7 @@ xinit(int cols, int rows)
if (!FcInit())
die("could not init fontconfig.\n");
- usedfont = (opt_font == NULL)? font : opt_font;
+ usedfont = (opt_font == NULL)? fonts[currentfont] : opt_font;
xloadfonts(usedfont, 0);
/* colors */