diff options
| -rw-r--r-- | config.def.h | 43 | ||||
| -rw-r--r-- | config.h | 1 | ||||
| -rw-r--r-- | config.mk | 2 | ||||
| -rw-r--r-- | st.c | 52 | ||||
| -rw-r--r-- | st.h | 2 | ||||
| -rw-r--r-- | x.c | 11 |
6 files changed, 77 insertions, 34 deletions
diff --git a/config.def.h b/config.def.h index 26a1779..f882aae 100644 --- a/config.def.h +++ b/config.def.h @@ -5,11 +5,12 @@ * * font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html */ -static char *font = "Liberation Mono:pixelsize=12:antialias=true:autohint=true"; +static char *font = "Liberation Mono:pixelsize=16:antialias=true:autohint=true"; /* Spare fonts */ static char *font2[] = { /* "Inconsolata for Powerline:pixelsize=12:antialias=true:autohint=true", */ /* "Hack Nerd Font Mono:pixelsize=11:antialias=true:autohint=true", */ + "Noto Color Emoji:pixelsize=12:antialias=true:autohint=true" }; static int borderpx = 2; @@ -79,7 +80,7 @@ static unsigned int cursorthickness = 2; * Bold affects lines thickness if boxdraw_bold is not 0. Italic is ignored. * 0: disable (render all U25XX glyphs normally from the font). */ -const int boxdraw = 0; +const int boxdraw = 1; const int boxdraw_bold = 0; /* braille (U28XX): 1: render as adjacent "pixels", 0: use font */ @@ -194,7 +195,11 @@ static uint forcemousemod = ShiftMask; */ static MouseShortcut mshortcuts[] = { /* mask button function argument release */ - { XK_ANY_MOD, Button2, selpaste, {.i = 0}, 1 }, + { XK_NO_MOD, Button4, kscrollup, {.i = 2} }, + { XK_NO_MOD, Button5, kscrolldown, {.i = 2} }, + { ControlMask, Button4, zoom, {.f = +1} }, + { ControlMask, Button5, zoom, {.f = -1} }, + { XK_ANY_MOD, Button2, selpaste, {.i = 0}, 1 }, { ShiftMask, Button4, ttysend, {.s = "\033[5;2~"} }, { XK_ANY_MOD, Button4, ttysend, {.s = "\031"} }, { ShiftMask, Button5, ttysend, {.s = "\033[6;2~"} }, @@ -202,25 +207,33 @@ static MouseShortcut mshortcuts[] = { }; /* Internal keyboard shortcuts. */ -#define MODKEY Mod1Mask +#define MODKEY Mod4Mask #define TERMMOD (ControlMask|ShiftMask) +static char *copyurlcmd[] = { "/bin/sh", "-c", "st-urlhandler", "externalpipe", NULL }; +static char *copyoutput[] = { "/bin/sh", "-c", "st-copyout", "externalpipe", NULL }; + 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} }, - { TERMMOD, XK_Prior, zoom, {.f = +1} }, - { TERMMOD, XK_Next, zoom, {.f = -1} }, - { TERMMOD, XK_Home, zoomreset, {.f = 0} }, + { ShiftMask, XK_Insert, selpaste, {.i = 0} }, + { ShiftMask, XK_Page_Up, kscrollup, {.i = -1} }, + { ShiftMask, XK_Page_Down, kscrolldown, {.i = -1} }, { TERMMOD, XK_C, clipcopy, {.i = 0} }, { TERMMOD, XK_V, clippaste, {.i = 0} }, - { TERMMOD, XK_Y, selpaste, {.i = 0} }, - { ShiftMask, XK_Insert, selpaste, {.i = 0} }, + { TERMMOD, XK_K, kscrollup, {.i = 1} }, + { TERMMOD, XK_J, kscrolldown, {.i = 1} }, + { TERMMOD, XK_Up, kscrollup, {.i = 1} }, + { TERMMOD, XK_Down, kscrolldown, {.i = 1} }, + { ControlMask, XK_0, zoomreset, {.f = 0} }, + { ControlMask, XK_plus, zoom, {.f = +1} }, + { ControlMask, XK_minus, zoom, {.f = -1} }, + { TERMMOD, XK_Right, zoom, {.f = +1} }, + { TERMMOD, XK_Left, zoom, {.f = -1} }, + { TERMMOD, XK_L, zoom, {.f = +1} }, + { TERMMOD, XK_H, zoom, {.f = -1} }, { TERMMOD, XK_Num_Lock, numlock, {.i = 0} }, - { ShiftMask, XK_Page_Up, kscrollup, {.i = -1} }, - { ShiftMask, XK_Page_Down, kscrolldown, {.i = -1} }, + { MODKEY, XK_o, externalpipe, {.v = copyoutput} }, + { MODKEY, XK_p, externalpipe, {.v = copyurlcmd} }, }; /* @@ -231,6 +231,7 @@ static Shortcut shortcuts[] = { { TERMMOD, XK_Left, zoom, {.f = -1} }, { TERMMOD, XK_L, zoom, {.f = +1} }, { TERMMOD, XK_H, zoom, {.f = -1} }, + { TERMMOD, XK_Num_Lock, numlock, {.i = 0} }, { MODKEY, XK_o, externalpipe, {.v = copyoutput} }, { MODKEY, XK_p, externalpipe, {.v = copyurlcmd} }, }; @@ -1,5 +1,5 @@ # st version -VERSION = 0.9.2 +VERSION = 0.9.3 # Customize below to fit your system @@ -1215,6 +1215,7 @@ csiparse(void) { char *p = csiescseq.buf, *np; long int v; + int sep = ';'; /* colon or semi-colon, but not both */ csiescseq.narg = 0; if (*p == '?') { @@ -1232,7 +1233,9 @@ csiparse(void) v = -1; csiescseq.arg[csiescseq.narg++] = v; p = np; - if (*p != ';' || csiescseq.narg == ESC_ARG_SIZ) + if (sep == ';' && *p == ':') + sep = ':'; /* allow override to colon once */ + if (*p != sep || csiescseq.narg == ESC_ARG_SIZ) break; p++; } @@ -1503,16 +1506,22 @@ tsetattr(const int *attr, int l) if ((idx = tdefcolor(attr, &i, l)) >= 0) term.c.attr.fg = idx; break; - case 39: + case 39: /* set foreground color to default */ term.c.attr.fg = defaultfg; break; case 48: if ((idx = tdefcolor(attr, &i, l)) >= 0) term.c.attr.bg = idx; break; - case 49: + case 49: /* set background color to default */ term.c.attr.bg = defaultbg; break; + case 58: + /* This starts a sequence to change the color of + * "underline" pixels. We don't support that and + * instead eat up a following "5;n" or "2;r;g;b". */ + tdefcolor(attr, &i, l); + break; default: if (BETWEEN(attr[i], 30, 37)) { term.c.attr.fg = attr[i] - 30; @@ -1609,7 +1618,7 @@ tsetmode(int priv, int set, const int *args, int narg) case 1006: /* 1006: extended reporting mode */ xsetmode(set, MODE_MOUSESGR); break; - case 1034: + case 1034: /* 1034: enable 8-bit mode for keyboard input */ xsetmode(set, MODE_8BIT); break; case 1049: /* swap screen & set/restore cursor as xterm */ @@ -1617,8 +1626,8 @@ tsetmode(int priv, int set, const int *args, int narg) break; tcursor((set) ? CURSOR_SAVE : CURSOR_LOAD); /* FALLTHROUGH */ - case 47: /* swap screen */ - case 1047: + case 47: /* swap screen buffer */ + case 1047: /* swap screen buffer */ if (!allowaltscreen) break; alt = IS_SET(MODE_ALTSCREEN); @@ -1631,7 +1640,7 @@ tsetmode(int priv, int set, const int *args, int narg) if (*args != 1049) break; /* FALLTHROUGH */ - case 1048: + case 1048: /* save/restore cursor (like DECSC/DECRC) */ tcursor((set) ? CURSOR_SAVE : CURSOR_LOAD); break; case 2004: /* 2004: bracketed paste mode */ @@ -1788,7 +1797,7 @@ csihandle(void) } break; case 1: /* above */ - if (term.c.y > 1) + if (term.c.y > 0) tclearregion(0, 0, term.col-1, term.c.y-1); tclearregion(0, term.c.y, term.c.x, term.c.y); break; @@ -1884,7 +1893,11 @@ csihandle(void) tcursor(CURSOR_SAVE); break; case 'u': /* DECRC -- Restore cursor position (ANSI.SYS) */ - tcursor(CURSOR_LOAD); + if (csiescseq.priv) { + goto unknown; + } else { + tcursor(CURSOR_LOAD); + } break; case ' ': switch (csiescseq.mode[1]) { @@ -1986,7 +1999,7 @@ strhandle(void) if (narg > 1) xsettitle(strescseq.args[1]); return; - case 52: + case 52: /* manipulate selection data */ if (narg > 2 && allowwindowops) { dec = base64dec(strescseq.args[2]); if (dec) { @@ -1997,9 +2010,9 @@ strhandle(void) } } return; - case 10: - case 11: - case 12: + case 10: /* set dynamic VT100 text foreground color */ + case 11: /* set dynamic VT100 text background color */ + case 12: /* set dynamic text cursor color */ if (narg < 2) break; p = strescseq.args[1]; @@ -2040,6 +2053,19 @@ strhandle(void) tfulldirt(); } return; + case 110: /* reset dynamic VT100 text foreground color */ + case 111: /* reset dynamic VT100 text background color */ + case 112: /* reset dynamic text cursor color */ + if (narg != 1) + break; + if ((j = par - 110) < 0 || j >= LEN(osc_table)) + break; /* shouldn't be possible */ + if (xsetcolorname(osc_table[j].idx, NULL)) { + fprintf(stderr, "erresc: %s color not found\n", osc_table[j].str); + } else { + tfulldirt(); + } + return; } break; case 'k': /* old title set compatibility */ @@ -82,9 +82,9 @@ void die(const char *, ...); void redraw(void); void draw(void); +void externalpipe(const Arg *); void kscrolldown(const Arg *); void kscrollup(const Arg *); -void externalpipe(const Arg *); void printscreen(const Arg *); void printsel(const Arg *); void sendbreak(const Arg *); @@ -1229,7 +1229,7 @@ xinit(int cols, int rows) { XGCValues gcvalues; Cursor cursor; - Window parent; + Window parent, root; pid_t thispid = getpid(); XColor xmousefg, xmousebg; @@ -1269,16 +1269,19 @@ xinit(int cols, int rows) | ButtonMotionMask | ButtonPressMask | ButtonReleaseMask; xw.attrs.colormap = xw.cmap; + root = XRootWindow(xw.dpy, xw.scr); if (!(opt_embed && (parent = strtol(opt_embed, NULL, 0)))) - parent = XRootWindow(xw.dpy, xw.scr); - xw.win = XCreateWindow(xw.dpy, parent, xw.l, xw.t, + parent = root; + xw.win = XCreateWindow(xw.dpy, root, xw.l, xw.t, win.w, win.h, 0, XDefaultDepth(xw.dpy, xw.scr), InputOutput, xw.vis, CWBackPixel | CWBorderPixel | CWBitGravity | CWEventMask | CWColormap, &xw.attrs); + if (parent != root) + XReparentWindow(xw.dpy, xw.win, parent, xw.l, xw.t); memset(&gcvalues, 0, sizeof(gcvalues)); gcvalues.graphics_exposures = False; - dc.gc = XCreateGC(xw.dpy, parent, GCGraphicsExposures, + dc.gc = XCreateGC(xw.dpy, xw.win, GCGraphicsExposures, &gcvalues); xw.buf = XCreatePixmap(xw.dpy, xw.win, win.w, win.h, DefaultDepth(xw.dpy, xw.scr)); |
