Updated to latest git version and patches

This commit is contained in:
David Thurstenson 2017-06-09 10:32:40 -05:00
parent 01bba932c3
commit 907fad0672
4 changed files with 147 additions and 133 deletions

View File

@ -2,8 +2,8 @@
pkgname=st-tl
_pkgname=st
pkgver=0.7.r17.gc63a87c
pkgrel=3
pkgver=0.7.r26.gb331da5
pkgrel=1
pkgdesc='A simple virtual terminal emulator for X.'
arch=('i686' 'x86_64')
license=('MIT')
@ -11,14 +11,14 @@ depends=('libxft' 'libxext' 'xorg-fonts-misc' 'dmenu' 'xurls')
makedepends=('ncurses')
conflicts=('st')
url="http://st.suckless.org"
source=('git://git.suckless.org/st#commit=c63a87cd936c1eeef14c4c21572e5b782d3df4bc'
source=('git://git.suckless.org/st#commit=b331da550b290d54592b7ba11242c92f5a303a48'
tl-config.diff
st-externalpipe.diff
st-hidecursor.diff)
md5sums=('SKIP'
'0a61cd23b891bce98c56cf97eafb24f7'
'c54c87489342b8d77c6dd8f3c2ff997e'
'8ff8a77b34dfc09a4dd0d2cf876d68e7')
'4d1089c3845767e52f1bd79f0022acb0'
'a75266ee959386a4b50e0ad7d1c41580'
'487dc42b84ea464474aac527c2b47191')
pkgver() {
cd "$_pkgname"

View File

@ -1,70 +1,67 @@
diff --git a/st.c b/st.c
index d6fe58a..1595e59 100644
index 8d4a9f2..3b05f0b 100644
--- a/st.c
+++ b/st.c
@@ -344,6 +344,7 @@ static void printscreen(const Arg *) ;
@@ -138,6 +138,7 @@ static void printscreen(const Arg *) ;
static void iso14755(const Arg *);
static void toggleprinter(const Arg *);
static void sendbreak(const Arg *);
+static void externalpipe(const Arg *);
/* Config.h for applying patches and the configuration. */
/* config.h for applying patches and the configuration. */
#include "config.h"
@@ -2996,6 +2997,62 @@ eschandle(uchar ascii)
@@ -2344,6 +2345,59 @@ eschandle(uchar ascii)
}
void
+externalpipe(const Arg *arg)
+{
+ int to[2]; /* 0 = read, 1 = write */
+ pid_t child;
+ int n;
+ void (*oldsigpipe)(int);
+ int to[2];
+ char buf[UTF_SIZ];
+ void (*oldsigpipe)(int);
+ Glyph *bp, *end;
+ int lastpos, n, newline;
+
+ if(pipe(to) == -1)
+ if (pipe(to) == -1)
+ return;
+
+ /* sigchld() handles this */
+ switch(child = fork()){
+ switch (fork()) {
+ case -1:
+ close(to[0]), close(to[1]);
+ close(to[0]);
+ close(to[1]);
+ return;
+ case 0:
+ /* child */
+ close(to[1]);
+ dup2(to[0], STDIN_FILENO); /* 0<&to */
+ dup2(to[0], STDIN_FILENO);
+ close(to[0]);
+ execvp(
+ "sh",
+ (char *const []){
+ "/bin/sh",
+ "-c",
+ (char *)arg->v,
+ 0
+ });
+ exit(127);
+ close(to[1]);
+ execvp(((char **)arg->v)[0], (char **)arg->v);
+ fprintf(stderr, "st: execvp %s ", ((char **)arg->v)[0]);
+ perror("failed");
+ exit(0);
+ }
+
+ /* parent */
+ close(to[0]);
+ /* ignore sigpipe for now, in case child exits early */
+ oldsigpipe = signal(SIGPIPE, SIG_IGN);
+
+ for(n = 0; n < term.row; n++){
+ bp = &term.line[n][0];
+ end = &bp[MIN(tlinelen(n), term.col) - 1];
+ if(bp != end || bp->u != ' ')
+ for(; bp <= end; ++bp)
+ if(xwrite(to[1], buf, utf8encode(bp->u, buf)) < 0)
+ newline = 0;
+ for (n = 0; n < term.row; n++) {
+ bp = term.line[n];
+ lastpos = MIN(tlinelen(n) + 1, term.col) - 1;
+ if (lastpos < 0)
+ break;
+ if(xwrite(to[1], "\n", 1) < 0)
+ end = &bp[lastpos + 1];
+ for (; bp < end; ++bp)
+ if (xwrite(to[1], buf, utf8encode(bp->u, buf)) < 0)
+ break;
+ if (newline = term.line[n][lastpos].mode & ATTR_WRAP)
+ continue;
+ if (xwrite(to[1], "\n", 1) < 0)
+ break;
+ newline = 0;
+ }
+
+ if (newline)
+ (void)xwrite(to[1], "\n", 1);
+ close(to[1]);
+
+ /* restore */
+ signal(SIGPIPE, oldsigpipe);
+}
@ -73,3 +70,33 @@ index d6fe58a..1595e59 100644
tputc(Rune u)
{
char c[UTF_SIZ];
diff --git a/win.h b/win.h
index 428111c..a012a24 100644
--- a/win.h
+++ b/win.h
@@ -28,3 +28,5 @@ void xresize(int, int);
void xselpaste(void);
unsigned long xwinid(void);
void xsetsel(char *, Time);
+
+extern char winid[64];
diff --git a/x.c b/x.c
index fbfd350..ff052e6 100644
--- a/x.c
+++ b/x.c
@@ -139,6 +139,7 @@ static void (*handler[LASTEvent])(XEvent *) = {
static DC dc;
static XWindow xw;
static XSelection xsel;
+char winid[64];
/* Font Ring Cache */
enum {
@@ -915,6 +916,7 @@ xinit(void)
win.w, win.h, 0, XDefaultDepth(xw.dpy, xw.scr), InputOutput,
xw.vis, CWBackPixel | CWBorderPixel | CWBitGravity
| CWEventMask | CWColormap, &xw.attrs);
+ snprintf(winid, LEN(winid), "%lu", (unsigned long)xw.win);
memset(&gcvalues, 0, sizeof(gcvalues));
gcvalues.graphics_exposures = False;

View File

@ -1,8 +1,8 @@
diff --git a/st.c b/st.c
index 2594c65..2a031f0 100644
--- a/st.c
+++ b/st.c
@@ -260,6 +260,11 @@ typedef struct {
diff --git a/x.c b/x.c
index fbfd350..2f72214 100644
--- a/x.c
+++ b/x.c
@@ -47,6 +47,11 @@ typedef struct {
Draw draw;
Visual *vis;
XSetWindowAttributes attrs;
@ -14,21 +14,21 @@ index 2594c65..2a031f0 100644
int scr;
int isfixed; /* is fixed geometry? */
int l, t; /* left and top offset */
@@ -1291,6 +1296,13 @@ bmotion(XEvent *e)
@@ -535,6 +540,13 @@ bmotion(XEvent *e)
{
int oldey, oldex, oldsby, oldsey;
+ if(!xw.pointerisvisible) {
+ if (!xw.pointerisvisible) {
+ XDefineCursor(xw.dpy, xw.win, xw.vpointer);
+ xw.pointerisvisible = 1;
+ if(!IS_SET(MODE_MOUSEMANY))
+ if (!IS_SET(MODE_MOUSEMANY))
+ xsetpointermotion(0);
+ }
+
if (IS_SET(MODE_MOUSE) && !(e->xbutton.state & forceselmod)) {
mousereport(e);
return;
@@ -3435,10 +3447,10 @@ void
@@ -871,10 +883,10 @@ void
xinit(void)
{
XGCValues gcvalues;
@ -40,7 +40,7 @@ index 2594c65..2a031f0 100644
if (!(xw.dpy = XOpenDisplay(NULL)))
die("Can't open display\n");
@@ -3511,8 +3523,9 @@ xinit(void)
@@ -947,8 +959,9 @@ xinit(void)
die("XCreateIC failed. Could not obtain input method.\n");
/* white cursor, black outline */
@ -52,7 +52,7 @@ index 2594c65..2a031f0 100644
if (XParseColor(xw.dpy, xw.cmap, colorname[mousefg], &xmousefg) == 0) {
xmousefg.red = 0xffff;
@@ -3526,7 +3539,10 @@ xinit(void)
@@ -962,7 +975,10 @@ xinit(void)
xmousebg.blue = 0x0000;
}
@ -64,20 +64,20 @@ index 2594c65..2a031f0 100644
xw.xembed = XInternAtom(xw.dpy, "_XEMBED", False);
xw.wmdeletewin = XInternAtom(xw.dpy, "WM_DELETE_WINDOW", False);
@@ -4026,6 +4042,8 @@ unmap(XEvent *ev)
@@ -1462,6 +1478,8 @@ unmap(XEvent *ev)
void
xsetpointermotion(int set)
{
+ if(!set && !xw.pointerisvisible)
+ if (!set && !xw.pointerisvisible)
+ return;
MODBIT(xw.attrs.event_mask, set, PointerMotionMask);
XChangeWindowAttributes(xw.dpy, xw.win, CWEventMask, &xw.attrs);
}
@@ -4125,6 +4143,12 @@ kpress(XEvent *ev)
@@ -1521,6 +1539,12 @@ kpress(XEvent *ev)
Status status;
Shortcut *bp;
+ if(xw.pointerisvisible) {
+ if (xw.pointerisvisible) {
+ XDefineCursor(xw.dpy, xw.win, xw.bpointer);
+ xsetpointermotion(1);
+ xw.pointerisvisible = 0;

View File

@ -1,12 +1,12 @@
--- a/config.h 2017-03-16 15:22:46.638368708 -0500
+++ b/config.h 2017-03-16 15:31:48.438413697 -0500
--- a/config.h 2017-06-09 09:57:08.991613650 -0500
+++ b/config.h 2017-06-09 10:30:35.471854916 -0500
@@ -5,7 +5,7 @@
*
* font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html
*/
-static char font[] = "Liberation Mono:pixelsize=12:antialias=true:autohint=true";
+static char font[] = "Monospace:size=11.5:antialias=true:autohint=true";
static int borderpx = 2;
-char font[] = "Liberation Mono:pixelsize=12:antialias=true:autohint=true";
+char font[] = "Monospace:size=11.5:antialias=true:autohint=true";
int borderpx = 2;
/*
@@ -60,7 +60,7 @@
@ -17,14 +17,10 @@
+static int bellvolume = 50;
/* default TERM value */
static char termname[] = "st-256color";
@@ -82,33 +82,32 @@
*/
static unsigned int tabspaces = 8;
+/*TERMINAL.SEXY START*/
char termname[] = "st-256color";
@@ -85,30 +85,29 @@
/* Terminal colors (16 first used in escape sequence) */
static const char *colorname[] = {
const char *colorname[] = {
/* 8 normal colors */
- "black",
- "red3",
@ -42,6 +38,7 @@
+ [5] = "#833c9f", /* magenta */
+ [6] = "#0ac1cd", /* cyan */
+ [7] = "#e5e5e5", /* white */
+
/* 8 bright colors */
- "gray50",
@ -73,55 +70,45 @@
};
@@ -116,10 +115,10 @@
@@ -116,10 +115,11 @@
* Default colors (colorname index)
* foreground, background, cursor, reverse cursor
*/
-static unsigned int defaultfg = 7;
-static unsigned int defaultbg = 0;
-static unsigned int defaultcs = 256;
-static unsigned int defaultrcs = 257;
+static unsigned int defaultfg = 257;
+static unsigned int defaultbg = 256;
+static unsigned int defaultcs = 257;
+static unsigned int defaultrcs = 256;
-unsigned int defaultfg = 7;
-unsigned int defaultbg = 0;
-unsigned int defaultcs = 256;
-unsigned int defaultrcs = 257;
+unsigned int defaultfg = 257;
+unsigned int defaultbg = 256;
+unsigned int defaultcs = 257;
+unsigned int defaultrcs = 256;
+
/*
* Default shape of cursor
@@ -164,20 +163,22 @@
@@ -164,6 +164,14 @@
#define MODKEY Mod1Mask
#define TERMMOD (ControlMask|ShiftMask)
static Shortcut shortcuts[] = {
- /* mask keysym function argument */
- { XK_ANY_MOD, XK_Break, sendbreak, {.i = 0} },
- { ControlMask, XK_Print, toggleprinter, {.i = 0} },
- { ShiftMask, XK_Print, printscreen, {.i = 0} },
- { XK_ANY_MOD, XK_Print, printsel, {.i = 0} },
- { MODKEY|ShiftMask, XK_Prior, xzoom, {.f = +1} },
- { MODKEY|ShiftMask, XK_Next, xzoom, {.f = -1} },
- { MODKEY|ShiftMask, XK_Home, xzoomreset, {.f = 0} },
- { ShiftMask, XK_Insert, selpaste, {.i = 0} },
- { MODKEY|ShiftMask, XK_Insert, clippaste, {.i = 0} },
- { 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} },
+ /* mask keysym function argument */
+ { XK_ANY_MOD, XK_Break, sendbreak, {.i = 0} },
+ { ControlMask, XK_Print, toggleprinter, {.i = 0} },
+ { ShiftMask, XK_Print, printscreen, {.i = 0} },
+ { XK_ANY_MOD, XK_Print, printsel, {.i = 0} },
+ { MODKEY|ShiftMask, XK_Prior, xzoom, {.f = +1} },
+ { MODKEY|ShiftMask, XK_Next, xzoom, {.f = -1} },
+ { MODKEY|ShiftMask, XK_Home, xzoomreset, {.f = 0} },
+ { ShiftMask, XK_Insert, selpaste, {.i = 0} },
+ { MODKEY|ShiftMask, XK_Insert, clippaste, {.i = 0} },
+ { MODKEY|ShiftMask, XK_C, clipcopy, {.i = 0} },
+ { ControlMask|ShiftMask, XK_V, clippaste, {.i = 0} },
+ { MODKEY, XK_Num_Lock, numlock, {.i = 0} },
+ { ControlMask|ShiftMask, XK_X, externalpipe, {.v = "xurls | tac | dmenu -l 10 | xargs -r chromium" } },
+ { ControlMask|ShiftMask, XK_Z, externalpipe, {.v = "xurls | tac | dmenu -l 10 -p 'Copy URL:' | xsel -ib" } },
+ { ControlMask|ShiftMask, XK_U, iso14755, {.i = 0} },
+static char *openurlcmd[] = { "/bin/sh", "-c",
+ "xurls | tac | dmenu -l 10 -w $1 | xargs -r open",
+ "externalpipe", winid, NULL };
+
+static char *copyurlcmd[] = { "/bin/sh", "-c",
+ "xurls | tac | dmenu -l 10 -w $1 -p 'Copy URL:' | xsel -ib",
+ "externalpipe", winid, NULL };
+
Shortcut shortcuts[] = {
/* mask keysym function argument */
{ XK_ANY_MOD, XK_Break, sendbreak, {.i = 0} },
@@ -178,6 +186,10 @@
{ TERMMOD, XK_Y, selpaste, {.i = 0} },
{ TERMMOD, XK_Num_Lock, numlock, {.i = 0} },
{ TERMMOD, XK_I, iso14755, {.i = 0} },
+ { TERMMOD, XK_X, externalpipe, {.v = openurlcmd } },
+ { TERMMOD, XK_Z, externalpipe, {.v = copyurlcmd} },
+ { TERMMOD, XK_U, iso14755, {.i = 0} },
+
};
/*