[st][PATCH] externalpipe and externalpipein
This patch must be applied on the externalpipe patch. It adds the function externalpipein to redirect the standard output of the external command to the slave size of the pty, that is, as if the external program had been manually executed on the terminal. It can be used to send desired escape sequences to the terminal with a shortcut. I created the patch to make use of the dynamic-colors program (https://github.com/sos4nt/dynamic-colors) that uses the OSC escape sequences to change the colors of the terminal. The program keeps the last colorscheme selected in a file, so you can use it to select the colorscheme for all newly opened terminals from that moment on. If you want to change the color of the background and foreground independently from the palette, you have to merge in the patch for the OSC escape sequences 10, 11, and 12. This patch includes the changes of the externalpipe sigaction patch to prevent reseting the signal handler for SIGCHLD when the proces of the external command exits.
This commit is contained in:
parent
5ad2174cf9
commit
b71d9f6669
5 changed files with 59 additions and 14 deletions
|
|
@ -1,5 +1,9 @@
|
|||
void
|
||||
#if EXTERNALPIPEIN_PATCH
|
||||
extpipe(const Arg *arg, int in)
|
||||
#else
|
||||
externalpipe(const Arg *arg)
|
||||
#endif // EXTERNALPIPEIN_PATCH
|
||||
{
|
||||
int to[2];
|
||||
char buf[UTF_SIZ];
|
||||
|
|
@ -19,6 +23,11 @@ externalpipe(const Arg *arg)
|
|||
dup2(to[0], STDIN_FILENO);
|
||||
close(to[0]);
|
||||
close(to[1]);
|
||||
#if EXTERNALPIPEIN_PATCH
|
||||
if (in)
|
||||
dup2(csdfd, STDOUT_FILENO);
|
||||
close(csdfd);
|
||||
#endif // EXTERNALPIPEIN_PATCH
|
||||
execvp(((char **)arg->v)[0], (char **)arg->v);
|
||||
fprintf(stderr, "st: execvp %s\n", ((char **)arg->v)[0]);
|
||||
perror("failed");
|
||||
|
|
@ -49,4 +58,16 @@ externalpipe(const Arg *arg)
|
|||
close(to[1]);
|
||||
/* restore */
|
||||
signal(SIGPIPE, oldsigpipe);
|
||||
}
|
||||
}
|
||||
|
||||
#if EXTERNALPIPEIN_PATCH
|
||||
void
|
||||
externalpipe(const Arg *arg) {
|
||||
extpipe(arg, 0);
|
||||
}
|
||||
|
||||
void
|
||||
externalpipein(const Arg *arg) {
|
||||
extpipe(arg, 1);
|
||||
}
|
||||
#endif // EXTERNALPIPEIN_PATCH
|
||||
|
|
@ -1 +1,4 @@
|
|||
void externalpipe(const Arg *);
|
||||
void externalpipe(const Arg *);
|
||||
#if EXTERNALPIPEIN_PATCH
|
||||
void externalpipein(const Arg *);
|
||||
#endif // EXTERNALPIPEIN_PATCH
|
||||
Loading…
Add table
Add a link
Reference in a new issue