diff --git a/config.h b/config.h index c86daa3..5d67380 100644 --- a/config.h +++ b/config.h @@ -5,8 +5,8 @@ * * font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html */ -static char *font = "mono:pixelsize=12:antialias=true:autohint=true"; -static char *font2[] = { "NotoColorEmoji:pixelsize=10:antialias=true:autohint=true" }; +static char *font = "monospace:pixelsize=32:antialias=true:autohint=true"; +static char *font2[] = { "monospace:pixelsize=32:antialias=true:autohint=true" }; static int borderpx = 2; /* @@ -245,6 +245,9 @@ static MouseShortcut mshortcuts[] = { static char *openurlcmd[] = { "/bin/sh", "-c", "st-urlhandler -o", "externalpipe", NULL }; static char *copyurlcmd[] = { "/bin/sh", "-c", "st-urlhandler -c", "externalpipe", NULL }; static char *copyoutput[] = { "/bin/sh", "-c", "st-copyout", "externalpipe", NULL }; +static char *copyemailcmd[] = { "/bin/sh", "-c", "st-emailhandler", "externalpipe", NULL }; +static char *weechat[] = { "/bin/sh", "-c", "st-weechatlinks", "externalpipe", NULL }; + static Shortcut shortcuts[] = { /* mask keysym function argument */ @@ -280,9 +283,11 @@ static Shortcut shortcuts[] = { { TERMMOD, XK_J, zoom, {.f = -1} }, { TERMMOD, XK_U, zoom, {.f = +2} }, { TERMMOD, XK_D, zoom, {.f = -2} }, + { MODKEY, XK_Return, newterm, {.i = 0} }, { MODKEY, XK_l, externalpipe, {.v = openurlcmd } }, { MODKEY, XK_y, externalpipe, {.v = copyurlcmd } }, { MODKEY, XK_o, externalpipe, {.v = copyoutput } }, + { MODKEY, XK_x, externalpipe, {.v = weechat} }, }; /* diff --git a/st.c b/st.c index 0f4593e..6887d9a 100644 --- a/st.c +++ b/st.c @@ -20,6 +20,8 @@ #include "st.h" #include "win.h" +extern char *argv0; + #if defined(__linux) #include #elif defined(__OpenBSD__) || defined(__NetBSD__) || defined(__APPLE__) @@ -162,6 +164,7 @@ typedef struct { } STREscape; static void execsh(char *, char **); +static int chdir_by_pid(pid_t pid); static void stty(char **); static void sigchld(int); static void ttywriteraw(const char *, size_t); @@ -831,6 +834,7 @@ ttynew(const char *line, char *cmd, const char *out, char **args) if (pledge("stdio rpath tty proc", NULL) == -1) die("pledge\n"); #endif + fcntl(m, F_SETFD, FD_CLOEXEC); close(s); cmdfd = m; signal(SIGCHLD, sigchld); @@ -1082,6 +1086,38 @@ tswapscreen(void) tfulldirt(); } +void +newterm(const Arg* a) +{ + int res; + switch (fork()) { + case -1: + die("fork failed: %s\n", strerror(errno)); + break; + case 0: + switch (fork()) { + case -1: + die("fork failed: %s\n", strerror(errno)); + break; + case 0: + chdir_by_pid(pid); + execlp("/proc/self/exe", argv0, NULL); + exit(1); + break; + default: + exit(0); + } + default: + wait(NULL); + } +} + +static int chdir_by_pid(pid_t pid) { + char buf[32]; + snprintf(buf, sizeof buf, "/proc/%ld/cwd", (long)pid); + return chdir(buf); +} + void kscrolldown(const Arg* a) { diff --git a/st.h b/st.h index 60d973a..507b862 100644 --- a/st.h +++ b/st.h @@ -89,6 +89,7 @@ void externalpipe(const Arg *); void kscrolldown(const Arg *); void kscrollup(const Arg *); +void newterm(const Arg *); void printscreen(const Arg *); void printsel(const Arg *); void sendbreak(const Arg *); diff --git a/x.c b/x.c index 36e156a..4678729 100644 --- a/x.c +++ b/x.c @@ -834,7 +834,7 @@ xloadcolor(int i, const char *name, Color *ncolor) void xloadalpha(void) { - float const usedAlpha = focused ? alpha : alphaUnfocus; + float const usedAlpha = alpha; if (opt_alpha) alpha = strtof(opt_alpha, NULL); dc.col[defaultbg].color.alpha = (unsigned short)(0xffff * usedAlpha); dc.col[defaultbg].pixel &= 0x00FFFFFF;