From c0bd976881f7d77e052e8b6c92bb80f3c376e825 Mon Sep 17 00:00:00 2001 From: Benjamin Chausse Date: Tue, 8 Dec 2020 20:12:54 -0500 Subject: Current st configuration --- .Xdefaults | 2 +- config.def.h | 18 ++++++++---------- config.mk | 2 +- st.h | 1 + x.c | 2 ++ 5 files changed, 13 insertions(+), 12 deletions(-) diff --git a/.Xdefaults b/.Xdefaults index 05b5e2e..6e3d442 100644 --- 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 index c179518..840ae86 100644 --- 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 index eba98c3..e04e321 100644 --- 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 index 94ce5c3..0caef30 100644 --- 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 index c09392b..7fdf546 100644 --- 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)) -- cgit v1.2.3