diff --git a/st-xrdb/.footprint b/st-xrdb/.footprint new file mode 100644 index 000000000..c5a5ff60d --- /dev/null +++ b/st-xrdb/.footprint @@ -0,0 +1,7 @@ +drwxr-xr-x root/root usr/ +drwxr-xr-x root/root usr/bin/ +-rwxr-xr-x root/root usr/bin/st +drwxr-xr-x root/root usr/share/ +drwxr-xr-x root/root usr/share/man/ +drwxr-xr-x root/root usr/share/man/man1/ +-rw-r--r-- root/root usr/share/man/man1/st.1.gz diff --git a/st-xrdb/.signature b/st-xrdb/.signature new file mode 100644 index 000000000..9dd0a2355 --- /dev/null +++ b/st-xrdb/.signature @@ -0,0 +1,6 @@ +untrusted comment: verify with /etc/ports/stenur.pub +RWQEMWjN1NA435WI1z1mzkcWmD5FV2/fOZP2j9M95I6uayJqiKXKmAAYFq5Dm5NhAwPKkVRPB3rASChkdrv6hsWUmWr55Rll2Qo= +SHA256 (Pkgfile) = a851c6d51f52b8717b22bb8a25b15c1860f614109bd4599adb8bc1fbe24426d6 +SHA256 (.footprint) = 691a6289f6a50fbf5ac809a9575739a0cf939045f0b1b24f28847765a13a620b +SHA256 (st-0.8.4.tar.gz) = d42d3ceceb4d6a65e32e90a5336e3d446db612c3fbd9ebc1780bc6c9a03346a6 +SHA256 (st-xrdb.patch) = fde468790e3574f1ebfc9e56742e17e5eca33ee94e6b093b58f2e61457c9938c diff --git a/st-xrdb/Pkgfile b/st-xrdb/Pkgfile new file mode 100644 index 000000000..dae2dd07b --- /dev/null +++ b/st-xrdb/Pkgfile @@ -0,0 +1,26 @@ +# Description: Simple terminal emulator for X, with X resource support (patch) +# URL: https://st.suckless.org +# Maintainer: Steffen Nurpmeso, steffen at sdaoden dot eu +# Depends on: fontconfig freetype xorg-libx11 xorg-libxext xorg-libxft + +name=st-xrdb +version=0.8.4 +release=2 +realn=st +source=(https://dl.suckless.org/$realn/$realn-$version.tar.gz \ + st-xrdb.patch) + +build() { + cd $realn-$version + + patch -p1 -i $SRC/st-xrdb.patch + + sed -i '/tic/d' Makefile + + make CC="${CC:-cc}" PREFIX=/usr \ + X11INC=/usr/include/X11 X11LIB=/usr/lib \ + DESTDIR="$PKG" \ + all install +} + +# s-sh-mode diff --git a/st-xrdb/st-xrdb.patch b/st-xrdb/st-xrdb.patch new file mode 100644 index 000000000..9a7fddfb7 --- /dev/null +++ b/st-xrdb/st-xrdb.patch @@ -0,0 +1,204 @@ +diff --git a/config.def.h b/config.def.h +index 6f05dce..b1c2ccc 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -120,6 +120,8 @@ static const char *colorname[] = { + /* more colors can be added after 255 to use with DefaultXX */ + "#cccccc", + "#555555", ++ "gray90", ++ "black" + }; + + +@@ -127,8 +129,8 @@ static const char *colorname[] = { + * Default colors (colorname index) + * foreground, background, cursor, reverse cursor + */ +-unsigned int defaultfg = 7; +-unsigned int defaultbg = 0; ++unsigned int defaultfg = 258; ++unsigned int defaultbg = 259; + static unsigned int defaultcs = 256; + static unsigned int defaultrcs = 257; + +@@ -168,6 +170,42 @@ static unsigned int defaultattr = 11; + */ + static uint forcemousemod = ShiftMask; + ++/* ++ * Xresources preferences to load at startup ++ */ ++ResourcePref resources[] = { ++ { "font", STRING, &font }, ++ { "color0", STRING, &colorname[0] }, ++ { "color1", STRING, &colorname[1] }, ++ { "color2", STRING, &colorname[2] }, ++ { "color3", STRING, &colorname[3] }, ++ { "color4", STRING, &colorname[4] }, ++ { "color5", STRING, &colorname[5] }, ++ { "color6", STRING, &colorname[6] }, ++ { "color7", STRING, &colorname[7] }, ++ { "color8", STRING, &colorname[8] }, ++ { "color9", STRING, &colorname[9] }, ++ { "color10", STRING, &colorname[10] }, ++ { "color11", STRING, &colorname[11] }, ++ { "color12", STRING, &colorname[12] }, ++ { "color13", STRING, &colorname[13] }, ++ { "color14", STRING, &colorname[14] }, ++ { "color15", STRING, &colorname[15] }, ++ { "background", STRING, &colorname[259] }, ++ { "foreground", STRING, &colorname[258] }, ++ { "cursorColor", STRING, &colorname[256] }, ++ { "termname", STRING, &termname }, ++ { "shell", STRING, &shell }, ++ { "minlatency", INTEGER, &minlatency }, ++ { "maxlatency", INTEGER, &maxlatency }, ++ { "blinktimeout", INTEGER, &blinktimeout }, ++ { "bellvolume", INTEGER, &bellvolume }, ++ { "tabspaces", INTEGER, &tabspaces }, ++ { "borderpx", INTEGER, &borderpx }, ++ { "cwscale", FLOAT, &cwscale }, ++ { "chscale", FLOAT, &chscale }, ++}; ++ + /* + * Internal mouse shortcuts. + * Beware that overloading Button1 will disable the selection. +@@ -175,10 +213,12 @@ static uint forcemousemod = ShiftMask; + static MouseShortcut mshortcuts[] = { + /* mask button function argument release */ + { XK_ANY_MOD, Button2, selpaste, {.i = 0}, 1 }, ++ /* + { ShiftMask, Button4, ttysend, {.s = "\033[5;2~"} }, + { XK_ANY_MOD, Button4, ttysend, {.s = "\031"} }, + { ShiftMask, Button5, ttysend, {.s = "\033[6;2~"} }, + { XK_ANY_MOD, Button5, ttysend, {.s = "\005"} }, ++ */ + }; + + /* Internal keyboard shortcuts. */ +diff --git a/x.c b/x.c +index 210f184..76f167f 100644 +--- a/x.c ++++ b/x.c +@@ -14,6 +14,7 @@ + #include + #include + #include ++#include + + char *argv0; + #include "arg.h" +@@ -45,6 +46,19 @@ typedef struct { + signed char appcursor; /* application cursor */ + } Key; + ++/* Xresources preferences */ ++enum resource_type { ++ STRING = 0, ++ INTEGER = 1, ++ FLOAT = 2 ++}; ++ ++typedef struct { ++ char *name; ++ enum resource_type type; ++ void *dst; ++} ResourcePref; ++ + /* X modifiers */ + #define XK_ANY_MOD UINT_MAX + #define XK_NO_MOD 0 +@@ -828,8 +842,8 @@ xclear(int x1, int y1, int x2, int y2) + void + xhints(void) + { +- XClassHint class = {opt_name ? opt_name : termname, +- opt_class ? opt_class : termname}; ++ XClassHint class = {opt_name ? opt_name : "st", ++ opt_class ? opt_class : "St"}; + XWMHints wm = {.flags = InputHint, .input = 1}; + XSizeHints *sizeh; + +@@ -1104,8 +1118,6 @@ xinit(int cols, int rows) + pid_t thispid = getpid(); + XColor xmousefg, xmousebg; + +- if (!(xw.dpy = XOpenDisplay(NULL))) +- die("can't open display\n"); + xw.scr = XDefaultScreen(xw.dpy); + xw.vis = XDefaultVisual(xw.dpy, xw.scr); + +@@ -1964,6 +1976,59 @@ run(void) + } + } + ++int ++resource_load(XrmDatabase db, char *name, enum resource_type rtype, void *dst) ++{ ++ char **sdst = dst; ++ int *idst = dst; ++ float *fdst = dst; ++ ++ char fullname[256]; ++ char fullclass[256]; ++ char *type; ++ XrmValue ret; ++ ++ snprintf(fullname, sizeof(fullname), "%s.%s", ++ opt_name ? opt_name : "st", name); ++ snprintf(fullclass, sizeof(fullclass), "%s.%s", ++ opt_class ? opt_class : "St", name); ++ fullname[sizeof(fullname) - 1] = fullclass[sizeof(fullclass) - 1] = '\0'; ++ ++ XrmGetResource(db, fullname, fullclass, &type, &ret); ++ if (ret.addr == NULL || strncmp("String", type, 64)) ++ return 1; ++ ++ switch (rtype) { ++ case STRING: ++ *sdst = ret.addr; ++ break; ++ case INTEGER: ++ *idst = strtoul(ret.addr, NULL, 10); ++ break; ++ case FLOAT: ++ *fdst = strtof(ret.addr, NULL); ++ break; ++ } ++ return 0; ++} ++ ++void ++config_init(void) ++{ ++ char *resm; ++ XrmDatabase db; ++ ResourcePref *p; ++ ++ XrmInitialize(); ++ resm = XResourceManagerString(xw.dpy); ++ if (!resm) ++ return; ++ ++ db = XrmGetStringDatabase(resm); ++ for (p = resources; p < resources + LEN(resources); p++) ++ resource_load(db, p->name, p->type, p->dst); ++} ++ + void + usage(void) + { +@@ -2037,6 +2102,11 @@ run: + + setlocale(LC_CTYPE, ""); + XSetLocaleModifiers(""); ++ ++ if(!(xw.dpy = XOpenDisplay(NULL))) ++ die("Can't open display\n"); ++ ++ config_init(); + cols = MAX(cols, 1); + rows = MAX(rows, 1); + tnew(cols, rows);