From 83b13ada8e0eca2d3ce3a64caf269686a1a39709 Mon Sep 17 00:00:00 2001 From: Ryan Kes Date: Wed, 13 Mar 2019 10:55:22 +0100 Subject: [PATCH] updated to 0.8.2 --- PKGBUILD | 30 ++--- config.h | 24 ++-- local-disable-bold-italic-fonts.diff | 43 +++++++ local-st-alpha-0.8.2.diff | 161 +++++++++++++++++++++++++++ 4 files changed, 225 insertions(+), 33 deletions(-) create mode 100644 local-disable-bold-italic-fonts.diff create mode 100644 local-st-alpha-0.8.2.diff diff --git a/PKGBUILD b/PKGBUILD index c84cbe2..42462da 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -1,7 +1,7 @@ # Maintainer: Ryan Kes pkgname=st -pkgver=0.8.1 +pkgver=0.8.2 pkgrel=1 pkgdesc='A simple virtual terminal emulator for X.' arch=('i686' 'x86_64') @@ -10,39 +10,31 @@ depends=('libxft' 'libxext' 'nerd-fonts-source-code-pro') makedepends=('ncurses') url="http://st.suckless.org" -_patches=("https://st.suckless.org/patches/clipboard/st-clipboard-0.8.1.diff" - "https://st.suckless.org/patches/scrollback/st-scrollback-0.8.diff" +_patches=("https://st.suckless.org/patches/clipboard/st-clipboard-0.8.2.diff" + "https://st.suckless.org/patches/scrollback/st-scrollback-20190122-3be4cf1.diff" "https://st.suckless.org/patches/scrollback/st-scrollback-mouse-0.8.diff" "https://st.suckless.org/patches/vertcenter/st-vertcenter-20180320-6ac8c8a.diff" - "https://st.suckless.org/patches/alpha/st-alpha-0.8.1.diff" - "https://st.suckless.org/patches/disable_bold_italic_fonts/st-disable-bold-italic-fonts.diff" - "https://st.suckless.org/patches/solarized/st-solarized-dark-20180411-041912a.diff") + "local-st-alpha-0.8.2.diff" + "local-disable-bold-italic-fonts.diff") source=("http://dl.suckless.org/st/$pkgname-$pkgver.tar.gz" "config.h" "${_patches[@]}") -sha256sums=('c4fb0fe2b8d2d3bd5e72763e80a8ae05b7d44dbac8f8e3bb18ef0161c7266926' - '1ee1646c96e2cf788f8ba0a226478f74fb4b77cd521ad688875ec67ba954d85c' - 'f22e0165aacb2bc86d000728c81f68022abcc601dbfd09e516e1ba772225d7e6' - '8279d347c70bc9b36f450ba15e1fd9ff62eedf49ce9258c35d7f1cfe38cca226' +sha256sums=('aeb74e10aa11ed364e1bcc635a81a523119093e63befd2f231f8b0705b15bf35' + '2479b5f9c0b31342e7ede5e37902e84c8ea26a4454e17dc584aa1845eaead129' + '7be1a09831f13361f5659aaad55110bde99b25c8ba826c11d1d7fcec21f32945' + '30c9bcec5801614dd5cc8b96f470d7431e83d5d2af87bb2305df60082e5ab4ed' '3fb38940cc3bad3f9cd1e2a0796ebd0e48950a07860ecf8523a5afd0cd1b5a44' '04e6a4696293f668260b2f54a7240e379dbfabbc209de07bd5d4d57e9f513360' - '7bf61cb8a505891574f3ad0a5420334d3e965b9f7d0067df3819eeef72ce1358' - '206ac98601adead3139eac64a23e28202879b94d6cf61e71e5bf457bde34ed18' - 'b2d5e88a2616eafb82b2fefb63eecb0f9d71f839349ef40f9f69c1953444f88c') + '67b1bdc717e3f7914d04f0c72bc8a3f6efe91790248611c0a2c2dc905bf206bd' + '59d5719a68e2f0e25c44b6ad9fab0d62ee8a6c5bcbcffb38176e9950cda16b15') prepare() { cd $srcdir/$pkgname-$pkgver # skip terminfo which conflicts with nsurses sed -i '/\ttic -sx st.info/d' Makefile - # Modify alpha patch to prevent conflicts - sed -i 's/size_t colornamelen/unsigned int tabspaces/g' "$srcdir/$(basename ${_patches[4]})" - sed -i '7,7d' "$srcdir/$(basename ${_patches[5]})" - sed -i '10,26d' "$srcdir/$(basename ${_patches[5]})" - sed -i '1,68d' "$srcdir/$(basename ${_patches[6]})" - for patch in "${_patches[@]}"; do echo "Applying patch $(basename $patch)..." patch -Np1 -i "$srcdir/$(basename $patch)" diff --git a/config.h b/config.h index 8e4e499..3411ca1 100644 --- a/config.h +++ b/config.h @@ -5,7 +5,13 @@ * * font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html */ -static char *font = "SauceCodePro Nerd Font Mono:style=Regular:pixelsize=12:antialias=true:autohint=true"; +static char *font = "SauceCodePro Nerd Font Mono:style=Regular:pixelsize=18:antialias=true:autohint=true"; + +/* disable bold, italic and roman fonts globally */ +int disablebold = 0; +int disableitalic = 0; +int disableroman = 0; + static int borderpx = 2; /* @@ -83,11 +89,7 @@ char *termname = "xterm-256color"; unsigned int tabspaces = 8; /* bg opacity */ -unsigned int alpha = 0xaa; - -/* alpha */ -#define OPAQUE 0Xff -#define USE_ARGB (alpha != OPAQUE && opt_embed == NULL) +float alpha = 0.8; /* Terminal colors (16 first used in escape sequence) */ static const char *colorname[] = { @@ -116,7 +118,7 @@ static const char *colorname[] = { * foreground, background, cursor, reverse cursor */ unsigned int defaultfg = 12; -unsigned int defaultbg = 257; +unsigned int defaultbg = 258; static unsigned int defaultcs = 14; static unsigned int defaultrcs = 15; @@ -182,7 +184,7 @@ static Shortcut shortcuts[] = { { MODKEY|ShiftMask, XK_C, clipcopy, {.i = 0} }, { MODKEY|ShiftMask, XK_V, clippaste, {.i = 0} }, { MODKEY, XK_Num_Lock, numlock, {.i = 0} }, - { MODKEY, XK_Control_L, iso14755, {.i = 0} }, +// { MODKEY, XK_Control_L, iso14755, {.i = 0} }, { ShiftMask, XK_Page_Up, kscrollup, {.i = -1} }, { ShiftMask, XK_Page_Down, kscrolldown, {.i = -1} }, { MODKEY, XK_k, kscrollup, {.i = 1} }, @@ -471,9 +473,3 @@ static char ascii_printable[] = " !\"#$%&'()*+,-./0123456789:;<=>?" "@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_" "`abcdefghijklmnopqrstuvwxyz{|}~"; - -/* disable bold, italic and roman fonts globally */ -int disablebold = 0; -int disableitalic = 0; -int disableroman = 0; - diff --git a/local-disable-bold-italic-fonts.diff b/local-disable-bold-italic-fonts.diff new file mode 100644 index 0000000..45a885b --- /dev/null +++ b/local-disable-bold-italic-fonts.diff @@ -0,0 +1,43 @@ +diff -up a/config.def.h b/config.def.h +--- a/config.def.h ++++ b/config.def.h +@@ -6,6 +6,12 @@ + * font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html + */ + static char *font = "Liberation Mono:pixelsize=12:antialias=true:autohint=true"; ++ ++/* disable bold, italic and roman fonts globally */ ++int disablebold = 0; ++int disableitalic = 0; ++int disableroman = 0; ++ + static int borderpx = 2; + + /* +diff -up a/x.c b/x.c +--- a/x.c ++++ b/x.c +@@ -231,6 +231,11 @@ static char *usedfont = NULL; + static double usedfontsize = 0; + static double defaultfontsize = 0; + ++/* declared in config.h */ ++extern int disablebold; ++extern int disableitalic; ++extern int disableroman; ++ + static char *opt_alpha = NULL; + static char *opt_class = NULL; + static char **opt_cmd = NULL; +@@ -979,7 +984,10 @@ xloadfonts(char *fontstr, double fontsiz + win.cyo = ceilf(dc.font.height * (chscale - 1) / 2); + + FcPatternDel(pattern, FC_SLANT); +- FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ITALIC); ++ if (!disableitalic) ++ FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ITALIC); ++ if (!disableroman) ++ FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ROMAN); + if (xloadfont(&dc.ifont, pattern)) + die("can't open font %s\n", fontstr); + diff --git a/local-st-alpha-0.8.2.diff b/local-st-alpha-0.8.2.diff new file mode 100644 index 0000000..0317745 --- /dev/null +++ b/local-st-alpha-0.8.2.diff @@ -0,0 +1,161 @@ +diff -up a/config.def.h b/config.def.h +--- a/config.def.h ++++ b/config.def.h +@@ -82,6 +82,9 @@ char *termname = "st-256color"; + */ + unsigned int tabspaces = 8; + ++/* bg opacity */ ++float alpha = 0.8; ++ + /* Terminal colors (16 first used in escape sequence) */ + static const char *colorname[] = { + /* 8 normal colors */ +@@ -109,6 +112,7 @@ static const char *colorname[] = { + /* more colors can be added after 255 to use with DefaultXX */ + "#cccccc", + "#555555", ++ "black", + }; + + +@@ -117,7 +121,7 @@ static const char *colorname[] = { + * foreground, background, cursor, reverse cursor + */ + unsigned int defaultfg = 7; +-unsigned int defaultbg = 0; ++unsigned int defaultbg = 258; + static unsigned int defaultcs = 256; + static unsigned int defaultrcs = 257; + +diff -up a/config.mk b/config.mk +--- a/config.mk ++++ b/config.mk +@@ -16,7 +16,7 @@ PKG_CONFIG = pkg-config + INCS = -I$(X11INC) \ + `$(PKG_CONFIG) --cflags fontconfig` \ + `$(PKG_CONFIG) --cflags freetype2` +-LIBS = -L$(X11LIB) -lm -lrt -lX11 -lutil -lXft \ ++LIBS = -L$(X11LIB) -lm -lrt -lX11 -lutil -lXft -lXrender\ + `$(PKG_CONFIG) --libs fontconfig` \ + `$(PKG_CONFIG) --libs freetype2` + +diff -up a/st.h b/st.h +--- a/st.h ++++ b/st.h +@@ -129,4 +129,5 @@ extern char *termname; + extern unsigned int tabspaces; + extern unsigned int defaultfg; + extern unsigned int defaultbg; ++extern float alpha; + extern MouseKey mkeys[]; +diff -up a/x.c b/x.c +--- a/x.c ++++ b/x.c +@@ -99,6 +99,7 @@ typedef struct { + XSetWindowAttributes attrs; + int scr; + int isfixed; /* is fixed geometry? */ ++ int depth; /* bit depth */ + int l, t; /* left and top offset */ + int gm; /* geometry mask */ + } XWindow; +@@ -230,6 +231,7 @@ static char *usedfont = NULL; + static double usedfontsize = 0; + static double defaultfontsize = 0; + ++static char *opt_alpha = NULL; + static char *opt_class = NULL; + static char **opt_cmd = NULL; + static char *opt_embed = NULL; +@@ -700,7 +702,7 @@ xresize(int col, int row) + + XFreePixmap(xw.dpy, xw.buf); + xw.buf = XCreatePixmap(xw.dpy, xw.win, win.w, win.h, +- DefaultDepth(xw.dpy, xw.scr)); ++ xw.depth); + XftDrawChange(xw.draw, xw.buf); + xclear(0, 0, win.w, win.h); + +@@ -760,6 +762,13 @@ xloadcols(void) + else + die("could not allocate color %d\n", i); + } ++ ++ /* set alpha value of bg color */ ++ if (opt_alpha) ++ alpha = strtof(opt_alpha, NULL); ++ dc.col[defaultbg].color.alpha = (unsigned short)(0xffff * alpha); ++ dc.col[defaultbg].pixel &= 0x00FFFFFF; ++ dc.col[defaultbg].pixel |= (unsigned char)(0xff * alpha) << 24; + loaded = 1; + } + +@@ -1017,12 +1026,25 @@ xinit(int cols, int rows) + Window parent; + pid_t thispid = getpid(); + XColor xmousefg, xmousebg; ++ XWindowAttributes attr; ++ XVisualInfo vis; + + if (!(xw.dpy = XOpenDisplay(NULL))) + die("can't open display\n"); + xw.scr = XDefaultScreen(xw.dpy); + xw.vis = XDefaultVisual(xw.dpy, xw.scr); + ++ if (!(opt_embed && (parent = strtol(opt_embed, NULL, 0)))) { ++ parent = XRootWindow(xw.dpy, xw.scr); ++ xw.depth = 32; ++ } else { ++ XGetWindowAttributes(xw.dpy, parent, &attr); ++ xw.depth = attr.depth; ++ } ++ ++ XMatchVisualInfo(xw.dpy, xw.scr, xw.depth, TrueColor, &vis); ++ xw.vis = vis.visual; ++ + /* font */ + if (!FcInit()) + die("could not init fontconfig.\n"); +@@ -1031,7 +1053,7 @@ xinit(int cols, int rows) + xloadfonts(usedfont, 0); + + /* colors */ +- xw.cmap = XDefaultColormap(xw.dpy, xw.scr); ++ xw.cmap = XCreateColormap(xw.dpy, parent, xw.vis, None); + xloadcols(); + + /* adjust fixed window geometry */ +@@ -1051,19 +1073,15 @@ xinit(int cols, int rows) + | ButtonMotionMask | ButtonPressMask | ButtonReleaseMask; + xw.attrs.colormap = xw.cmap; + +- if (!(opt_embed && (parent = strtol(opt_embed, NULL, 0)))) +- parent = XRootWindow(xw.dpy, xw.scr); + xw.win = XCreateWindow(xw.dpy, parent, xw.l, xw.t, +- win.w, win.h, 0, XDefaultDepth(xw.dpy, xw.scr), InputOutput, ++ win.w, win.h, 0, xw.depth, InputOutput, + xw.vis, CWBackPixel | CWBorderPixel | CWBitGravity + | CWEventMask | CWColormap, &xw.attrs); + + memset(&gcvalues, 0, sizeof(gcvalues)); + gcvalues.graphics_exposures = False; +- dc.gc = XCreateGC(xw.dpy, parent, GCGraphicsExposures, +- &gcvalues); +- xw.buf = XCreatePixmap(xw.dpy, xw.win, win.w, win.h, +- DefaultDepth(xw.dpy, xw.scr)); ++ xw.buf = XCreatePixmap(xw.dpy, xw.win, win.w, win.h, xw.depth); ++ dc.gc = XCreateGC(xw.dpy, xw.buf, GCGraphicsExposures, &gcvalues); + XSetForeground(xw.dpy, dc.gc, dc.col[defaultbg].pixel); + XFillRectangle(xw.dpy, xw.buf, dc.gc, 0, 0, win.w, win.h); + +@@ -1907,6 +1925,9 @@ main(int argc, char *argv[]) + case 'a': + allowaltscreen = 0; + break; ++ case 'A': ++ opt_alpha = EARGF(usage()); ++ break; + case 'c': + opt_class = EARGF(usage()); + break;