release new st

This commit is contained in:
speediegq 2022-09-02 17:04:36 +02:00
parent 8977bede47
commit be65c84ef2
8 changed files with 41 additions and 10 deletions

View file

@ -48,10 +48,10 @@ install: st
[ -f $(ICONNAME) ] && cp -f $(ICONNAME) $(DESTDIR)$(ICONPREFIX) || : [ -f $(ICONNAME) ] && cp -f $(ICONNAME) $(DESTDIR)$(ICONPREFIX) || :
mkdir -p $(DESTDIR)$(APPPREFIX) mkdir -p $(DESTDIR)$(APPPREFIX)
cp -f st.desktop $(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_buffer $(DESTDIR)$(PREFIX)/bin
cp -f scripts/st_xurls $(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_buffer
chmod +x $(DESTDIR)$(PREFIX)/bin/st_xurls chmod +x $(DESTDIR)$(PREFIX)/bin/st_xurls
rm -f ./st rm -f ./st

View file

@ -1,4 +1,4 @@
/* This is the header used to control extenralpipe. /* This is the header used to control extenralpipe.
*/ */
char *externalpipe_sigusr1[] = { "/bin/sh", "-c", "st_buffer st_strings_read" }; 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 };

View file

@ -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. * If you don't need these, you can of course omit them.
*/ */
static char *font2[] = { "DejaVu Sans Mono:pixelsize=12:antialias=true:autohint=true", 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", "JoyPixels:pixelsize=12:antialias=true:autohint=true",
"fontawesome: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 */ /* Window options */
static int borderpx = 0; /* Size of a small border around the text. */ static int borderpx = 0; /* Size of a small border around the text. */
int allowaltscreen = 1; /* Allow alt screen (1) */ 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) */ int windowdecorations = 1; /* Display window decoration (1) */
/* /*
@ -74,6 +74,7 @@ MonitorConfig monitors_config[] = {
/* <0 : auto relative points size (monitor dpi) */ /* <0 : auto relative points size (monitor dpi) */
{"HDMI-0~2", -14}, {"HDMI-0~2", -14},
{"LVDS1", -8}, {"LVDS1", -8},
{"DVI-D", -10},
}; };
float winmovethreshold = 0.6; float winmovethreshold = 0.6;

View file

@ -1,4 +1,4 @@
#!/usr/bin/env sh #!/usr/bin/env bash
# externalpipe_buffer.sh: use with surf/st externalpipe-signal patches # 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 # Input Usage: echo st or surf content from externalpipe | ./externalpipe_buffer.sh {st,surf}_strings_read
# Menus Usage: ./externalpipe_buffer.sh dmenu_{copy, type} # Menus Usage: ./externalpipe_buffer.sh dmenu_{copy, type}

27
st.c
View file

@ -275,6 +275,7 @@ static CSIEscape csiescseq;
static STREscape strescseq; static STREscape strescseq;
static int iofd = 1; static int iofd = 1;
static int cmdfd; static int cmdfd;
static int csdfd;
static pid_t pid; static pid_t pid;
static const uchar utfbyte[UTF_SIZ + 1] = {0x80, 0, 0xC0, 0xE0, 0xF0}; static const uchar utfbyte[UTF_SIZ + 1] = {0x80, 0, 0xC0, 0xE0, 0xF0};
@ -846,7 +847,7 @@ sigchld(int a)
int stat; int stat;
pid_t p; 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)); die("waiting for pid %hd failed: %s\n", pid, strerror(errno));
if (pid != p) { if (pid != p) {
@ -858,6 +859,8 @@ sigchld(int a)
return; return;
} }
close(csdfd);
if (WIFEXITED(stat) && WEXITSTATUS(stat)) if (WIFEXITED(stat) && WEXITSTATUS(stat))
die("child exited with status %d\n", WEXITSTATUS(stat)); die("child exited with status %d\n", WEXITSTATUS(stat));
else if (WIFSIGNALED(stat)) else if (WIFSIGNALED(stat))
@ -899,6 +902,7 @@ ttynew(const char *line, char *cmd, const char *out, char **args)
sigaction(SIGUSR1, &sa, NULL); sigaction(SIGUSR1, &sa, NULL);
int m, s; int m, s;
//struct sigaction sa;
if (out) { if (out) {
term.mode |= MODE_PRINT; term.mode |= MODE_PRINT;
@ -951,7 +955,11 @@ ttynew(const char *line, char *cmd, const char *out, char **args)
#endif #endif
close(s); close(s);
cmdfd = m; 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; break;
} }
return cmdfd; return cmdfd;
@ -2343,7 +2351,7 @@ strparse(void)
} }
void void
externalpipe(const Arg *arg) extpipe(const Arg *arg, int in)
{ {
int to[2]; int to[2];
char buf[UTF_SIZ]; char buf[UTF_SIZ];
@ -2363,6 +2371,9 @@ externalpipe(const Arg *arg)
dup2(to[0], STDIN_FILENO); dup2(to[0], STDIN_FILENO);
close(to[0]); close(to[0]);
close(to[1]); close(to[1]);
if (in)
dup2(csdfd, STDOUT_FILENO);
close(csdfd);
execvp(((char **)arg->v)[0], (char **)arg->v); execvp(((char **)arg->v)[0], (char **)arg->v);
fprintf(stderr, "st: execvp %s\n", ((char **)arg->v)[0]); fprintf(stderr, "st: execvp %s\n", ((char **)arg->v)[0]);
perror("failed"); perror("failed");
@ -2397,6 +2408,16 @@ externalpipe(const Arg *arg)
signal(SIGPIPE, oldsigpipe); signal(SIGPIPE, oldsigpipe);
} }
void
externalpipe(const Arg *arg) {
extpipe(arg, 0);
}
void
externalpipein(const Arg *arg) {
extpipe(arg, 1);
}
void void
strdump(void) strdump(void)
{ {

1
st.h
View file

@ -94,6 +94,7 @@ void draw(void);
void kscrolldown(const Arg *); void kscrolldown(const Arg *);
void kscrollup(const Arg *); void kscrollup(const Arg *);
void externalpipe(const Arg *); void externalpipe(const Arg *);
void externalpipein(const Arg *);
void printscreen(const Arg *); void printscreen(const Arg *);
void printsel(const Arg *); void printsel(const Arg *);
void sendbreak(const Arg *); void sendbreak(const Arg *);

10
x.c
View file

@ -284,6 +284,7 @@ static DC dc;
static XWindow xw; static XWindow xw;
static XSelection xsel; static XSelection xsel;
static TermWindow win; static TermWindow win;
static int pendingkpress = 0;
/* Font Ring Cache */ /* Font Ring Cache */
enum { enum {
@ -1014,7 +1015,7 @@ xloadfont(Font *f, FcPattern *pattern)
FcConfigSubstitute(NULL, configured, FcMatchPattern); FcConfigSubstitute(NULL, configured, FcMatchPattern);
XftDefaultSubstitute(xw.dpy, xw.scr, configured); XftDefaultSubstitute(xw.dpy, xw.scr, configured);
match = FcFontMatch(NULL, configured, &result); match = XftFontMatch(xw.dpy, xw.scr, pattern, &result);
if (!match) { if (!match) {
FcPatternDestroy(configured); FcPatternDestroy(configured);
return 1; return 1;
@ -2345,6 +2346,8 @@ xdrawline(Line line, int x1, int y1, int x2)
Glyph base, new; Glyph base, new;
XftGlyphFontSpec *specs = xw.specbuf; XftGlyphFontSpec *specs = xw.specbuf;
pendingkpress = 0;
numspecs = xmakeglyphfontspecs(specs, &line[x1], x2 - x1, x1, y1); numspecs = xmakeglyphfontspecs(specs, &line[x1], x2 - x1, x1, y1);
i = ox = 0; i = ox = 0;
for (x = x1; x < x2 && i < numspecs; x++) { for (x = x1; x < x2 && i < numspecs; x++) {
@ -2674,6 +2677,8 @@ kpress(XEvent *ev)
Status status; Status status;
Shortcut *bp; Shortcut *bp;
pendingkpress = 1;
if (IS_SET(MODE_KBDLOCK)) if (IS_SET(MODE_KBDLOCK))
return; return;
@ -2810,6 +2815,9 @@ run(void)
seltv.tv_nsec = 1E6 * (timeout - 1E3 * seltv.tv_sec); seltv.tv_nsec = 1E6 * (timeout - 1E3 * seltv.tv_sec);
tv = timeout >= 0 ? &seltv : NULL; tv = timeout >= 0 ? &seltv : NULL;
if (pendingkpress)
draw();
if (pselect(MAX(xfd, ttyfd)+1, &rfd, NULL, NULL, tv, NULL) < 0) { if (pselect(MAX(xfd, ttyfd)+1, &rfd, NULL, NULL, tv, NULL) < 0) {
if (errno == EINTR) if (errno == EINTR)
continue; continue;