summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzachir <zachir@librem.one>2023-02-20 03:45:53 -0600
committerzachir <zachir@librem.one>2023-02-20 03:45:53 -0600
commit3a52163eab96b628346a24c4922aa24ea2fc3bad (patch)
tree79793932c00c661e6d8746a936c2694dbb5a4b8d
parentee92619d4974bd0b290857941759d83539a38433 (diff)
add relativeborder patch
-rw-r--r--config.def.h4
-rw-r--r--patches/st-relativeborder-0.8.3.diff39
-rw-r--r--st.h1
-rw-r--r--x.c2
4 files changed, 45 insertions, 1 deletions
diff --git a/config.def.h b/config.def.h
index 7baf499..1969a54 100644
--- a/config.def.h
+++ b/config.def.h
@@ -4,6 +4,8 @@
* 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 = "Liberation Mono:pixelsize=12:antialias=true:autohint=true";
/* Spare fonts */
@@ -13,7 +15,7 @@ static char *font2[] = {
"Symbola:pixelsize=12:antialias=true:autohint=true"
};
-static int borderpx = 2;
+static int borderperc = 2;
/*
* What program is execed by st depends of these precedence rules:
diff --git a/patches/st-relativeborder-0.8.3.diff b/patches/st-relativeborder-0.8.3.diff
new file mode 100644
index 0000000..55839d2
--- /dev/null
+++ b/patches/st-relativeborder-0.8.3.diff
@@ -0,0 +1,39 @@
+diff -up ../st-0.8.3/config.def.h ./config.def.h
+--- ../st-0.8.3/config.def.h 2020-04-27 13:58:27.000000000 +0200
++++ ./config.def.h 2020-05-24 18:27:19.179361165 +0200
+@@ -4,9 +4,11 @@
+ * 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 = "Liberation Mono:pixelsize=12:antialias=true:autohint=true";
+-static int borderpx = 2;
++static int borderperc = 20;
+
+ /*
+ * What program is execed by st depends of these precedence rules:
+diff -up ../st-0.8.3/st.h ./st.h
+--- ../st-0.8.3/st.h 2020-04-27 13:58:27.000000000 +0200
++++ ./st.h 2020-05-24 18:27:20.255369735 +0200
+@@ -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 -up ../st-0.8.3/x.c ./x.c
+--- ../st-0.8.3/x.c 2020-04-27 13:58:27.000000000 +0200
++++ ./x.c 2020-05-24 18:27:17.551348200 +0200
+@@ -1001,6 +1001,8 @@ xloadfonts(char *fontstr, double fontsiz
+ win.cw = ceilf(dc.font.width * cwscale);
+ win.ch = ceilf(dc.font.height * chscale);
+
++ borderpx = ceilf(((float)borderperc / 100) * win.cw);
++
+ FcPatternDel(pattern, FC_SLANT);
+ FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ITALIC);
+ if (xloadfont(&dc.ifont, pattern))
diff --git a/st.h b/st.h
index c8dc0f9..cb9aa30 100644
--- a/st.h
+++ b/st.h
@@ -95,6 +95,7 @@ void sendbreak(const Arg *);
void toggleprinter(const Arg *);
void copyurl(const Arg *);
+static int borderpx;
int tattrset(int);
int tisaltscr(void);
void tnew(int, int);
diff --git a/x.c b/x.c
index 282e916..054b52f 100644
--- a/x.c
+++ b/x.c
@@ -1074,6 +1074,8 @@ xloadfonts(const char *fontstr, double fontsize)
win.cw = ceilf(dc.font.width * cwscale);
win.ch = ceilf(dc.font.height * chscale);
+ borderpx = ceilf(((float)borderperc / 100) * win.cw);
+
FcPatternDel(pattern, FC_SLANT);
FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ITALIC);
if (xloadfont(&dc.ifont, pattern))