auto-st


Logs | Files | LICENSE | LICENSE | GitLab


1
commit 2ce74acad4a95804bf1cb7f2a3506b568e9ea71d
2
Author: Connor Etherington <[email protected]>
3
Date:   Mon Jan 10 06:51:33 2022 +0200
4
5
    Update.
6
---
7
 FUNDING.yml    |    2 +
8
 LICENSE        |   34 +
9
 Makefile       |   64 ++
10
 PKGBUILD       |   43 +
11
 Xdefaults      |  128 +++
12
 arg.h          |   50 +
13
 boxdraw.c      |  194 ++++
14
 boxdraw.o      |  Bin 0 -> 7728 bytes
15
 boxdraw_data.h |  214 +++++
16
 config.h       |  559 ++++++++++++
17
 config.mk      |   37 +
18
 hb.c           |  140 +++
19
 hb.h           |    7 +
20
 hb.o           |  Bin 0 -> 4592 bytes
21
 st             |  Bin 0 -> 120984 bytes
22
 st-copyout     |   13 +
23
 st-urlhandler  |   19 +
24
 st.1           |  193 ++++
25
 st.c           | 2761 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
26
 st.h           |  143 +++
27
 st.info        |  239 +++++
28
 st.o           |  Bin 0 -> 79752 bytes
29
 win.h          |   40 +
30
 x.c            | 2317 +++++++++++++++++++++++++++++++++++++++++++++++
31
 x.o            |  Bin 0 -> 88472 bytes
32
 25 files changed, 7197 insertions(+)
33
34
diff --git a/FUNDING.yml b/FUNDING.yml
35
new file mode 100644
36
index 0000000..c7c9a22
37
--- /dev/null
38
+++ b/FUNDING.yml
39
@@ -0,0 +1,2 @@
40
+custom: ["https://lukesmith.xyz/donate.html"]
41
+github: lukesmithxyz
42
diff --git a/LICENSE b/LICENSE
43
new file mode 100644
44
index 0000000..d80eb47
45
--- /dev/null
46
+++ b/LICENSE
47
@@ -0,0 +1,34 @@
48
+MIT/X Consortium License
49
+
50
+© 2014-2020 Hiltjo Posthuma <hiltjo at codemadness dot org>
51
+© 2018 Devin J. Pohly <djpohly at gmail dot com>
52
+© 2014-2017 Quentin Rameau <quinq at fifth dot space>
53
+© 2009-2012 Aurélien APTEL <aurelien dot aptel at gmail dot com>
54
+© 2008-2017 Anselm R Garbe <garbeam at gmail dot com>
55
+© 2012-2017 Roberto E. Vargas Caballero <k0ga at shike2 dot com>
56
+© 2012-2016 Christoph Lohmann <20h at r-36 dot net>
57
+© 2013 Eon S. Jeon <esjeon at hyunmu dot am>
58
+© 2013 Alexander Sedov <alex0player at gmail dot com>
59
+© 2013 Mark Edgar <medgar123 at gmail dot com>
60
+© 2013-2014 Eric Pruitt <eric.pruitt at gmail dot com>
61
+© 2013 Michael Forney <mforney at mforney dot org>
62
+© 2013-2014 Markus Teich <markus dot teich at stusta dot mhn dot de>
63
+© 2014-2015 Laslo Hunhold <dev at frign dot de>
64
+
65
+Permission is hereby granted, free of charge, to any person obtaining a
66
+copy of this software and associated documentation files (the "Software"),
67
+to deal in the Software without restriction, including without limitation
68
+the rights to use, copy, modify, merge, publish, distribute, sublicense,
69
+and/or sell copies of the Software, and to permit persons to whom the
70
+Software is furnished to do so, subject to the following conditions:
71
+
72
+The above copyright notice and this permission notice shall be included in
73
+all copies or substantial portions of the Software.
74
+
75
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
76
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
77
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
78
+THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
79
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
80
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
81
+DEALINGS IN THE SOFTWARE.
82
diff --git a/Makefile b/Makefile
83
new file mode 100644
84
index 0000000..0e9d2d9
85
--- /dev/null
86
+++ b/Makefile
87
@@ -0,0 +1,64 @@
88
+# st - simple terminal
89
+# See LICENSE file for copyright and license details.
90
+.POSIX:
91
+
92
+include config.mk
93
+
94
+SRC = st.c x.c boxdraw.c hb.c
95
+OBJ = $(SRC:.c=.o)
96
+
97
+all: options st
98
+
99
+options:
100
+	@echo st build options:
101
+	@echo "CFLAGS  = $(STCFLAGS)"
102
+	@echo "LDFLAGS = $(STLDFLAGS)"
103
+	@echo "CC      = $(CC)"
104
+
105
+.c.o:
106
+	$(CC) $(STCFLAGS) -c $<
107
+
108
+st.o: config.h st.h win.h
109
+x.o: arg.h config.h st.h win.h hb.h
110
+hb.o: st.h
111
+boxdraw.o: config.h st.h boxdraw_data.h
112
+
113
+$(OBJ): config.h config.mk
114
+
115
+st: $(OBJ)
116
+	$(CC) -o $@ $(OBJ) $(STLDFLAGS)
117
+
118
+clean:
119
+	rm -f st $(OBJ) st-$(VERSION).tar.gz *.rej *.orig *.o
120
+
121
+dist: clean
122
+	mkdir -p st-$(VERSION)
123
+	cp -R FAQ LEGACY TODO LICENSE Makefile README config.mk\
124
+		config.h st.info st.1 arg.h st.h win.h $(SRC)\
125
+		st-$(VERSION)
126
+	tar -cf - st-$(VERSION) | gzip > st-$(VERSION).tar.gz
127
+	rm -rf st-$(VERSION)
128
+
129
+install: st
130
+	git submodule init
131
+	git submodule update
132
+	mkdir -p $(DESTDIR)$(PREFIX)/bin
133
+	cp -f st $(DESTDIR)$(PREFIX)/bin
134
+	cp -f st-copyout $(DESTDIR)$(PREFIX)/bin
135
+	cp -f st-urlhandler $(DESTDIR)$(PREFIX)/bin
136
+	chmod 755 $(DESTDIR)$(PREFIX)/bin/st
137
+	chmod 755 $(DESTDIR)$(PREFIX)/bin/st-copyout
138
+	chmod 755 $(DESTDIR)$(PREFIX)/bin/st-urlhandler
139
+	mkdir -p $(DESTDIR)$(MANPREFIX)/man1
140
+	sed "s/VERSION/$(VERSION)/g" < st.1 > $(DESTDIR)$(MANPREFIX)/man1/st.1
141
+	chmod 644 $(DESTDIR)$(MANPREFIX)/man1/st.1
142
+	tic -sx st.info
143
+	@echo Please see the README file regarding the terminfo entry of st.
144
+
145
+uninstall:
146
+	rm -f $(DESTDIR)$(PREFIX)/bin/st
147
+	rm -f $(DESTDIR)$(PREFIX)/bin/st-copyout
148
+	rm -f $(DESTDIR)$(PREFIX)/bin/st-urlhandler
149
+	rm -f $(DESTDIR)$(MANPREFIX)/man1/st.1
150
+
151
+.PHONY: all options clean dist install uninstall
152
diff --git a/PKGBUILD b/PKGBUILD
153
new file mode 100644
154
index 0000000..424b99d
155
--- /dev/null
156
+++ b/PKGBUILD
157
@@ -0,0 +1,43 @@
158
+
159
+pkgname=concise-st
160
+_pkgname=st
161
+pkgver=0.8.2.r1062.2087ab9
162
+pkgrel=1
163
+epoch=1
164
+pkgdesc="Concise fork of the suckless st terminal inspired by luke smith. "
165
+url='https://git.concise.cc/st'
166
+arch=('i686' 'x86_64')
167
+license=('MIT')
168
+options=('zipman')
169
+depends=('libxft')
170
+makedepends=('ncurses' 'libxext' 'git')
171
+optdepends=('dmenu: feed urls to dmenu')
172
+source=('https://git.concise.cc/st')
173
+sha1sums=('SKIP')
174
+
175
+provides=("${_pkgname}")
176
+conflicts=("${_pkgname}")
177
+
178
+pkgver() {
179
+	cd "${_pkgname}"
180
+	printf "%s.r%s.%s" "$(awk '/^VERSION =/ {print $3}' config.mk)" \
181
+		"$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
182
+}
183
+
184
+prepare() {
185
+	cd $srcdir/${_pkgname}
186
+	sed -i '/tic /d' Makefile
187
+}
188
+
189
+build() {
190
+	cd "${_pkgname}"
191
+	make X11INC=/usr/include/X11 X11LIB=/usr/lib/X11
192
+}
193
+
194
+package() {
195
+	cd "${_pkgname}"
196
+	make PREFIX=/usr DESTDIR="${pkgdir}" install
197
+	install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
198
+	install -Dm644 README.md "${pkgdir}/usr/share/doc/${pkgname}/README.md"
199
+	install -Dm644 Xdefaults "${pkgdir}/usr/share/doc/${pkgname}/Xdefaults.example"
200
+}
201
diff --git a/Xdefaults b/Xdefaults
202
new file mode 100644
203
index 0000000..eecfff1
204
--- /dev/null
205
+++ b/Xdefaults
206
@@ -0,0 +1,128 @@
207
+!! Transparency (0-1):
208
+st.alpha: 0.9
209
+st.alphaOffset: 0.3
210
+
211
+!! Set a default font and font size as below:
212
+st.font: Monospace-11;
213
+
214
+! st.termname: st-256color
215
+! st.borderpx: 2
216
+
217
+!! Set the background, foreground and cursor colors as below:
218
+
219
+!! gruvbox:
220
+*.color0: #1d2021
221
+*.color1: #cc241d
222
+*.color2: #98971a
223
+*.color3: #d79921
224
+*.color4: #458588
225
+*.color5: #b16286
226
+*.color6: #689d6a
227
+*.color7: #a89984
228
+*.color8: #928374
229
+*.color9: #fb4934
230
+*.color10: #b8bb26
231
+*.color11: #fabd2f
232
+*.color12: #83a598
233
+*.color13: #d3869b
234
+*.color14: #8ec07c
235
+*.color15: #ebdbb2
236
+*.background: #282828
237
+*.foreground: white
238
+*.cursorColor: white
239
+
240
+/* /1* !! gruvbox light: *1/ */
241
+/* *.color0: #fbf1c7 */
242
+/* *.color1: #cc241d */
243
+/* *.color2: #98971a */
244
+/* *.color3: #d79921 */
245
+/* *.color4: #458588 */
246
+/* *.color5: #b16286 */
247
+/* *.color6: #689d6a */
248
+/* *.color7: #7c6f64 */
249
+/* *.color8: #928374 */
250
+/* *.color9: #9d0006 */
251
+/* *.color10: #79740e */
252
+/* *.color11: #b57614 */
253
+/* *.color12: #076678 */
254
+/* *.color13: #8f3f71 */
255
+/* *.color14: #427b58 */
256
+/* *.color15: #3c3836 */
257
+/* *.background: #fbf1c7 */
258
+/* *.foreground: #282828 */
259
+/* *.cursorColor: #282828 */
260
+
261
+/* !! brogrammer: */
262
+/* *.foreground:  #d6dbe5 */
263
+/* *.background:  #131313 */
264
+/* *.color0:      #1f1f1f */
265
+/* *.color8:      #d6dbe5 */
266
+/* *.color1:      #f81118 */
267
+/* *.color9:      #de352e */
268
+/* *.color2:      #2dc55e */
269
+/* *.color10:     #1dd361 */
270
+/* *.color3:      #ecba0f */
271
+/* *.color11:     #f3bd09 */
272
+/* *.color4:      #2a84d2 */
273
+/* *.color12:     #1081d6 */
274
+/* *.color5:      #4e5ab7 */
275
+/* *.color13:     #5350b9 */
276
+/* *.color6:      #1081d6 */
277
+/* *.color14:     #0f7ddb */
278
+/* *.color7:      #d6dbe5 */
279
+/* *.color15:     #ffffff */
280
+/* *.colorBD:     #d6dbe5 */
281
+
282
+/* ! base16 */
283
+/* *.color0:       #181818 */
284
+/* *.color1:       #ab4642 */
285
+/* *.color2:       #a1b56c */
286
+/* *.color3:       #f7ca88 */
287
+/* *.color4:       #7cafc2 */
288
+/* *.color5:       #ba8baf */
289
+/* *.color6:       #86c1b9 */
290
+/* *.color7:       #d8d8d8 */
291
+/* *.color8:       #585858 */
292
+/* *.color9:       #ab4642 */
293
+/* *.color10:      #a1b56c */
294
+/* *.color11:      #f7ca88 */
295
+/* *.color12:      #7cafc2 */
296
+/* *.color13:      #ba8baf */
297
+/* *.color14:      #86c1b9 */
298
+/* *.color15:      #f8f8f8 */
299
+
300
+/* !! solarized */
301
+/* *.color0:	#073642 */
302
+/* *.color1:	#dc322f */
303
+/* *.color2:	#859900 */
304
+/* *.color3:	#b58900 */
305
+/* *.color4:	#268bd2 */
306
+/* *.color5:	#d33682 */
307
+/* *.color6:	#2aa198 */
308
+/* *.color7:	#eee8d5 */
309
+/* *.color9:	#cb4b16 */
310
+/* *.color8:	#fdf6e3 */
311
+/* *.color10:	#586e75 */
312
+/* *.color11:	#657b83 */
313
+/* *.color12:	#839496 */
314
+/* *.color13:	#6c71c4 */
315
+/* *.color14:	#93a1a1 */
316
+/* *.color15:	#fdf6e3 */
317
+
318
+/* !! xterm */
319
+/* *.color0:   #000000 */
320
+/* *.color1:   #cd0000 */
321
+/* *.color2:   #00cd00 */
322
+/* *.color3:   #cdcd00 */
323
+/* *.color4:   #0000cd */
324
+/* *.color5:   #cd00cd */
325
+/* *.color6:   #00cdcd */
326
+/* *.color7:   #e5e5e5 */
327
+/* *.color8:   #4d4d4d */
328
+/* *.color9:   #ff0000 */
329
+/* *.color10:  #00ff00 */
330
+/* *.color11:  #ffff00 */
331
+/* *.color12:  #0000ff */
332
+/* *.color13:  #ff00ff */
333
+/* *.color14:  #00ffff */
334
+/* *.color15:  #aabac8 */
335
diff --git a/arg.h b/arg.h
336
new file mode 100644
337
index 0000000..a22e019
338
--- /dev/null
339
+++ b/arg.h
340
@@ -0,0 +1,50 @@
341
+/*
342
+ * Copy me if you can.
343
+ * by 20h
344
+ */
345
+
346
+#ifndef ARG_H__
347
+#define ARG_H__
348
+
349
+extern char *argv0;
350
+
351
+/* use main(int argc, char *argv[]) */
352
+#define ARGBEGIN	for (argv0 = *argv, argv++, argc--;\
353
+					argv[0] && argv[0][0] == '-'\
354
+					&& argv[0][1];\
355
+					argc--, argv++) {\
356
+				char argc_;\
357
+				char **argv_;\
358
+				int brk_;\
359
+				if (argv[0][1] == '-' && argv[0][2] == '\0') {\
360
+					argv++;\
361
+					argc--;\
362
+					break;\
363
+				}\
364
+				int i_;\
365
+				for (i_ = 1, brk_ = 0, argv_ = argv;\
366
+						argv[0][i_] && !brk_;\
367
+						i_++) {\
368
+					if (argv_ != argv)\
369
+						break;\
370
+					argc_ = argv[0][i_];\
371
+					switch (argc_)
372
+
373
+#define ARGEND			}\
374
+			}
375
+
376
+#define ARGC()		argc_
377
+
378
+#define EARGF(x)	((argv[0][i_+1] == '\0' && argv[1] == NULL)?\
379
+				((x), abort(), (char *)0) :\
380
+				(brk_ = 1, (argv[0][i_+1] != '\0')?\
381
+					(&argv[0][i_+1]) :\
382
+					(argc--, argv++, argv[0])))
383
+
384
+#define ARGF()		((argv[0][i_+1] == '\0' && argv[1] == NULL)?\
385
+				(char *)0 :\
386
+				(brk_ = 1, (argv[0][i_+1] != '\0')?\
387
+					(&argv[0][i_+1]) :\
388
+					(argc--, argv++, argv[0])))
389
+
390
+#endif
391
diff --git a/boxdraw.c b/boxdraw.c
392
new file mode 100644
393
index 0000000..28a92d0
394
--- /dev/null
395
+++ b/boxdraw.c
396
@@ -0,0 +1,194 @@
397
+/*
398
+ * Copyright 2018 Avi Halachmi (:avih) [email protected] https://github.com/avih
399
+ * MIT/X Consortium License
400
+ */
401
+
402
+#include <X11/Xft/Xft.h>
403
+#include "st.h"
404
+#include "boxdraw_data.h"
405
+
406
+/* Rounded non-negative integers division of n / d  */
407
+#define DIV(n, d) (((n) + (d) / 2) / (d))
408
+
409
+static Display *xdpy;
410
+static Colormap xcmap;
411
+static XftDraw *xd;
412
+static Visual *xvis;
413
+
414
+static void drawbox(int, int, int, int, XftColor *, XftColor *, ushort);
415
+static void drawboxlines(int, int, int, int, XftColor *, ushort);
416
+
417
+/* public API */
418
+
419
+void
420
+boxdraw_xinit(Display *dpy, Colormap cmap, XftDraw *draw, Visual *vis)
421
+{
422
+	xdpy = dpy; xcmap = cmap; xd = draw, xvis = vis;
423
+}
424
+
425
+int
426
+isboxdraw(Rune u)
427
+{
428
+	Rune block = u & ~0xff;
429
+	return (boxdraw && block == 0x2500 && boxdata[(uint8_t)u]) ||
430
+	       (boxdraw_braille && block == 0x2800);
431
+}
432
+
433
+/* the "index" is actually the entire shape data encoded as ushort */
434
+ushort
435
+boxdrawindex(const Glyph *g)
436
+{
437
+	if (boxdraw_braille && (g->u & ~0xff) == 0x2800)
438
+		return BRL | (uint8_t)g->u;
439
+	if (boxdraw_bold && (g->mode & ATTR_BOLD))
440
+		return BDB | boxdata[(uint8_t)g->u];
441
+	return boxdata[(uint8_t)g->u];
442
+}
443
+
444
+void
445
+drawboxes(int x, int y, int cw, int ch, XftColor *fg, XftColor *bg,
446
+          const XftGlyphFontSpec *specs, int len)
447
+{
448
+	for ( ; len-- > 0; x += cw, specs++)
449
+		drawbox(x, y, cw, ch, fg, bg, (ushort)specs->glyph);
450
+}
451
+
452
+/* implementation */
453
+
454
+void
455
+drawbox(int x, int y, int w, int h, XftColor *fg, XftColor *bg, ushort bd)
456
+{
457
+	ushort cat = bd & ~(BDB | 0xff);  /* mask out bold and data */
458
+	if (bd & (BDL | BDA)) {
459
+		/* lines (light/double/heavy/arcs) */
460
+		drawboxlines(x, y, w, h, fg, bd);
461
+
462
+	} else if (cat == BBD) {
463
+		/* lower (8-X)/8 block */
464
+		int d = DIV((uint8_t)bd * h, 8);
465
+		XftDrawRect(xd, fg, x, y + d, w, h - d);
466
+
467
+	} else if (cat == BBU) {
468
+		/* upper X/8 block */
469
+		XftDrawRect(xd, fg, x, y, w, DIV((uint8_t)bd * h, 8));
470
+
471
+	} else if (cat == BBL) {
472
+		/* left X/8 block */
473
+		XftDrawRect(xd, fg, x, y, DIV((uint8_t)bd * w, 8), h);
474
+
475
+	} else if (cat == BBR) {
476
+		/* right (8-X)/8 block */
477
+		int d = DIV((uint8_t)bd * w, 8);
478
+		XftDrawRect(xd, fg, x + d, y, w - d, h);
479
+
480
+	} else if (cat == BBQ) {
481
+		/* Quadrants */
482
+		int w2 = DIV(w, 2), h2 = DIV(h, 2);
483
+		if (bd & TL)
484
+			XftDrawRect(xd, fg, x, y, w2, h2);
485
+		if (bd & TR)
486
+			XftDrawRect(xd, fg, x + w2, y, w - w2, h2);
487
+		if (bd & BL)
488
+			XftDrawRect(xd, fg, x, y + h2, w2, h - h2);
489
+		if (bd & BR)
490
+			XftDrawRect(xd, fg, x + w2, y + h2, w - w2, h - h2);
491
+
492
+	} else if (bd & BBS) {
493
+		/* Shades - data is 1/2/3 for 25%/50%/75% alpha, respectively */
494
+		int d = (uint8_t)bd;
495
+		XftColor xfc;
496
+		XRenderColor xrc = { .alpha = 0xffff };
497
+
498
+		xrc.red = DIV(fg->color.red * d + bg->color.red * (4 - d), 4);
499
+		xrc.green = DIV(fg->color.green * d + bg->color.green * (4 - d), 4);
500
+		xrc.blue = DIV(fg->color.blue * d + bg->color.blue * (4 - d), 4);
501
+
502
+		XftColorAllocValue(xdpy, xvis, xcmap, &xrc, &xfc);
503
+		XftDrawRect(xd, &xfc, x, y, w, h);
504
+		XftColorFree(xdpy, xvis, xcmap, &xfc);
505
+
506
+	} else if (cat == BRL) {
507
+		/* braille, each data bit corresponds to one dot at 2x4 grid */
508
+		int w1 = DIV(w, 2);
509
+		int h1 = DIV(h, 4), h2 = DIV(h, 2), h3 = DIV(3 * h, 4);
510
+
511
+		if (bd & 1)   XftDrawRect(xd, fg, x, y, w1, h1);
512
+		if (bd & 2)   XftDrawRect(xd, fg, x, y + h1, w1, h2 - h1);
513
+		if (bd & 4)   XftDrawRect(xd, fg, x, y + h2, w1, h3 - h2);
514
+		if (bd & 8)   XftDrawRect(xd, fg, x + w1, y, w - w1, h1);
515
+		if (bd & 16)  XftDrawRect(xd, fg, x + w1, y + h1, w - w1, h2 - h1);
516
+		if (bd & 32)  XftDrawRect(xd, fg, x + w1, y + h2, w - w1, h3 - h2);
517
+		if (bd & 64)  XftDrawRect(xd, fg, x, y + h3, w1, h - h3);
518
+		if (bd & 128) XftDrawRect(xd, fg, x + w1, y + h3, w - w1, h - h3);
519
+
520
+	}
521
+}
522
+
523
+void
524
+drawboxlines(int x, int y, int w, int h, XftColor *fg, ushort bd)
525
+{
526
+	/* s: stem thickness. width/8 roughly matches underscore thickness. */
527
+	/* We draw bold as 1.5 * normal-stem and at least 1px thicker.      */
528
+	/* doubles draw at least 3px, even when w or h < 3. bold needs 6px. */
529
+	int mwh = MIN(w, h);
530
+	int base_s = MAX(1, DIV(mwh, 8));
531
+	int bold = (bd & BDB) && mwh >= 6;  /* possibly ignore boldness */
532
+	int s = bold ? MAX(base_s + 1, DIV(3 * base_s, 2)) : base_s;
533
+	int w2 = DIV(w - s, 2), h2 = DIV(h - s, 2);
534
+	/* the s-by-s square (x + w2, y + h2, s, s) is the center texel.    */
535
+	/* The base length (per direction till edge) includes this square.  */
536
+
537
+	int light = bd & (LL | LU | LR | LD);
538
+	int double_ = bd & (DL | DU | DR | DD);
539
+
540
+	if (light) {
541
+		/* d: additional (negative) length to not-draw the center   */
542
+		/* texel - at arcs and avoid drawing inside (some) doubles  */
543
+		int arc = bd & BDA;
544
+		int multi_light = light & (light - 1);
545
+		int multi_double = double_ & (double_ - 1);
546
+		/* light crosses double only at DH+LV, DV+LH (ref. shapes)  */
547
+		int d = arc || (multi_double && !multi_light) ? -s : 0;
548
+
549
+		if (bd & LL)
550
+			XftDrawRect(xd, fg, x, y + h2, w2 + s + d, s);
551
+		if (bd & LU)
552
+			XftDrawRect(xd, fg, x + w2, y, s, h2 + s + d);
553
+		if (bd & LR)
554
+			XftDrawRect(xd, fg, x + w2 - d, y + h2, w - w2 + d, s);
555
+		if (bd & LD)
556
+			XftDrawRect(xd, fg, x + w2, y + h2 - d, s, h - h2 + d);
557
+	}
558
+
559
+	/* double lines - also align with light to form heavy when combined */
560
+	if (double_) {
561
+		/*
562
+		* going clockwise, for each double-ray: p is additional length
563
+		* to the single-ray nearer to the previous direction, and n to
564
+		* the next. p and n adjust from the base length to lengths
565
+		* which consider other doubles - shorter to avoid intersections
566
+		* (p, n), or longer to draw the far-corner texel (n).
567
+		*/
568
+		int dl = bd & DL, du = bd & DU, dr = bd & DR, dd = bd & DD;
569
+		if (dl) {
570
+			int p = dd ? -s : 0, n = du ? -s : dd ? s : 0;
571
+			XftDrawRect(xd, fg, x, y + h2 + s, w2 + s + p, s);
572
+			XftDrawRect(xd, fg, x, y + h2 - s, w2 + s + n, s);
573
+		}
574
+		if (du) {
575
+			int p = dl ? -s : 0, n = dr ? -s : dl ? s : 0;
576
+			XftDrawRect(xd, fg, x + w2 - s, y, s, h2 + s + p);
577
+			XftDrawRect(xd, fg, x + w2 + s, y, s, h2 + s + n);
578
+		}
579
+		if (dr) {
580
+			int p = du ? -s : 0, n = dd ? -s : du ? s : 0;
581
+			XftDrawRect(xd, fg, x + w2 - p, y + h2 - s, w - w2 + p, s);
582
+			XftDrawRect(xd, fg, x + w2 - n, y + h2 + s, w - w2 + n, s);
583
+		}
584
+		if (dd) {
585
+			int p = dr ? -s : 0, n = dl ? -s : dr ? s : 0;
586
+			XftDrawRect(xd, fg, x + w2 + s, y + h2 - p, s, h - h2 + p);
587
+			XftDrawRect(xd, fg, x + w2 - s, y + h2 - n, s, h - h2 + n);
588
+		}
589
+	}
590
+}
591
diff --git a/boxdraw.o b/boxdraw.o
592
new file mode 100644
593
index 0000000..3080fdc
594
Binary files /dev/null and b/boxdraw.o differ
595
diff --git a/boxdraw_data.h b/boxdraw_data.h
596
new file mode 100644
597
index 0000000..7890500
598
--- /dev/null
599
+++ b/boxdraw_data.h
600
@@ -0,0 +1,214 @@
601
+/*
602
+ * Copyright 2018 Avi Halachmi (:avih) [email protected] https://github.com/avih
603
+ * MIT/X Consortium License
604
+ */
605
+
606
+/*
607
+ * U+25XX codepoints data
608
+ *
609
+ * References:
610
+ *   http://www.unicode.org/charts/PDF/U2500.pdf
611
+ *   http://www.unicode.org/charts/PDF/U2580.pdf
612
+ *
613
+ * Test page:
614
+ *   https://github.com/GNOME/vte/blob/master/doc/boxes.txt
615
+ */
616
+
617
+/* Each shape is encoded as 16-bits. Higher bits are category, lower are data */
618
+/* Categories (mutually exclusive except BDB): */
619
+/* For convenience, BDL/BDA/BBS/BDB are 1 bit each, the rest are enums */
620
+#define BDL (1<<8)   /* Box Draw Lines (light/double/heavy) */
621
+#define BDA (1<<9)   /* Box Draw Arc (light) */
622
+
623
+#define BBD (1<<10)  /* Box Block Down (lower) X/8 */
624
+#define BBL (2<<10)  /* Box Block Left X/8 */
625
+#define BBU (3<<10)  /* Box Block Upper X/8 */
626
+#define BBR (4<<10)  /* Box Block Right X/8 */
627
+#define BBQ (5<<10)  /* Box Block Quadrants */
628
+#define BRL (6<<10)  /* Box Braille (data is lower byte of U28XX) */
629
+
630
+#define BBS (1<<14)  /* Box Block Shades */
631
+#define BDB (1<<15)  /* Box Draw is Bold */
632
+
633
+/* (BDL/BDA) Light/Double/Heavy x Left/Up/Right/Down/Horizontal/Vertical      */
634
+/* Heavy is light+double (literally drawing light+double align to form heavy) */
635
+#define LL (1<<0)
636
+#define LU (1<<1)
637
+#define LR (1<<2)
638
+#define LD (1<<3)
639
+#define LH (LL+LR)
640
+#define LV (LU+LD)
641
+
642
+#define DL (1<<4)
643
+#define DU (1<<5)
644
+#define DR (1<<6)
645
+#define DD (1<<7)
646
+#define DH (DL+DR)
647
+#define DV (DU+DD)
648
+
649
+#define HL (LL+DL)
650
+#define HU (LU+DU)
651
+#define HR (LR+DR)
652
+#define HD (LD+DD)
653
+#define HH (HL+HR)
654
+#define HV (HU+HD)
655
+
656
+/* (BBQ) Quadrants Top/Bottom x Left/Right */
657
+#define TL (1<<0)
658
+#define TR (1<<1)
659
+#define BL (1<<2)
660
+#define BR (1<<3)
661
+
662
+/* Data for U+2500 - U+259F except dashes/diagonals */
663
+static const unsigned short boxdata[256] = {
664
+	/* light lines */
665
+	[0x00] = BDL + LH,       /* light horizontal */
666
+	[0x02] = BDL + LV,       /* light vertical */
667
+	[0x0c] = BDL + LD + LR,  /* light down and right */
668
+	[0x10] = BDL + LD + LL,  /* light down and left */
669
+	[0x14] = BDL + LU + LR,  /* light up and right */
670
+	[0x18] = BDL + LU + LL,  /* light up and left */
671
+	[0x1c] = BDL + LV + LR,  /* light vertical and right */
672
+	[0x24] = BDL + LV + LL,  /* light vertical and left */
673
+	[0x2c] = BDL + LH + LD,  /* light horizontal and down */
674
+	[0x34] = BDL + LH + LU,  /* light horizontal and up */
675
+	[0x3c] = BDL + LV + LH,  /* light vertical and horizontal */
676
+	[0x74] = BDL + LL,       /* light left */
677
+	[0x75] = BDL + LU,       /* light up */
678
+	[0x76] = BDL + LR,       /* light right */
679
+	[0x77] = BDL + LD,       /* light down */
680
+
681
+	/* heavy [+light] lines */
682
+	[0x01] = BDL + HH,
683
+	[0x03] = BDL + HV,
684
+	[0x0d] = BDL + HR + LD,
685
+	[0x0e] = BDL + HD + LR,
686
+	[0x0f] = BDL + HD + HR,
687
+	[0x11] = BDL + HL + LD,
688
+	[0x12] = BDL + HD + LL,
689
+	[0x13] = BDL + HD + HL,
690
+	[0x15] = BDL + HR + LU,
691
+	[0x16] = BDL + HU + LR,
692
+	[0x17] = BDL + HU + HR,
693
+	[0x19] = BDL + HL + LU,
694
+	[0x1a] = BDL + HU + LL,
695
+	[0x1b] = BDL + HU + HL,
696
+	[0x1d] = BDL + HR + LV,
697
+	[0x1e] = BDL + HU + LD + LR,
698
+	[0x1f] = BDL + HD + LR + LU,
699
+	[0x20] = BDL + HV + LR,
700
+	[0x21] = BDL + HU + HR + LD,
701
+	[0x22] = BDL + HD + HR + LU,
702
+	[0x23] = BDL + HV + HR,
703
+	[0x25] = BDL + HL + LV,
704
+	[0x26] = BDL + HU + LD + LL,
705
+	[0x27] = BDL + HD + LU + LL,
706
+	[0x28] = BDL + HV + LL,
707
+	[0x29] = BDL + HU + HL + LD,
708
+	[0x2a] = BDL + HD + HL + LU,
709
+	[0x2b] = BDL + HV + HL,
710
+	[0x2d] = BDL + HL + LD + LR,
711
+	[0x2e] = BDL + HR + LL + LD,
712
+	[0x2f] = BDL + HH + LD,
713
+	[0x30] = BDL + HD + LH,
714
+	[0x31] = BDL + HD + HL + LR,
715
+	[0x32] = BDL + HR + HD + LL,
716
+	[0x33] = BDL + HH + HD,
717
+	[0x35] = BDL + HL + LU + LR,
718
+	[0x36] = BDL + HR + LU + LL,
719
+	[0x37] = BDL + HH + LU,
720
+	[0x38] = BDL + HU + LH,
721
+	[0x39] = BDL + HU + HL + LR,
722
+	[0x3a] = BDL + HU + HR + LL,
723
+	[0x3b] = BDL + HH + HU,
724
+	[0x3d] = BDL + HL + LV + LR,
725
+	[0x3e] = BDL + HR + LV + LL,
726
+	[0x3f] = BDL + HH + LV,
727
+	[0x40] = BDL + HU + LH + LD,
728
+	[0x41] = BDL + HD + LH + LU,
729
+	[0x42] = BDL + HV + LH,
730
+	[0x43] = BDL + HU + HL + LD + LR,
731
+	[0x44] = BDL + HU + HR + LD + LL,
732
+	[0x45] = BDL + HD + HL + LU + LR,
733
+	[0x46] = BDL + HD + HR + LU + LL,
734
+	[0x47] = BDL + HH + HU + LD,
735
+	[0x48] = BDL + HH + HD + LU,
736
+	[0x49] = BDL + HV + HL + LR,
737
+	[0x4a] = BDL + HV + HR + LL,
738
+	[0x4b] = BDL + HV + HH,
739
+	[0x78] = BDL + HL,
740
+	[0x79] = BDL + HU,
741
+	[0x7a] = BDL + HR,
742
+	[0x7b] = BDL + HD,
743
+	[0x7c] = BDL + HR + LL,
744
+	[0x7d] = BDL + HD + LU,
745
+	[0x7e] = BDL + HL + LR,
746
+	[0x7f] = BDL + HU + LD,
747
+
748
+	/* double [+light] lines */
749
+	[0x50] = BDL + DH,
750
+	[0x51] = BDL + DV,
751
+	[0x52] = BDL + DR + LD,
752
+	[0x53] = BDL + DD + LR,
753
+	[0x54] = BDL + DR + DD,
754
+	[0x55] = BDL + DL + LD,
755
+	[0x56] = BDL + DD + LL,
756
+	[0x57] = BDL + DL + DD,
757
+	[0x58] = BDL + DR + LU,
758
+	[0x59] = BDL + DU + LR,
759
+	[0x5a] = BDL + DU + DR,
760
+	[0x5b] = BDL + DL + LU,
761
+	[0x5c] = BDL + DU + LL,
762
+	[0x5d] = BDL + DL + DU,
763
+	[0x5e] = BDL + DR + LV,
764
+	[0x5f] = BDL + DV + LR,
765
+	[0x60] = BDL + DV + DR,
766
+	[0x61] = BDL + DL + LV,
767
+	[0x62] = BDL + DV + LL,
768
+	[0x63] = BDL + DV + DL,
769
+	[0x64] = BDL + DH + LD,
770
+	[0x65] = BDL + DD + LH,
771
+	[0x66] = BDL + DD + DH,
772
+	[0x67] = BDL + DH + LU,
773
+	[0x68] = BDL + DU + LH,
774
+	[0x69] = BDL + DH + DU,
775
+	[0x6a] = BDL + DH + LV,
776
+	[0x6b] = BDL + DV + LH,
777
+	[0x6c] = BDL + DH + DV,
778
+
779
+	/* (light) arcs */
780
+	[0x6d] = BDA + LD + LR,
781
+	[0x6e] = BDA + LD + LL,
782
+	[0x6f] = BDA + LU + LL,
783
+	[0x70] = BDA + LU + LR,
784
+
785
+	/* Lower (Down) X/8 block (data is 8 - X) */
786
+	[0x81] = BBD + 7, [0x82] = BBD + 6, [0x83] = BBD + 5, [0x84] = BBD + 4,
787
+	[0x85] = BBD + 3, [0x86] = BBD + 2, [0x87] = BBD + 1, [0x88] = BBD + 0,
788
+
789
+	/* Left X/8 block (data is X) */
790
+	[0x89] = BBL + 7, [0x8a] = BBL + 6, [0x8b] = BBL + 5, [0x8c] = BBL + 4,
791
+	[0x8d] = BBL + 3, [0x8e] = BBL + 2, [0x8f] = BBL + 1,
792
+
793
+	/* upper 1/2 (4/8), 1/8 block (X), right 1/2, 1/8 block (8-X) */
794
+	[0x80] = BBU + 4, [0x94] = BBU + 1,
795
+	[0x90] = BBR + 4, [0x95] = BBR + 7,
796
+
797
+	/* Quadrants */
798
+	[0x96] = BBQ + BL,
799
+	[0x97] = BBQ + BR,
800
+	[0x98] = BBQ + TL,
801
+	[0x99] = BBQ + TL + BL + BR,
802
+	[0x9a] = BBQ + TL + BR,
803
+	[0x9b] = BBQ + TL + TR + BL,
804
+	[0x9c] = BBQ + TL + TR + BR,
805
+	[0x9d] = BBQ + TR,
806
+	[0x9e] = BBQ + BL + TR,
807
+	[0x9f] = BBQ + BL + TR + BR,
808
+
809
+	/* Shades, data is an alpha value in 25% units (1/4, 1/2, 3/4) */
810
+	[0x91] = BBS + 1, [0x92] = BBS + 2, [0x93] = BBS + 3,
811
+
812
+	/* U+2504 - U+250B, U+254C - U+254F: unsupported (dashes) */
813
+	/* U+2571 - U+2573: unsupported (diagonals) */
814
+};
815
diff --git a/config.h b/config.h
816
new file mode 100644
817
index 0000000..6a65c13
818
--- /dev/null
819
+++ b/config.h
820
@@ -0,0 +1,559 @@
821
+/* See LICENSE file for copyright and license details. */
822
+
823
+/*
824
+ * appearance
825
+ *
826
+ * font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html
827
+ */
828
+
829
+static char *font = "Mononoki Nerd Font:pixelsize=18:antialias=true:autohint=true";
830
+static char *font2[] = { "JoyPixels:pixelsize=10:antialias=true:autohint=true" };
831
+//static char *font = "mono:pixelsize=12:antialias=true:autohint=true";
832
+
833
+static int borderpx = 2;
834
+
835
+/*
836
+ * What program is execed by st depends of these precedence rules:
837
+ * 1: program passed with -e
838
+ * 2: scroll and/or utmp
839
+ * 3: SHELL environment variable
840
+ * 4: value of shell in /etc/passwd
841
+ * 5: value of shell in config.h
842
+ */
843
+static char *shell = "/bin/sh";
844
+char *utmp = NULL;
845
+/* scroll program: to enable use a string like "scroll" */
846
+char *scroll = NULL;
847
+char *stty_args = "stty raw pass8 nl -echo -iexten -cstopb 38400";
848
+
849
+/* identification sequence returned in DA and DECID */
850
+char *vtiden = "\033[?6c";
851
+
852
+/* Kerning / character bounding-box multipliers */
853
+static float cwscale = 1.0;
854
+static float chscale = 1.0;
855
+
856
+/*
857
+ * word delimiter string
858
+ *
859
+ * More advanced example: L" `'\"()[]{}"
860
+ */
861
+wchar_t *worddelimiters = L" ";
862
+
863
+/* selection timeouts (in milliseconds) */
864
+static unsigned int doubleclicktimeout = 300;
865
+static unsigned int tripleclicktimeout = 600;
866
+
867
+/* alt screens */
868
+int allowaltscreen = 1;
869
+
870
+/* allow certain non-interactive (insecure) window operations such as:
871
+   setting the clipboard text */
872
+int allowwindowops = 0;
873
+
874
+/*
875
+ * draw latency range in ms - from new content/keypress/etc until drawing.
876
+ * within this range, st draws when content stops arriving (idle). mostly it's
877
+ * near minlatency, but it waits longer for slow updates to avoid partial draw.
878
+ * low minlatency will tear/flicker more, as it can "detect" idle too early.
879
+ */
880
+static double minlatency = 8;
881
+static double maxlatency = 33;
882
+
883
+/*
884
+ * blinking timeout (set to 0 to disable blinking) for the terminal blinking
885
+ * attribute.
886
+ */
887
+static unsigned int blinktimeout = 800;
888
+
889
+/*
890
+ * thickness of underline and bar cursors
891
+ */
892
+static unsigned int cursorthickness = 2;
893
+
894
+/*
895
+ * 1: render most of the lines/blocks characters without using the font for
896
+ *    perfect alignment between cells (U2500 - U259F except dashes/diagonals).
897
+ *    Bold affects lines thickness if boxdraw_bold is not 0. Italic is ignored.
898
+ * 0: disable (render all U25XX glyphs normally from the font).
899
+ */
900
+const int boxdraw = 1;
901
+const int boxdraw_bold = 0;
902
+
903
+/* braille (U28XX):  1: render as adjacent "pixels",  0: use font */
904
+const int boxdraw_braille = 0;
905
+
906
+/*
907
+ * bell volume. It must be a value between -100 and 100. Use 0 for disabling
908
+ * it
909
+ */
910
+static int bellvolume = 0;
911
+
912
+/* default TERM value */
913
+char *termname = "st-256color";
914
+
915
+/*
916
+ * spaces per tab
917
+ *
918
+ * When you are changing this value, don't forget to adapt the »it« value in
919
+ * the st.info and appropriately install the st.info in the environment where
920
+ * you use this st version.
921
+ *
922
+ *	it#$tabspaces,
923
+ *
924
+ * Secondly make sure your kernel is not expanding tabs. When running `stty
925
+ * -a` »tab0« should appear. You can tell the terminal to not expand tabs by
926
+ *  running following command:
927
+ *
928
+ *	stty tabs
929
+ */
930
+unsigned int tabspaces = 8;
931
+
932
+/* bg opacity */
933
+float alpha = 0.8;
934
+float alphaOffset = 0.0;
935
+float alphaUnfocus;
936
+
937
+/* Terminal colors (16 first used in escape sequence) */
938
+static const char *colorname[] = {
939
+    "#040303",
940
+    "#E3B036",
941
+    "#EEDC5E",
942
+    "#B8118C",
943
+    "#45A59A",
944
+    "#67D0A8",
945
+    "#97E4B0",
946
+    "#CBD9A4",
947
+    "#666666",
948
+    "#E3B036",
949
+    "#EEDC5E",
950
+    "#B8118C",
951
+    "#45A59A",
952
+    "#67D0A8",
953
+    "#97E4B0",
954
+    "#CBD9A4",
955
+	[255] = 0,
956
+	/* more colors can be added after 255 to use with DefaultXX */
957
+	"#add8e6", /* 256 -> cursor */
958
+	"#555555", /* 257 -> rev cursor*/
959
+    "#1C1A1A", 
960
+    "#67D0A8",
961
+};
962
+
963
+
964
+/*
965
+ * Default colors (colorname index)
966
+ * foreground, background, cursor, reverse cursor
967
+ */
968
+unsigned int defaultfg = 259;
969
+unsigned int defaultbg = 258;
970
+unsigned int defaultcs = 256;
971
+unsigned int defaultrcs = 257;
972
+unsigned int background = 258;
973
+
974
+/*
975
+ * Default shape of cursor
976
+ * 2: Block ("█")
977
+ * 4: Underline ("_")
978
+ * 6: Bar ("|")
979
+ * 7: Snowman ("☃")
980
+ */
981
+static unsigned int cursorshape = 2;
982
+
983
+/*
984
+ * Default columns and rows numbers
985
+ */
986
+
987
+static unsigned int cols = 80;
988
+static unsigned int rows = 24;
989
+
990
+/*
991
+ * Default colour and shape of the mouse cursor
992
+ */
993
+static unsigned int mouseshape = XC_xterm;
994
+static unsigned int mousefg = 7;
995
+static unsigned int mousebg = 0;
996
+
997
+/*
998
+ * Color used to display font attributes when fontconfig selected a font which
999
+ * doesn't match the ones requested.