static char *font = "Cascadia Mono:style=Bold:size=11:antialias=true:autohint=true"; static int borderpx = 10; /* * What program is execed by st depends of these precedence rules: * 1: program passed with -e * 2: scroll and/or utmp * 3: SHELL environment variable * 4: value of shell in /etc/passwd * 5: value of shell in config.h */ static char *shell = "/bin/sh"; char *utmp = NULL; /* scroll program: to enable use a string like "scroll" */ char *scroll = NULL; char *stty_args = "stty raw pass8 nl -echo -iexten -cstopb 38400"; /* identification sequence returned in DA and DECID */ char *vtiden = "\033[?6c"; /* Kerning / character bounding-box multipliers */ static float cwscale = 1.0; static float chscale = 1.0; /* * word delimiter string * * More advanced example: L" `'\"()[]{}" */ wchar_t *worddelimiters = L" "; /* selection timeouts (in milliseconds) */ static unsigned int doubleclicktimeout = 300; static unsigned int tripleclicktimeout = 600; /* alt screens */ int allowaltscreen = 1; /* allow certain non-interactive (insecure) window operations such as: setting the clipboard text */ int allowwindowops = 0; /* * draw latency range in ms - from new content/keypress/etc until drawing. * within this range, st draws when content stops arriving (idle). mostly it's * near minlatency, but it waits longer for slow updates to avoid partial draw. * low minlatency will tear/flicker more, as it can "detect" idle too early. */ static double minlatency = 2; static double maxlatency = 33; /* * blinking timeout (set to 0 to disable blinking) for the terminal blinking * attribute. */ static unsigned int blinktimeout = 800; /* * thickness of underline and bar cursors */ static unsigned int cursorthickness = 2; /* * bell volume. It must be a value between -100 and 100. Use 0 for disabling * it */ static int bellvolume = 0; char *termname = "st-256color"; unsigned int tabspaces = 8; float alpha = 0.8; static const char *colorname[] = { /* 8 normal colors */ "#343f44", // black "#e67e80", // red "#a7c080", // green "#dbbc7f", // yellow "#7fbbb3", // blue "#d699b6", // magenta "#83c092", // cyan "#859289", // white /* 8 bright colors */ "#868d80", // bright black "#e67e80", // bright red "#a7c080", // bright green "#dbbc7f", // bright yellow "#7fbbb3", // bright blue "#d699b6", // bright magenta "#83c092", // bright cyan "#9da9a0", // bright white [255] = 0, /* Default colors (can be any index above, or raw hex) */ "#d3c6aa", // foreground "#272e33", // background "#d3c6aa", // cursor "#555555", // reverse cursor or something neutral }; unsigned int defaultfg = 256; unsigned int defaultbg = 257; unsigned int defaultcs = 258; static unsigned int defaultrcs = 259; /* * 2: Block ("█") * 4: Underline ("_") * 6: Bar ("|") */ // static unsigned int cursorshape = 2; static unsigned int cols = 80; static unsigned int rows = 24; static unsigned int mouseshape = XC_xterm; static unsigned int mousefg = 7; static unsigned int mousebg = 0; /* * Color used to display font attributes when fontconfig selected a font which * doesn't match the ones requested. */ static unsigned int defaultattr = 11; /* * Force mouse select/shortcuts while mask is active (when MODE_MOUSE is set). * Note that if you want to use ShiftMask with selmasks, set this to an other * modifier, set to 0 to not use it. */ static uint forcemousemod = ShiftMask; /* * Internal mouse shortcuts. * Beware that overloading Button1 will disable the selection. */ static MouseShortcut mshortcuts[] = { /* mask button function argument release */ { 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~"} }, { XK_ANY_MOD, Button5, ttysend, {.s = "\005"} }, }; /* Internal keyboard shortcuts. */ #define MODKEY Mod1Mask #define TERMMOD (ControlMask|ShiftMask) 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} }, { 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_Num_Lock, numlock, {.i = 0} }, { ShiftMask, XK_Page_Up, kscrollup, {.i = -1} }, { ShiftMask, XK_Page_Down, kscrolldown, {.i = -1} }, }; /* * Special keys (change & recompile st.info accordingly) * * Mask value: * * Use XK_ANY_MOD to match the key no matter modifiers state * * Use XK_NO_MOD to match the key alone (no modifiers) * appkey value: * * 0: no value * * > 0: keypad application mode enabled * * = 2: term.numlock = 1 * * < 0: keypad application mode disabled * appcursor value: * * 0: no value * * > 0: cursor application mode enabled * * < 0: cursor application mode disabled * * Be careful with the order of the definitions because st searches in * this table sequentially, so any XK_ANY_MOD must be in the last * position for a key. */ /* * If you want keys other than the X11 function keys (0xFD00 - 0xFFFF) * to be mapped below, add them to this array. */ static KeySym mappedkeys[] = { -1 }; /* * State bits to ignore when matching key or button events. By default, * numlock (Mod2Mask) and keyboard layout (XK_SWITCH_MOD) are ignored. */ static uint ignoremod = Mod2Mask|XK_SWITCH_MOD; /* * This is the huge key array which defines all compatibility to the Linux * world. Please decide about changes wisely. */ static Key key[] = { /* keysym mask string appkey appcursor */ { XK_KP_Home, ShiftMask, "\033[2J", 0, -1}, { XK_KP_Home, ShiftMask, "\033[1;2H", 0, +1}, { XK_KP_Home, XK_ANY_MOD, "\033[H", 0, -1}, { XK_KP_Home, XK_ANY_MOD, "\033[1~", 0, +1}, { XK_KP_Up, XK_ANY_MOD, "\033Ox", +1, 0}, { XK_KP_Up, XK_ANY_MOD, "\033[A", 0, -1}, { XK_KP_Up, XK_ANY_MOD, "\033OA", 0, +1}, { XK_KP_Down, XK_ANY_MOD, "\033Or", +1, 0}, { XK_KP_Down, XK_ANY_MOD, "\033[B", 0, -1}, { XK_KP_Down, XK_ANY_MOD, "\033OB", 0, +1}, { XK_KP_Left, XK_ANY_MOD, "\033Ot", +1, 0}, { XK_KP_Left, XK_ANY_MOD, "\033[D", 0, -1}, { XK_KP_Left, XK_ANY_MOD, "\033OD", 0, +1}, { XK_KP_Right, XK_ANY_MOD, "\033Ov", +1, 0}, { XK_KP_Right, XK_ANY_MOD, "\033[C", 0, -1}, { XK_KP_Right, XK_ANY_MOD, "\033OC", 0, +1}, { XK_KP_Prior, ShiftMask, "\033[5;2~", 0, 0}, { XK_KP_Prior, XK_ANY_MOD, "\033[5~", 0, 0}, { XK_KP_Begin, XK_ANY_MOD, "\033[E", 0, 0}, { XK_KP_End, ControlMask, "\033[J", -1, 0}, { XK_KP_End, ControlMask, "\033[1;5F", +1, 0}, { XK_KP_End, ShiftMask, "\033[K", -1, 0}, { XK_KP_End, ShiftMask, "\033[1;2F", +1, 0}, { XK_KP_End, XK_ANY_MOD, "\033[4~", 0, 0}, { XK_KP_Next, ShiftMask, "\033[6;2~", 0, 0}, { XK_KP_Next, XK_ANY_MOD, "\033[6~", 0, 0}, { XK_KP_Insert, ShiftMask, "\033[2;2~", +1, 0}, { XK_KP_Insert, ShiftMask, "\033[4l", -1, 0}, { XK_KP_Insert, ControlMask, "\033[L", -1, 0}, { XK_KP_Insert, ControlMask, "\033[2;5~", +1, 0}, { XK_KP_Insert, XK_ANY_MOD, "\033[4h", -1, 0}, { XK_KP_Insert, XK_ANY_MOD, "\033[2~", +1, 0}, { XK_KP_Delete, ControlMask, "\033[M", -1, 0}, { XK_KP_Delete, ControlMask, "\033[3;5~", +1, 0}, { XK_KP_Delete, ShiftMask, "\033[2K", -1, 0}, { XK_KP_Delete, ShiftMask, "\033[3;2~", +1, 0}, { XK_KP_Delete, XK_ANY_MOD, "\033[P", -1, 0}, { XK_KP_Delete, XK_ANY_MOD, "\033[3~", +1, 0}, { XK_KP_Multiply, XK_ANY_MOD, "\033Oj", +2, 0}, { XK_KP_Add, XK_ANY_MOD, "\033Ok", +2, 0}, { XK_KP_Enter, XK_ANY_MOD, "\033OM", +2, 0}, { XK_KP_Enter, XK_ANY_MOD, "\r", -1, 0}, { XK_KP_Subtract, XK_ANY_MOD, "\033Om", +2, 0}, { XK_KP_Decimal, XK_ANY_MOD, "\033On", +2, 0}, { XK_KP_Divide, XK_ANY_MOD, "\033Oo", +2, 0}, { XK_KP_0, XK_ANY_MOD, "\033Op", +2, 0}, { XK_KP_1, XK_ANY_MOD, "\033Oq", +2, 0}, { XK_KP_2, XK_ANY_MOD, "\033Or", +2, 0}, { XK_KP_3, XK_ANY_MOD, "\033Os", +2, 0}, { XK_KP_4, XK_ANY_MOD, "\033Ot", +2, 0}, { XK_KP_5, XK_ANY_MOD, "\033Ou", +2, 0}, { XK_KP_6, XK_ANY_MOD, "\033Ov", +2, 0}, { XK_KP_7, XK_ANY_MOD, "\033Ow", +2, 0}, { XK_KP_8, XK_ANY_MOD, "\033Ox", +2, 0}, { XK_KP_9, XK_ANY_MOD, "\033Oy", +2, 0}, { XK_Up, ShiftMask, "\033[1;2A", 0, 0}, { XK_Up, Mod1Mask, "\033[1;3A", 0, 0}, { XK_Up, ShiftMask|Mod1Mask,"\033[1;4A", 0, 0}, { XK_Up, ControlMask, "\033[1;5A", 0, 0}, { XK_Up, ShiftMask|ControlMask,"\033[1;6A", 0, 0}, { XK_Up, ControlMask|Mod1Mask,"\033[1;7A", 0, 0}, { XK_Up,ShiftMask|ControlMask|Mod1Mask,"\033[1;8A", 0, 0}, { XK_Up, XK_ANY_MOD, "\033[A", 0, -1}, { XK_Up, XK_ANY_MOD, "\033OA", 0, +1}, { XK_Down, ShiftMask, "\033[1;2B", 0, 0}, { XK_Down, Mod1Mask, "\033[1;3B", 0, 0}, { XK_Down, ShiftMask|Mod1Mask,"\033[1;4B", 0, 0}, { XK_Down, ControlMask, "\033[1;5B", 0, 0}, { XK_Down, ShiftMask|ControlMask,"\033[1;6B", 0, 0}, { XK_Down, ControlMask|Mod1Mask,"\033[1;7B", 0, 0}, { XK_Down,ShiftMask|ControlMask|Mod1Mask,"\033[1;8B",0, 0}, { XK_Down, XK_ANY_MOD, "\033[B", 0, -1}, { XK_Down, XK_ANY_MOD, "\033OB", 0, +1}, { XK_Left, ShiftMask, "\033[1;2D", 0, 0}, { XK_Left, Mod1Mask, "\033[1;3D", 0, 0}, { XK_Left, ShiftMask|Mod1Mask,"\033[1;4D", 0, 0}, { XK_Left, ControlMask, "\033[1;5D", 0, 0}, { XK_Left, ShiftMask|ControlMask,"\033[1;6D", 0, 0}, { XK_Left, ControlMask|Mod1Mask,"\033[1;7D", 0, 0}, { XK_Left,ShiftMask|ControlMask|Mod1Mask,"\033[1;8D",0, 0}, { XK_Left, XK_ANY_MOD, "\033[D", 0, -1}, { XK_Left, XK_ANY_MOD, "\033OD", 0, +1}, { XK_Right, ShiftMask, "\033[1;2C", 0, 0}, { XK_Right, Mod1Mask, "\033[1;3C", 0, 0}, { XK_Right, ShiftMask|Mod1Mask,"\033[1;4C", 0, 0}, { XK_Right, ControlMask, "\033[1;5C", 0, 0}, { XK_Right, ShiftMask|ControlMask,"\033[1;6C", 0, 0}, { XK_Right, ControlMask|Mod1Mask,"\033[1;7C", 0, 0}, { XK_Right,ShiftMask|ControlMask|Mod1Mask,"\033[1;8C",0, 0}, { XK_Right, XK_ANY_MOD, "\033[C", 0, -1}, { XK_Right, XK_ANY_MOD, "\033OC", 0, +1}, { XK_ISO_Left_Tab, ShiftMask, "\033[Z", 0, 0}, { XK_Return, Mod1Mask, "\033\r", 0, 0}, { XK_Return, XK_ANY_MOD, "\r", 0, 0}, { XK_Insert, ShiftMask, "\033[4l", -1, 0}, { XK_Insert, ShiftMask, "\033[2;2~", +1, 0}, { XK_Insert, ControlMask, "\033[L", -1, 0}, { XK_Insert, ControlMask, "\033[2;5~", +1, 0}, { XK_Insert, XK_ANY_MOD, "\033[4h", -1, 0}, { XK_Insert, XK_ANY_MOD, "\033[2~", +1, 0}, { XK_Delete, ControlMask, "\033[M", -1, 0}, { XK_Delete, ControlMask, "\033[3;5~", +1, 0}, { XK_Delete, ShiftMask, "\033[2K", -1, 0}, { XK_Delete, ShiftMask, "\033[3;2~", +1, 0}, { XK_Delete, XK_ANY_MOD, "\033[P", -1, 0}, { XK_Delete, XK_ANY_MOD, "\033[3~", +1, 0}, { XK_BackSpace, XK_NO_MOD, "\177", 0, 0}, { XK_BackSpace, Mod1Mask, "\033\177", 0, 0}, { XK_Home, ShiftMask, "\033[2J", 0, -1}, { XK_Home, ShiftMask, "\033[1;2H", 0, +1}, { XK_Home, XK_ANY_MOD, "\033[H", 0, -1}, { XK_Home, XK_ANY_MOD, "\033[1~", 0, +1}, { XK_End, ControlMask, "\033[J", -1, 0}, { XK_End, ControlMask, "\033[1;5F", +1, 0}, { XK_End, ShiftMask, "\033[K", -1, 0}, { XK_End, ShiftMask, "\033[1;2F", +1, 0}, { XK_End, XK_ANY_MOD, "\033[4~", 0, 0}, { XK_Prior, ControlMask, "\033[5;5~", 0, 0}, { XK_Prior, ShiftMask, "\033[5;2~", 0, 0}, { XK_Prior, XK_ANY_MOD, "\033[5~", 0, 0}, { XK_Next, ControlMask, "\033[6;5~", 0, 0}, { XK_Next, ShiftMask, "\033[6;2~", 0, 0}, { XK_Next, XK_ANY_MOD, "\033[6~", 0, 0}, }; /* * Selection types' masks. * Use the same masks as usual. * Button1Mask is always unset, to make masks match between ButtonPress. * ButtonRelease and MotionNotify. * If no match is found, regular selection is used. */ static uint selmasks[] = { [SEL_RECTANGULAR] = Mod1Mask, }; /* * Printable characters in ASCII, used to estimate the advance width * of single wide characters. */ static char ascii_printable[] = " !\"#$%&'()*+,-./0123456789:;<=>?" "@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_" "`abcdefghijklmnopqrstuvwxyz{|}~";