commit c0bd976881f7d77e052e8b6c92bb80f3c376e825
parent bc28a24ca5eb34712d679118e5856c3d574a3df3
Author: Benjamin Chausse <benjamin@chausse.xyz>
Date:   Tue,  8 Dec 2020 20:12:54 -0500

Current st configuration

Diffstat:
M.Xdefaults | 2+-
Mconfig.def.h | 18++++++++----------
Mconfig.mk | 2+-
Mst.h | 1+
Mx.c | 2++
5 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/.Xdefaults b/.Xdefaults @@ -5,7 +5,7 @@ st.alpha: 0.92 st.font: Monospace-11; ! st.termname: st-256color -! st.borderpx: 2 +! st.borderperc: 20 !! Set the background, foreground and cursor colors as below: *.background: #282828 diff --git a/config.def.h b/config.def.h @@ -4,13 +4,15 @@ * appearance * * font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html + * borderperc: percentage of cell width to use as a border + * 0 = no border, 100 = border width is same as cell width */ static char *font = "monospace:pixelsize=16:antialias=true:autohint=true"; static char *font2[] = { "Spleen 32x64:pixelsize=15:antialias=true:autohint=true" }; -static int borderpx = 2; +static int borderperc = 20; /* - * What program is executed by st depends of these precedence rules: + * What program is execed by st depends of these precedence rules: * 1: program passed with -e * 2: utmp option * 3: SHELL environment variable @@ -115,10 +117,6 @@ static const char *colorname[] = { "#ebdbb2", [255] = 0, /* more colors can be added after 255 to use with DefaultXX */ - "#add8e6", /* 256 -> cursor */ - "#555555", /* 257 -> rev cursor*/ - "#0c1012", /* 258 -> bg */ - "#ebdbb2", /* 259 -> fg */ }; @@ -126,11 +124,11 @@ static const char *colorname[] = { * Default colors (colorname index) * foreground, background, cursor, reverse cursor */ -unsigned int defaultfg = 259; +unsigned int defaultfg = 3; unsigned int defaultbg = 0; /* unsigned int defaultbg = 258; */ -static unsigned int defaultcs = 256; -static unsigned int defaultrcs = 257; +static unsigned int defaultcs = 3; +static unsigned int defaultrcs = 6; /* * Default shape of cursor @@ -193,7 +191,7 @@ ResourcePref resources[] = { { "blinktimeout", INTEGER, &blinktimeout }, { "bellvolume", INTEGER, &bellvolume }, { "tabspaces", INTEGER, &tabspaces }, - { "borderpx", INTEGER, &borderpx }, + { "borderperc", INTEGER, &borderperc }, { "cwscale", FLOAT, &cwscale }, { "chscale", FLOAT, &chscale }, { "alpha", FLOAT, &alpha }, diff --git a/config.mk b/config.mk @@ -32,4 +32,4 @@ STLDFLAGS = $(LIBS) $(LDFLAGS) # `pkg-config --libs freetype2` # compiler and linker -# CC = c99 + CC = tcc diff --git a/st.h b/st.h @@ -52,6 +52,7 @@ enum selection_snap { SNAP_LINE = 2 }; +int borderpx; typedef unsigned char uchar; typedef unsigned int uint; typedef unsigned long ulong; diff --git a/x.c b/x.c @@ -1008,6 +1008,8 @@ xloadfonts(char *fontstr, double fontsize) win.ch = ceilf(dc.font.height * chscale); win.cyo = ceilf(dc.font.height * (chscale - 1) / 2); + borderpx = ceilf(((float)borderperc / 100) * win.cw); + FcPatternDel(pattern, FC_SLANT); FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ITALIC); if (xloadfont(&dc.ifont, pattern))