diff --git a/Makefile b/Makefile index 907e29a..1cc4b5b 100644 --- a/Makefile +++ b/Makefile @@ -48,10 +48,10 @@ install: st [ -f $(ICONNAME) ] && cp -f $(ICONNAME) $(DESTDIR)$(ICONPREFIX) || : mkdir -p $(DESTDIR)$(APPPREFIX) cp -f st.desktop $(DESTDIR)$(APPPREFIX) - cp -f scripts/urllist $(DESTDIR)$(PREFIX)/bin + cp -f scripts/st_urllist $(DESTDIR)$(PREFIX)/bin cp -f scripts/st_buffer $(DESTDIR)$(PREFIX)/bin cp -f scripts/st_xurls $(DESTDIR)$(PREFIX)/bin - chmod +x $(DESTDIR)$(PREFIX)/bin/urllist + chmod +x $(DESTDIR)$(PREFIX)/bin/st_urllist chmod +x $(DESTDIR)$(PREFIX)/bin/st_buffer chmod +x $(DESTDIR)$(PREFIX)/bin/st_xurls rm -f ./st diff --git a/external.h b/external.h index adbcb9e..0bfd204 100644 --- a/external.h +++ b/external.h @@ -1,4 +1,4 @@ /* This is the header used to control extenralpipe. */ char *externalpipe_sigusr1[] = { "/bin/sh", "-c", "st_buffer st_strings_read" }; -static char *listurl[] = { "/bin/sh", "-c", "urllist", NULL }; +static char *listurl[] = { "/bin/sh", "-c", "st_urllist", NULL }; diff --git a/options.h b/options.h index 98cb23e..cb8a51a 100644 --- a/options.h +++ b/options.h @@ -48,7 +48,7 @@ static char *font = "DejaVuSansMono Nerd Font:style=Bold:pi * If you don't need these, you can of course omit them. */ static char *font2[] = { "DejaVu Sans Mono:pixelsize=12:antialias=true:autohint=true", - "Noto Emoji:pixelsize=12:antialias=true:autohint=true", + // "Noto Color Emoji:pixelsize=12:antialias=true:autohint=true", "JoyPixels:pixelsize=12:antialias=true:autohint=true", "fontawesome:pixelsize=12:antialias=true:autohint=true", }; @@ -61,7 +61,7 @@ static char *font2[] = { "DejaVu Sans Mono:pixelsize=12:antial /* Window options */ static int borderpx = 0; /* Size of a small border around the text. */ int allowaltscreen = 1; /* Allow alt screen (1) */ -int allowwindowops = 0; /* Allow (insecure) window operations such as setting the clipboard text */ +int allowwindowops = 1; /* Allow (insecure) window operations such as setting the clipboard text */ int windowdecorations = 1; /* Display window decoration (1) */ /* @@ -74,6 +74,7 @@ MonitorConfig monitors_config[] = { /* <0 : auto relative points size (monitor dpi) */ {"HDMI-0~2", -14}, {"LVDS1", -8}, + {"DVI-D", -10}, }; float winmovethreshold = 0.6; diff --git a/scripts/st_buffer b/scripts/st_buffer index 67eb13c..39c3e78 100644 --- a/scripts/st_buffer +++ b/scripts/st_buffer @@ -1,4 +1,4 @@ -#!/usr/bin/env sh +#!/usr/bin/env bash # externalpipe_buffer.sh: use with surf/st externalpipe-signal patches # Input Usage: echo st or surf content from externalpipe | ./externalpipe_buffer.sh {st,surf}_strings_read # Menus Usage: ./externalpipe_buffer.sh dmenu_{copy, type} diff --git a/scripts/urllist b/scripts/st_urllist similarity index 100% rename from scripts/urllist rename to scripts/st_urllist diff --git a/st.c b/st.c index 6b44e7e..4e899da 100644 --- a/st.c +++ b/st.c @@ -275,6 +275,7 @@ static CSIEscape csiescseq; static STREscape strescseq; static int iofd = 1; static int cmdfd; +static int csdfd; static pid_t pid; static const uchar utfbyte[UTF_SIZ + 1] = {0x80, 0, 0xC0, 0xE0, 0xF0}; @@ -846,7 +847,7 @@ sigchld(int a) int stat; pid_t p; - if ((p = waitpid(pid, &stat, WNOHANG)) < 0) + if ((p = waitpid(-1, &stat, WNOHANG)) < 0) die("waiting for pid %hd failed: %s\n", pid, strerror(errno)); if (pid != p) { @@ -858,6 +859,8 @@ sigchld(int a) return; } + close(csdfd); + if (WIFEXITED(stat) && WEXITSTATUS(stat)) die("child exited with status %d\n", WEXITSTATUS(stat)); else if (WIFSIGNALED(stat)) @@ -899,6 +902,7 @@ ttynew(const char *line, char *cmd, const char *out, char **args) sigaction(SIGUSR1, &sa, NULL); int m, s; + //struct sigaction sa; if (out) { term.mode |= MODE_PRINT; @@ -951,7 +955,11 @@ ttynew(const char *line, char *cmd, const char *out, char **args) #endif close(s); cmdfd = m; - signal(SIGCHLD, sigchld); + csdfd = s; + memset(&sa, 0, sizeof(sa)); + sigemptyset(&sa.sa_mask); + sa.sa_handler = sigchld; + sigaction(SIGCHLD, &sa, NULL); break; } return cmdfd; @@ -2343,7 +2351,7 @@ strparse(void) } void -externalpipe(const Arg *arg) +extpipe(const Arg *arg, int in) { int to[2]; char buf[UTF_SIZ]; @@ -2363,6 +2371,9 @@ externalpipe(const Arg *arg) dup2(to[0], STDIN_FILENO); close(to[0]); close(to[1]); + if (in) + dup2(csdfd, STDOUT_FILENO); + close(csdfd); execvp(((char **)arg->v)[0], (char **)arg->v); fprintf(stderr, "st: execvp %s\n", ((char **)arg->v)[0]); perror("failed"); @@ -2397,6 +2408,16 @@ externalpipe(const Arg *arg) signal(SIGPIPE, oldsigpipe); } +void +externalpipe(const Arg *arg) { + extpipe(arg, 0); +} + +void +externalpipein(const Arg *arg) { + extpipe(arg, 1); +} + void strdump(void) { diff --git a/st.h b/st.h index 25243cb..a8638f3 100644 --- a/st.h +++ b/st.h @@ -94,6 +94,7 @@ void draw(void); void kscrolldown(const Arg *); void kscrollup(const Arg *); void externalpipe(const Arg *); +void externalpipein(const Arg *); void printscreen(const Arg *); void printsel(const Arg *); void sendbreak(const Arg *); diff --git a/x.c b/x.c index 9ad9673..f7adf39 100644 --- a/x.c +++ b/x.c @@ -284,6 +284,7 @@ static DC dc; static XWindow xw; static XSelection xsel; static TermWindow win; +static int pendingkpress = 0; /* Font Ring Cache */ enum { @@ -1014,7 +1015,7 @@ xloadfont(Font *f, FcPattern *pattern) FcConfigSubstitute(NULL, configured, FcMatchPattern); XftDefaultSubstitute(xw.dpy, xw.scr, configured); - match = FcFontMatch(NULL, configured, &result); + match = XftFontMatch(xw.dpy, xw.scr, pattern, &result); if (!match) { FcPatternDestroy(configured); return 1; @@ -2345,6 +2346,8 @@ xdrawline(Line line, int x1, int y1, int x2) Glyph base, new; XftGlyphFontSpec *specs = xw.specbuf; + pendingkpress = 0; + numspecs = xmakeglyphfontspecs(specs, &line[x1], x2 - x1, x1, y1); i = ox = 0; for (x = x1; x < x2 && i < numspecs; x++) { @@ -2674,6 +2677,8 @@ kpress(XEvent *ev) Status status; Shortcut *bp; + pendingkpress = 1; + if (IS_SET(MODE_KBDLOCK)) return; @@ -2810,6 +2815,9 @@ run(void) seltv.tv_nsec = 1E6 * (timeout - 1E3 * seltv.tv_sec); tv = timeout >= 0 ? &seltv : NULL; + if (pendingkpress) + draw(); + if (pselect(MAX(xfd, ttyfd)+1, &rfd, NULL, NULL, tv, NULL) < 0) { if (errno == EINTR) continue;