commit a947a49

hovercats  ·  2024-01-20 16:01:59 +0000 UTC
parent ce2b71b
st: add
10 files changed,  +364, -0
+17, -0
 1@@ -0,0 +1,17 @@
 2+#!/bin/sh -e
 3+
 4+for p in *.patch; do
 5+	patch -p1 < "$p"
 6+done
 7+
 8+# uncomment everything here to build it statically
 9+sed 's/--libs fontconfig/--libs --static fontconfig/' config.mk > _
10+mv -f _ config.mk 
11+sed 's/--libs freetype2/--libs --static freetype2/' config.mk > _
12+mv -f _ config.mk
13+
14+make \
15+	LDFLAGS="$LDFLAGS -static-pie -lX11 -lXft \
16+	-lxcb -lX11-xcb -lXrender -lXau" \
17+	CFLAGS="$CFLAGS -fPIE"
18+make PREFIX=/ DESTDIR="$1" install
+6, -0
1@@ -0,0 +1,6 @@
2+b61834181186c9c7b740b2feb8a0d39c99d6c15b5076a29862fc0bb3c89f27aa9e
3+a79d4baca110087248fc79928a7d5c6deedf6a3ce64d96e4c5769628b128f7e101
4+039cd65296f78888998e73b9e5b7ad37fac6844fd9d51daa33faddf0376da7bbca
5+e6d59e013c60877e06fbffc01d18df0798169698be007b889ee70d6b297af5a85a
6+ab5bb6c9c98845c06af71e119c14bc6763d7675a4af4a5721b5d1255b33c99249e
7+d4146c590ee3440c9c36a68d98d49bc2e9edeaeba4c72609b5e2063b9504ae7703
+4, -0
1@@ -0,0 +1,4 @@
2+fontconfig make
3+libX11 make
4+libXft make
5+pkgconf make
+164, -0
  1@@ -0,0 +1,164 @@
  2+From b9434fb961cf2f26a774e982072b9f99afb8324f Mon Sep 17 00:00:00 2001
  3+From: hovercats <hovercatswithlasereyes@protonmail.com>
  4+Date: Mon, 28 Aug 2023 21:44:09 +0000
  5+Subject: [PATCH 1/5] apply font2 patch
  6+
  7+---
  8+ config.def.h |   7 +++-
  9+ x.c          | 101 +++++++++++++++++++++++++++++++++++++++++++++++++++
 10+ 2 files changed, 107 insertions(+), 1 deletion(-)
 11+
 12+diff --git a/config.def.h b/config.def.h
 13+index 91ab8ca..6129b7a 100644
 14+--- a/config.def.h
 15++++ b/config.def.h
 16+@@ -5,7 +5,12 @@
 17+  *
 18+  * font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html
 19+  */
 20+-static char *font = "Liberation Mono:pixelsize=12:antialias=true:autohint=true";
 21++static char *font = "Tamzen:pixelsize=14:antialias=true:autohint=true";
 22++/* Spare fonts */
 23++static char *font2[] = {
 24++"Liberation Mono:pixelsize=12:antialias=true:autohint=true",
 25++};
 26++
 27+ static int borderpx = 2;
 28+ 
 29+ /*
 30+diff --git a/x.c b/x.c
 31+index 2a3bd38..24db59d 100644
 32+--- a/x.c
 33++++ b/x.c
 34+@@ -157,6 +157,8 @@ static void xhints(void);
 35+ static int xloadcolor(int, const char *, Color *);
 36+ static int xloadfont(Font *, FcPattern *);
 37+ static void xloadfonts(const char *, double);
 38++static int xloadsparefont(FcPattern *, int);
 39++static void xloadsparefonts(void);
 40+ static void xunloadfont(Font *);
 41+ static void xunloadfonts(void);
 42+ static void xsetenv(void);
 43+@@ -306,6 +308,7 @@ zoomabs(const Arg *arg)
 44+ {
 45+ 	xunloadfonts();
 46+ 	xloadfonts(usedfont, arg->f);
 47++	xloadsparefonts();
 48+ 	cresize(0, 0);
 49+ 	redraw();
 50+ 	xhints();
 51+@@ -1050,6 +1053,101 @@ xloadfonts(const char *fontstr, double fontsize)
 52+ 	FcPatternDestroy(pattern);
 53+ }
 54+ 
 55++int
 56++xloadsparefont(FcPattern *pattern, int flags)
 57++{
 58++	FcPattern *match;
 59++	FcResult result;
 60++	
 61++	match = FcFontMatch(NULL, pattern, &result);
 62++	if (!match) {
 63++		return 1;
 64++	}
 65++
 66++	if (!(frc[frclen].font = XftFontOpenPattern(xw.dpy, match))) {
 67++		FcPatternDestroy(match);
 68++		return 1;
 69++	}
 70++
 71++	frc[frclen].flags = flags;
 72++	/* Believe U+0000 glyph will present in each default font */
 73++	frc[frclen].unicodep = 0;
 74++	frclen++;
 75++
 76++	return 0;
 77++}
 78++
 79++void
 80++xloadsparefonts(void)
 81++{
 82++	FcPattern *pattern;
 83++	double sizeshift, fontval;
 84++	int fc;
 85++	char **fp;
 86++
 87++	if (frclen != 0)
 88++		die("can't embed spare fonts. cache isn't empty");
 89++
 90++	/* Calculate count of spare fonts */
 91++	fc = sizeof(font2) / sizeof(*font2);
 92++	if (fc == 0)
 93++		return;
 94++
 95++	/* Allocate memory for cache entries. */
 96++	if (frccap < 4 * fc) {
 97++		frccap += 4 * fc - frccap;
 98++		frc = xrealloc(frc, frccap * sizeof(Fontcache));
 99++	}
100++
101++	for (fp = font2; fp - font2 < fc; ++fp) {
102++	
103++		if (**fp == '-')
104++			pattern = XftXlfdParse(*fp, False, False);
105++		else
106++			pattern = FcNameParse((FcChar8 *)*fp);
107++	
108++		if (!pattern)
109++			die("can't open spare font %s\n", *fp);
110++	   		
111++		if (defaultfontsize > 0) {
112++			sizeshift = usedfontsize - defaultfontsize;
113++			if (sizeshift != 0 &&
114++					FcPatternGetDouble(pattern, FC_PIXEL_SIZE, 0, &fontval) ==
115++					FcResultMatch) {	
116++				fontval += sizeshift;
117++				FcPatternDel(pattern, FC_PIXEL_SIZE);
118++				FcPatternDel(pattern, FC_SIZE);
119++				FcPatternAddDouble(pattern, FC_PIXEL_SIZE, fontval);
120++			}
121++		}
122++	
123++		FcPatternAddBool(pattern, FC_SCALABLE, 1);
124++	
125++		FcConfigSubstitute(NULL, pattern, FcMatchPattern);
126++		XftDefaultSubstitute(xw.dpy, xw.scr, pattern);
127++	
128++		if (xloadsparefont(pattern, FRC_NORMAL))
129++			die("can't open spare font %s\n", *fp);
130++	
131++		FcPatternDel(pattern, FC_SLANT);
132++		FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ITALIC);
133++		if (xloadsparefont(pattern, FRC_ITALIC))
134++			die("can't open spare font %s\n", *fp);
135++			
136++		FcPatternDel(pattern, FC_WEIGHT);
137++		FcPatternAddInteger(pattern, FC_WEIGHT, FC_WEIGHT_BOLD);
138++		if (xloadsparefont(pattern, FRC_ITALICBOLD))
139++			die("can't open spare font %s\n", *fp);
140++	
141++		FcPatternDel(pattern, FC_SLANT);
142++		FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ROMAN);
143++		if (xloadsparefont(pattern, FRC_BOLD))
144++			die("can't open spare font %s\n", *fp);
145++	
146++		FcPatternDestroy(pattern);
147++	}
148++}
149++
150+ void
151+ xunloadfont(Font *f)
152+ {
153+@@ -1147,6 +1245,9 @@ xinit(int cols, int rows)
154+ 	usedfont = (opt_font == NULL)? font : opt_font;
155+ 	xloadfonts(usedfont, 0);
156+ 
157++	/* spare fonts */
158++	xloadsparefonts();
159++
160+ 	/* colors */
161+ 	xw.cmap = XDefaultColormap(xw.dpy, xw.scr);
162+ 	xloadcols();
163+-- 
164+2.42.0
165+
+25, -0
 1@@ -0,0 +1,25 @@
 2+From b4883c0ee8d8d942aabfb05784175f493c1275ae Mon Sep 17 00:00:00 2001
 3+From: hovercats <hovercatswithlasereyes@protonmail.com>
 4+Date: Mon, 28 Aug 2023 21:44:42 +0000
 5+Subject: [PATCH 2/5] set borderpx to 5
 6+
 7+---
 8+ config.def.h | 2 +-
 9+ 1 file changed, 1 insertion(+), 1 deletion(-)
10+
11+diff --git a/config.def.h b/config.def.h
12+index 6129b7a..56061ca 100644
13+--- a/config.def.h
14++++ b/config.def.h
15+@@ -11,7 +11,7 @@ static char *font2[] = {
16+ "Liberation Mono:pixelsize=12:antialias=true:autohint=true",
17+ };
18+ 
19+-static int borderpx = 2;
20++static int borderpx = 5;
21+ 
22+ /*
23+  * What program is execed by st depends of these precedence rules:
24+-- 
25+2.42.0
26+
+25, -0
 1@@ -0,0 +1,25 @@
 2+From cee38be0ca69b3c4ad972808720af935c64ed2fd Mon Sep 17 00:00:00 2001
 3+From: hovercats <hovercatswithlasereyes@protonmail.com>
 4+Date: Mon, 28 Aug 2023 21:47:50 +0000
 5+Subject: [PATCH 3/5] set default cursor to _
 6+
 7+---
 8+ config.def.h | 2 +-
 9+ 1 file changed, 1 insertion(+), 1 deletion(-)
10+
11+diff --git a/config.def.h b/config.def.h
12+index 56061ca..baaf407 100644
13+--- a/config.def.h
14++++ b/config.def.h
15+@@ -146,7 +146,7 @@ static unsigned int defaultrcs = 257;
16+  * 6: Bar ("|")
17+  * 7: Snowman ("☃")
18+  */
19+-static unsigned int cursorshape = 2;
20++static unsigned int cursorshape = 4;
21+ 
22+ /*
23+  * Default columns and rows numbers
24+-- 
25+2.42.0
26+
+35, -0
 1@@ -0,0 +1,35 @@
 2+From 5c0786247cb0dc5774a60df83b8798e088eb7fa7 Mon Sep 17 00:00:00 2001
 3+From: hovercats <hovercatswithlasereyes@protonmail.com>
 4+Date: Mon, 28 Aug 2023 21:50:05 +0000
 5+Subject: [PATCH 4/5] switch keybindings for zoom and copy/paste
 6+
 7+---
 8+ config.def.h | 12 +++++-------
 9+ 1 file changed, 5 insertions(+), 7 deletions(-)
10+
11+diff --git a/config.def.h b/config.def.h
12+index baaf407..bd75078 100644
13+--- a/config.def.h
14++++ b/config.def.h
15+@@ -198,13 +198,11 @@ static Shortcut shortcuts[] = {
16+ 	{ ControlMask,          XK_Print,       toggleprinter,  {.i =  0} },
17+ 	{ ShiftMask,            XK_Print,       printscreen,    {.i =  0} },
18+ 	{ XK_ANY_MOD,           XK_Print,       printsel,       {.i =  0} },
19+-	{ TERMMOD,              XK_Prior,       zoom,           {.f = +1} },
20+-	{ TERMMOD,              XK_Next,        zoom,           {.f = -1} },
21+-	{ TERMMOD,              XK_Home,        zoomreset,      {.f =  0} },
22+-	{ TERMMOD,              XK_C,           clipcopy,       {.i =  0} },
23+-	{ TERMMOD,              XK_V,           clippaste,      {.i =  0} },
24+-	{ TERMMOD,              XK_Y,           selpaste,       {.i =  0} },
25+-	{ ShiftMask,            XK_Insert,      selpaste,       {.i =  0} },
26++	{ MODKEY,               XK_KP_Add,      zoom,           {.f = +1} },
27++	{ MODKEY,               XK_KP_Subtract, zoom,           {.f = -1} },
28++	{ MODKEY,               XK_equal,       zoomreset,      {.f =  0} },
29++	{ MODKEY,               XK_c,           clipcopy,       {.i =  0} },
30++	{ MODKEY,               XK_v,           clippaste,      {.i =  0} },
31+ 	{ TERMMOD,              XK_Num_Lock,    numlock,        {.i =  0} },
32+ };
33+ 
34+-- 
35+2.42.0
36+
+81, -0
 1@@ -0,0 +1,81 @@
 2+From 0149ac4bd9ac49ff2f42a6b79056eaf0375ba244 Mon Sep 17 00:00:00 2001
 3+From: hovercats <hovercatswithlasereyes@protonmail.com>
 4+Date: Mon, 28 Aug 2023 21:51:35 +0000
 5+Subject: [PATCH 5/5] switch colorscheme
 6+
 7+---
 8+ config.def.h | 51 ++++++++++++++++++++++-----------------------------
 9+ 1 file changed, 22 insertions(+), 29 deletions(-)
10+
11+diff --git a/config.def.h b/config.def.h
12+index bd75078..baa0429 100644
13+--- a/config.def.h
14++++ b/config.def.h
15+@@ -101,42 +101,35 @@ unsigned int tabspaces = 8;
16+ /* Terminal colors (16 first used in escape sequence) */
17+ static const char *colorname[] = {
18+ 	/* 8 normal colors */
19+-	"black",
20+-	"red3",
21+-	"green3",
22+-	"yellow3",
23+-	"blue2",
24+-	"magenta3",
25+-	"cyan3",
26+-	"gray90",
27++ [0] = "#1d1d1d", /* black    */
28++ [1] = "#755a5b", /* red      */
29++ [2] = "#68755a", /* green    */
30++ [3] = "#756e5a", /* yellow   */
31++ [4] = "#5b6976", /* blue     */
32++ [5] = "#755b76", /* magenta  */
33++ [6] = "#465457", /* cyan     */
34++ [7] = "#ccccc6", /* white    */
35+ 
36+ 	/* 8 bright colors */
37+-	"gray50",
38+-	"red",
39+-	"green",
40+-	"yellow",
41+-	"#5c5cff",
42+-	"magenta",
43+-	"cyan",
44+-	"white",
45+-
46+-	[255] = 0,
47+-
48+-	/* more colors can be added after 255 to use with DefaultXX */
49+-	"#cccccc",
50+-	"#555555",
51+-	"gray90", /* default foreground colour */
52+-	"black", /* default background colour */
53+-};
54++ [8]  = "#5a5b5c", /* black   */
55++ [9]  = "#a37679", /* red     */
56++ [10] = "#87a376", /* green   */
57++ [11] = "#a39b76", /* yellow  */
58++ [12] = "#758ba3", /* blue    */
59++ [13] = "#9f76a3", /* magenta */
60++ [14] = "#899ca1", /* cyan    */
61++ [15] = "#f8f8f2", /* white   */
62++
63+ 
64++};
65+ 
66+ /*
67+  * Default colors (colorname index)
68+- * foreground, background, cursor, reverse cursor
69++ * foreground, background, cursor
70+  */
71+-unsigned int defaultfg = 258;
72+-unsigned int defaultbg = 259;
73+-unsigned int defaultcs = 256;
74++unsigned int defaultfg = 15;
75++unsigned int defaultbg = 0;
76++unsigned int defaultcs = 15;
77+ static unsigned int defaultrcs = 257;
78+ 
79+ /*
80+-- 
81+2.42.0
82+
+6, -0
1@@ -0,0 +1,6 @@
2+https://dl.suckless.org/st/st-0.9.tar.gz
3+patches/0001-apply-font2-patch.patch
4+patches/0002-set-borderpx-to-5.patch
5+patches/0003-set-default-cursor-to-_.patch
6+patches/0004-switch-keybindings-for-zoom-and-copy-paste.patch
7+patches/0005-switch-colorscheme.patch
+1, -0
1@@ -0,0 +1 @@
2+0.9 1