st

Custom st fork
git clone git://git.deurzen.net/st
Log | Files | Refs | README | LICENSE

commit e055767752f437d1d6051bcab3a8e568cc695609
parent b937efc530b45c52f53f13671be90d7c8a07ba67
Author: deurzen <m.deurzen@tum.de>
Date:   Thu, 14 Jan 2021 01:42:03 +0100

applies st-cyclefonts-0.8.4

Diffstat:
Mconfig.def.h | 8+++++++-
Mx.c | 17+++++++++++++++--
2 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/config.def.h b/config.def.h @@ -5,7 +5,12 @@ * * font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html */ -static char *font = "Liberation Mono:pixelsize=12:antialias=true:autohint=true"; +static char *fonts[] = { + "Liberation Mono:pixelsize=12:antialias=true:autohint=true", + "tewi:pixelsize=12:antialias=true:autohint=true" +}; +static int fonts_current = 0; + static int borderpx = 2; /* @@ -199,6 +204,7 @@ static Shortcut shortcuts[] = { { TERMMOD, XK_Y, selpaste, {.i = 0} }, { ShiftMask, XK_Insert, selpaste, {.i = 0} }, { TERMMOD, XK_Num_Lock, numlock, {.i = 0} }, + { TERMMOD, XK_S, cyclefonts, {} }, }; /* diff --git a/x.c b/x.c @@ -59,6 +59,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" @@ -950,6 +951,18 @@ xloadfont(Font *f, FcPattern *pattern) } void +cyclefonts(const Arg *dummy) +{ + fonts_current++; + if (fonts_current > (sizeof fonts / sizeof fonts[0]) - 1) { + fonts_current = 0; + } + usedfont = fonts[fonts_current]; + xloadfonts(fonts[fonts_current], 0); + redraw(); +} + +void xloadfonts(char *fontstr, double fontsize) { FcPattern *pattern; @@ -1113,8 +1126,8 @@ xinit(int cols, int rows) if (!FcInit()) die("could not init fontconfig.\n"); - usedfont = (opt_font == NULL)? font : opt_font; - xloadfonts(usedfont, 0); + usedfont = fonts[fonts_current]; + xloadfonts(fonts[fonts_current], 0); /* colors */ xw.cmap = XDefaultColormap(xw.dpy, xw.scr);