diff --git a/.suckless/st/boxdraw.o b/.suckless/st/boxdraw.o deleted file mode 100644 index f5eb599..0000000 Binary files a/.suckless/st/boxdraw.o and /dev/null differ diff --git a/.suckless/st/config.h b/.suckless/st/config.h deleted file mode 100644 index c99cd99..0000000 --- a/.suckless/st/config.h +++ /dev/null @@ -1,517 +0,0 @@ -/* See LICENSE file for copyright and license details. */ - -/* - * appearance - * - * font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html - */ -static const char *font = "CaskaydiaMonoNerdFontMono-Bold:size=14:style=Bold"; -/* Spare fonts */ - -static char *font2[] = { - "CaskaydiaMonoNerdFontMono-Bold:pixelsize=12:antialias=true:autohint=true"}; -static int borderpx = 6; - -/* How to align the content in the window when the size of the terminal - * doesn't perfectly match the size of the window. The values are percentages. - * 50 means center, 0 means flush left/top, 100 means flush right/bottom. - */ -static int anysize_halign = 50; -static int anysize_valign = 50; - -/* - * 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 = "/usr/bin/zsh"; -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 */ -/* By default, use the same one as kitty. */ - -char *vtiden = "\033[?62c"; -//char *vtiden = "\x1b[?62;4c"; - -/* Kerning / character bounding-box multipliers */ -static float cwscale = 1; -static float chscale = 1; - -/* - * 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 = 1; -static double maxlatency = 10; - -/* - * blinking timeout (set to 0 to disable blinking) for the terminal blinking - * attribute. - */ -static unsigned int blinktimeout = 100; - -/* - * thickness of underline and bar cursors - */ -static unsigned int cursorthickness = 2; - -/* - * 1: render most of the lines/blocks characters without using the font for - * perfect alignment between cells (U2500 - U259F except dashes/diagonals). - * 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 = 1; -const int boxdraw_bold = 1; - -/* braille (U28XX): 1: render as adjacent "pixels", 0: use font */ -const int boxdraw_braille = 0; - -/* - * bell volume. It must be a value between -100 and 100. Use 0 for disabling - * it - */ -static int bellvolume = 0; - -/* default TERM value */ -char *termname = "st"; - -/* - * spaces per tab - * - * When you are changing this value, don't forget to adapt the »it« value in - * the st.info and appropriately install the st.info in the environment where - * you use this st version. - * - * it#$tabspaces, - * - * Secondly make sure your kernel is not expanding tabs. When running `stty - * -a` »tab0« should appear. You can tell the terminal to not expand tabs by - * running following command: - * - * stty tabs - */ -unsigned int tabspaces = 8; - -/* Terminal colors (16 first used in escape sequence) */ -static const char *colorname[] = { - /* 8 normal colors */ - "black", "red3", "green3", "yellow3", "blue2", "magenta3", "cyan3", - "gray90", - - /* 8 bright colors */ - "gray50", "red", "green", "yellow", "#5c5cff", "magenta", "cyan", "white", - - [255] = 0, - - /* more colors can be added after 255 to use with DefaultXX */ - "#cccccc", "#555555", "gray90", /* default foreground colour */ - "black", /* default background colour */ -}; - -/* - * Default colors (colorname index) - * foreground, background, cursor, reverse cursor - */ -unsigned int defaultfg = 258; -unsigned int defaultbg = 259; -unsigned int defaultcs = 256; -static unsigned int defaultrcs = 257; - -/* - * Default shape of cursor - * 2: Block ("█") - * 4: Underline ("_") - * 6: Bar ("|") - * 7: Snowman ("☃") - */ -static unsigned int cursorshape = 2; - -/* - * Default columns and rows numbers - */ - -static unsigned int cols = 80; -static unsigned int rows = 24; - -/* - * Default colour and shape of the mouse cursor - */ -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; - -/* - * Graphics configuration - */ - -/// The template for the cache directory. -const char graphics_cache_dir_template[] = "/tmp/st-images-XXXXXX"; -/// The max size of a single image file, in bytes. -unsigned graphics_max_single_image_file_size = 20 * 1024 * 1024; -/// The max size of the cache, in bytes. -unsigned graphics_total_file_cache_size = 300 * 1024 * 1024; -/// The max ram size of an image or placement, in bytes. -unsigned graphics_max_single_image_ram_size = 100 * 1024 * 1024; -/// The max total size of all images loaded into RAM. -unsigned graphics_max_total_ram_size = 300 * 1024 * 1024; -/// The max total number of image placements and images. -unsigned graphics_max_total_placements = 4096; -/// The ratio by which limits can be exceeded. This is to reduce the frequency -/// of image removal. -double graphics_excess_tolerance_ratio = 0.05; -/// The minimum delay between redraws caused by animations, in milliseconds. -unsigned graphics_animation_min_delay = 20; - -/* - * 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 keyboard shortcuts. */ -#define MODKEY Mod1Mask -#define TERMMOD (ControlMask | ShiftMask) - -/* - * Internal mouse shortcuts. - * Beware that overloading Button1 will disable the selection. - */ -static MouseShortcut mshortcuts[] = { - /* mask button function argument release */ - {TERMMOD, Button3, previewimage, {.s = "feh"}}, - {TERMMOD, Button2, showimageinfo, {}, 1}, - {XK_ANY_MOD, Button2, selpaste, {.i = 0}, 1}, - {ShiftMask, Button4, kscrollup, {.i = 1}}, - {ShiftMask, Button5, kscrolldown, {.i = 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. */ - -static Shortcut shortcuts[] = { - /* mask keysym function argument */ - {TERMMOD, XK_F1, togglegrdebug, {.i = 0}}, - {TERMMOD, XK_F6, dumpgrstate, {.i = 0}}, - {TERMMOD, XK_F7, unloadimages, {.i = 0}}, - {TERMMOD, XK_F8, toggleimages, {.i = 0}}, - {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_C, clipcopy, {.i = 0}}, - {TERMMOD, XK_V, clippaste, {.i = 0}}, - {TERMMOD, XK_Y, selpaste, {.i = 0}}, - {ShiftMask, XK_Page_Up, kscrollup, {.i = -1}}, - {ShiftMask, XK_Page_Down, kscrolldown, {.i = -1}}, - {ShiftMask, XK_Insert, selpaste, {.i = 0}}, - {TERMMOD, XK_Num_Lock, numlock, {.i = 0}}, - {TERMMOD, XK_plus, zoom, {.f = +1}}, - {TERMMOD, XK_underscore, zoom, {.f = -1}}, - {TERMMOD, XK_equal, zoomreset, {0}}, -}; - -/* - * 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}, - {XK_F1, XK_NO_MOD, "\033OP", 0, 0}, - {XK_F1, /* F13 */ ShiftMask, "\033[1;2P", 0, 0}, - {XK_F1, /* F25 */ ControlMask, "\033[1;5P", 0, 0}, - {XK_F1, /* F37 */ Mod4Mask, "\033[1;6P", 0, 0}, - {XK_F1, /* F49 */ Mod1Mask, "\033[1;3P", 0, 0}, - {XK_F1, /* F61 */ Mod3Mask, "\033[1;4P", 0, 0}, - {XK_F2, XK_NO_MOD, "\033OQ", 0, 0}, - {XK_F2, /* F14 */ ShiftMask, "\033[1;2Q", 0, 0}, - {XK_F2, /* F26 */ ControlMask, "\033[1;5Q", 0, 0}, - {XK_F2, /* F38 */ Mod4Mask, "\033[1;6Q", 0, 0}, - {XK_F2, /* F50 */ Mod1Mask, "\033[1;3Q", 0, 0}, - {XK_F2, /* F62 */ Mod3Mask, "\033[1;4Q", 0, 0}, - {XK_F3, XK_NO_MOD, "\033OR", 0, 0}, - {XK_F3, /* F15 */ ShiftMask, "\033[1;2R", 0, 0}, - {XK_F3, /* F27 */ ControlMask, "\033[1;5R", 0, 0}, - {XK_F3, /* F39 */ Mod4Mask, "\033[1;6R", 0, 0}, - {XK_F3, /* F51 */ Mod1Mask, "\033[1;3R", 0, 0}, - {XK_F3, /* F63 */ Mod3Mask, "\033[1;4R", 0, 0}, - {XK_F4, XK_NO_MOD, "\033OS", 0, 0}, - {XK_F4, /* F16 */ ShiftMask, "\033[1;2S", 0, 0}, - {XK_F4, /* F28 */ ControlMask, "\033[1;5S", 0, 0}, - {XK_F4, /* F40 */ Mod4Mask, "\033[1;6S", 0, 0}, - {XK_F4, /* F52 */ Mod1Mask, "\033[1;3S", 0, 0}, - {XK_F5, XK_NO_MOD, "\033[15~", 0, 0}, - {XK_F5, /* F17 */ ShiftMask, "\033[15;2~", 0, 0}, - {XK_F5, /* F29 */ ControlMask, "\033[15;5~", 0, 0}, - {XK_F5, /* F41 */ Mod4Mask, "\033[15;6~", 0, 0}, - {XK_F5, /* F53 */ Mod1Mask, "\033[15;3~", 0, 0}, - {XK_F6, XK_NO_MOD, "\033[17~", 0, 0}, - {XK_F6, /* F18 */ ShiftMask, "\033[17;2~", 0, 0}, - {XK_F6, /* F30 */ ControlMask, "\033[17;5~", 0, 0}, - {XK_F6, /* F42 */ Mod4Mask, "\033[17;6~", 0, 0}, - {XK_F6, /* F54 */ Mod1Mask, "\033[17;3~", 0, 0}, - {XK_F7, XK_NO_MOD, "\033[18~", 0, 0}, - {XK_F7, /* F19 */ ShiftMask, "\033[18;2~", 0, 0}, - {XK_F7, /* F31 */ ControlMask, "\033[18;5~", 0, 0}, - {XK_F7, /* F43 */ Mod4Mask, "\033[18;6~", 0, 0}, - {XK_F7, /* F55 */ Mod1Mask, "\033[18;3~", 0, 0}, - {XK_F8, XK_NO_MOD, "\033[19~", 0, 0}, - {XK_F8, /* F20 */ ShiftMask, "\033[19;2~", 0, 0}, - {XK_F8, /* F32 */ ControlMask, "\033[19;5~", 0, 0}, - {XK_F8, /* F44 */ Mod4Mask, "\033[19;6~", 0, 0}, - {XK_F8, /* F56 */ Mod1Mask, "\033[19;3~", 0, 0}, - {XK_F9, XK_NO_MOD, "\033[20~", 0, 0}, - {XK_F9, /* F21 */ ShiftMask, "\033[20;2~", 0, 0}, - {XK_F9, /* F33 */ ControlMask, "\033[20;5~", 0, 0}, - {XK_F9, /* F45 */ Mod4Mask, "\033[20;6~", 0, 0}, - {XK_F9, /* F57 */ Mod1Mask, "\033[20;3~", 0, 0}, - {XK_F10, XK_NO_MOD, "\033[21~", 0, 0}, - {XK_F10, /* F22 */ ShiftMask, "\033[21;2~", 0, 0}, - {XK_F10, /* F34 */ ControlMask, "\033[21;5~", 0, 0}, - {XK_F10, /* F46 */ Mod4Mask, "\033[21;6~", 0, 0}, - {XK_F10, /* F58 */ Mod1Mask, "\033[21;3~", 0, 0}, - {XK_F11, XK_NO_MOD, "\033[23~", 0, 0}, - {XK_F11, /* F23 */ ShiftMask, "\033[23;2~", 0, 0}, - {XK_F11, /* F35 */ ControlMask, "\033[23;5~", 0, 0}, - {XK_F11, /* F47 */ Mod4Mask, "\033[23;6~", 0, 0}, - {XK_F11, /* F59 */ Mod1Mask, "\033[23;3~", 0, 0}, - {XK_F12, XK_NO_MOD, "\033[24~", 0, 0}, - {XK_F12, /* F24 */ ShiftMask, "\033[24;2~", 0, 0}, - {XK_F12, /* F36 */ ControlMask, "\033[24;5~", 0, 0}, - {XK_F12, /* F48 */ Mod4Mask, "\033[24;6~", 0, 0}, - {XK_F12, /* F60 */ Mod1Mask, "\033[24;3~", 0, 0}, - {XK_F13, XK_NO_MOD, "\033[1;2P", 0, 0}, - {XK_F14, XK_NO_MOD, "\033[1;2Q", 0, 0}, - {XK_F15, XK_NO_MOD, "\033[1;2R", 0, 0}, - {XK_F16, XK_NO_MOD, "\033[1;2S", 0, 0}, - {XK_F17, XK_NO_MOD, "\033[15;2~", 0, 0}, - {XK_F18, XK_NO_MOD, "\033[17;2~", 0, 0}, - {XK_F19, XK_NO_MOD, "\033[18;2~", 0, 0}, - {XK_F20, XK_NO_MOD, "\033[19;2~", 0, 0}, - {XK_F21, XK_NO_MOD, "\033[20;2~", 0, 0}, - {XK_F22, XK_NO_MOD, "\033[21;2~", 0, 0}, - {XK_F23, XK_NO_MOD, "\033[23;2~", 0, 0}, - {XK_F24, XK_NO_MOD, "\033[24;2~", 0, 0}, - {XK_F25, XK_NO_MOD, "\033[1;5P", 0, 0}, - {XK_F26, XK_NO_MOD, "\033[1;5Q", 0, 0}, - {XK_F27, XK_NO_MOD, "\033[1;5R", 0, 0}, - {XK_F28, XK_NO_MOD, "\033[1;5S", 0, 0}, - {XK_F29, XK_NO_MOD, "\033[15;5~", 0, 0}, - {XK_F30, XK_NO_MOD, "\033[17;5~", 0, 0}, - {XK_F31, XK_NO_MOD, "\033[18;5~", 0, 0}, - {XK_F32, XK_NO_MOD, "\033[19;5~", 0, 0}, - {XK_F33, XK_NO_MOD, "\033[20;5~", 0, 0}, - {XK_F34, XK_NO_MOD, "\033[21;5~", 0, 0}, - {XK_F35, XK_NO_MOD, "\033[23;5~", 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{|}~"; diff --git a/.suckless/st/graphics.o b/.suckless/st/graphics.o deleted file mode 100644 index 73551f9..0000000 Binary files a/.suckless/st/graphics.o and /dev/null differ diff --git a/.suckless/st/rowcolumn_diacritics_helpers.o b/.suckless/st/rowcolumn_diacritics_helpers.o deleted file mode 100644 index e3b6b55..0000000 Binary files a/.suckless/st/rowcolumn_diacritics_helpers.o and /dev/null differ diff --git a/.suckless/st/st b/.suckless/st/st deleted file mode 100755 index bf7fd1d..0000000 Binary files a/.suckless/st/st and /dev/null differ diff --git a/.suckless/st/st.h b/.suckless/st/st.h deleted file mode 100644 index 1e2ad89..0000000 --- a/.suckless/st/st.h +++ /dev/null @@ -1,220 +0,0 @@ -/* See LICENSE for license details. */ - -#include -#include - -/* macros */ -#define MIN(a, b) ((a) < (b) ? (a) : (b)) -#define MAX(a, b) ((a) < (b) ? (b) : (a)) -#define LEN(a) (sizeof(a) / sizeof(a)[0]) -#define BETWEEN(x, a, b) ((a) <= (x) && (x) <= (b)) -#define DIVCEIL(n, d) (((n) + ((d) - 1)) / (d)) -#define DEFAULT(a, b) (a) = (a) ? (a) : (b) -#define LIMIT(x, a, b) (x) = (x) < (a) ? (a) : (x) > (b) ? (b) : (x) -#define ATTRCMP(a, b) ((a).mode != (b).mode || (a).fg != (b).fg || \ - (a).bg != (b).bg || (a).decor != (b).decor) -#define TIMEDIFF(t1, t2) ((t1.tv_sec-t2.tv_sec)*1000 + \ - (t1.tv_nsec-t2.tv_nsec)/1E6) -#define MODBIT(x, set, bit) ((set) ? ((x) |= (bit)) : ((x) &= ~(bit))) - -#define TRUECOLOR(r,g,b) (1 << 24 | (r) << 16 | (g) << 8 | (b)) -#define IS_TRUECOL(x) (1 << 24 & (x)) - -// This decor color indicates that the fg color should be used. Note that it's -// not a 24-bit color because the 25-th bit is not set. -#define DECOR_DEFAULT_COLOR 0x0ffffff - -enum glyph_attribute { - ATTR_NULL = 0, - ATTR_BOLD = 1 << 0, - ATTR_FAINT = 1 << 1, - ATTR_ITALIC = 1 << 2, - ATTR_UNDERLINE = 1 << 3, - ATTR_BLINK = 1 << 4, - ATTR_REVERSE = 1 << 5, - ATTR_INVISIBLE = 1 << 6, - ATTR_STRUCK = 1 << 7, - ATTR_WRAP = 1 << 8, - ATTR_WIDE = 1 << 9, - ATTR_WDUMMY = 1 << 10, - ATTR_BOXDRAW = 1 << 11, - ATTR_BOLD_FAINT = ATTR_BOLD | ATTR_FAINT, - ATTR_IMAGE = 1 << 14, -}; - -enum selection_mode { - SEL_IDLE = 0, - SEL_EMPTY = 1, - SEL_READY = 2 -}; - -enum selection_type { - SEL_REGULAR = 1, - SEL_RECTANGULAR = 2 -}; - -enum selection_snap { - SNAP_WORD = 1, - SNAP_LINE = 2 -}; - -enum underline_style { - UNDERLINE_STRAIGHT = 1, - UNDERLINE_DOUBLE = 2, - UNDERLINE_CURLY = 3, - UNDERLINE_DOTTED = 4, - UNDERLINE_DASHED = 5, -}; - -typedef unsigned char uchar; -typedef unsigned int uint; -typedef unsigned long ulong; -typedef unsigned short ushort; - -typedef uint_least32_t Rune; - -#define Glyph Glyph_ -typedef struct { - Rune u; /* character code */ - ushort mode; /* attribute flags */ - uint32_t fg; /* foreground */ - uint32_t bg; /* background */ - uint32_t decor; /* decoration (like underline) */ -} Glyph; - -typedef Glyph *Line; - -typedef union { - int i; - uint ui; - float f; - const void *v; - const char *s; -} Arg; - -void die(const char *, ...); -void redraw(void); -void draw(void); - -void kscrolldown(const Arg *); -void kscrollup(const Arg *); -void printscreen(const Arg *); -void printsel(const Arg *); -void sendbreak(const Arg *); -void toggleprinter(const Arg *); - -int tattrset(int); -void tnew(int, int); -void tresize(int, int); -void tsetdirtattr(int); -void ttyhangup(void); -int ttynew(const char *, char *, const char *, char **); -size_t ttyread(void); -void ttyresize(int, int); -void ttywrite(const char *, size_t, int); - -void resettitle(void); - -void selclear(void); -void selinit(void); -void selstart(int, int, int); -void selextend(int, int, int, int); -int selected(int, int); -char *getsel(void); - -Glyph getglyphat(int, int); - -size_t utf8encode(Rune, char *); - -void *xmalloc(size_t); -void *xrealloc(void *, size_t); -char *xstrdup(const char *); - -int isboxdraw(Rune); -ushort boxdrawindex(const Glyph *); -#ifdef XFT_VERSION -/* only exposed to x.c, otherwise we'll need Xft.h for the types */ -void boxdraw_xinit(Display *, Colormap, XftDraw *, Visual *); -void drawboxes(int, int, int, int, XftColor *, XftColor *, const XftGlyphFontSpec *, int); -#endif - -/* config.h globals */ -extern char *utmp; -extern char *scroll; -extern char *stty_args; -extern char *vtiden; -extern wchar_t *worddelimiters; -extern int allowaltscreen; -extern int allowwindowops; -extern char *termname; -extern unsigned int tabspaces; -extern unsigned int defaultfg; -extern unsigned int defaultbg; -extern unsigned int defaultcs; -extern const int boxdraw, boxdraw_bold, boxdraw_braille; - -// Accessors to decoration properties stored in `decor`. -// The 25-th bit is used to indicate if it's a 24-bit color. -static inline uint32_t tgetdecorcolor(Glyph *g) { return g->decor & 0x1ffffff; } -static inline uint32_t tgetdecorstyle(Glyph *g) { return (g->decor >> 25) & 0x7; } -static inline void tsetdecorcolor(Glyph *g, uint32_t color) { - g->decor = (g->decor & ~0x1ffffff) | (color & 0x1ffffff); -} -static inline void tsetdecorstyle(Glyph *g, uint32_t style) { - g->decor = (g->decor & ~(0x7 << 25)) | ((style & 0x7) << 25); -} - - -// Some accessors to image placeholder properties stored in `u`: -// - row (1-base) - 9 bits -// - column (1-base) - 9 bits -// - most significant byte of the image id plus 1 - 9 bits (0 means unspecified, -// don't forget to subtract 1). -// - the original number of diacritics (0, 1, 2, or 3) - 2 bits -// - whether this is a classic (1) or Unicode (0) placeholder - 1 bit -static inline uint32_t tgetimgrow(Glyph *g) { return g->u & 0x1ff; } -static inline uint32_t tgetimgcol(Glyph *g) { return (g->u >> 9) & 0x1ff; } -static inline uint32_t tgetimgid4thbyteplus1(Glyph *g) { return (g->u >> 18) & 0x1ff; } -static inline uint32_t tgetimgdiacriticcount(Glyph *g) { return (g->u >> 27) & 0x3; } -static inline uint32_t tgetisclassicplaceholder(Glyph *g) { return (g->u >> 29) & 0x1; } -static inline void tsetimgrow(Glyph *g, uint32_t row) { - g->u = (g->u & ~0x1ff) | (row & 0x1ff); -} -static inline void tsetimgcol(Glyph *g, uint32_t col) { - g->u = (g->u & ~(0x1ff << 9)) | ((col & 0x1ff) << 9); -} -static inline void tsetimg4thbyteplus1(Glyph *g, uint32_t byteplus1) { - g->u = (g->u & ~(0x1ff << 18)) | ((byteplus1 & 0x1ff) << 18); -} -static inline void tsetimgdiacriticcount(Glyph *g, uint32_t count) { - g->u = (g->u & ~(0x3 << 27)) | ((count & 0x3) << 27); -} -static inline void tsetisclassicplaceholder(Glyph *g, uint32_t isclassic) { - g->u = (g->u & ~(0x1 << 29)) | ((isclassic & 0x1) << 29); -} - -/// Returns the full image id. This is a naive implementation, if the most -/// significant byte is not specified, it's assumed to be 0 instead of inferring -/// it from the cells to the left. -static inline uint32_t tgetimgid(Glyph *g) { - uint32_t msb = tgetimgid4thbyteplus1(g); - if (msb != 0) - --msb; - return (msb << 24) | (g->fg & 0xFFFFFF); -} - -/// Sets the full image id. -static inline void tsetimgid(Glyph *g, uint32_t id) { - g->fg = (id & 0xFFFFFF) | (1 << 24); - tsetimg4thbyteplus1(g, ((id >> 24) & 0xFF) + 1); -} - -static inline uint32_t tgetimgplacementid(Glyph *g) { - if (tgetdecorcolor(g) == DECOR_DEFAULT_COLOR) - return 0; - return g->decor & 0xFFFFFF; -} - -static inline void tsetimgplacementid(Glyph *g, uint32_t id) { - g->decor = (id & 0xFFFFFF) | (1 << 24); -} diff --git a/.suckless/st/st.o b/.suckless/st/st.o deleted file mode 100644 index 470a0d7..0000000 Binary files a/.suckless/st/st.o and /dev/null differ diff --git a/.suckless/st/x.o b/.suckless/st/x.o deleted file mode 100644 index 48c16f4..0000000 Binary files a/.suckless/st/x.o and /dev/null differ diff --git a/.config/dunst/dunst/dunstrc b/config/dunst/dunst/dunstrc similarity index 100% rename from .config/dunst/dunst/dunstrc rename to config/dunst/dunst/dunstrc diff --git a/.config/dunst/dunstrc b/config/dunst/dunstrc similarity index 100% rename from .config/dunst/dunstrc rename to config/dunst/dunstrc diff --git a/.config/fastfetch/ascii.txt b/config/fastfetch/ascii.txt similarity index 100% rename from .config/fastfetch/ascii.txt rename to config/fastfetch/ascii.txt diff --git a/.config/fastfetch/ascii.txt~ b/config/fastfetch/ascii.txt~ similarity index 100% rename from .config/fastfetch/ascii.txt~ rename to config/fastfetch/ascii.txt~ diff --git a/.config/fastfetch/config.jsonc b/config/fastfetch/config.jsonc similarity index 100% rename from .config/fastfetch/config.jsonc rename to config/fastfetch/config.jsonc diff --git a/.config/fastfetch/config.jsonc~ b/config/fastfetch/config.jsonc~ similarity index 100% rename from .config/fastfetch/config.jsonc~ rename to config/fastfetch/config.jsonc~ diff --git a/.config/fastfetch/fastfetch/ascii.txt b/config/fastfetch/fastfetch/ascii.txt similarity index 100% rename from .config/fastfetch/fastfetch/ascii.txt rename to config/fastfetch/fastfetch/ascii.txt diff --git a/.config/fastfetch/fastfetch/ascii.txt~ b/config/fastfetch/fastfetch/ascii.txt~ similarity index 100% rename from .config/fastfetch/fastfetch/ascii.txt~ rename to config/fastfetch/fastfetch/ascii.txt~ diff --git a/.config/fastfetch/fastfetch/config.jsonc b/config/fastfetch/fastfetch/config.jsonc similarity index 100% rename from .config/fastfetch/fastfetch/config.jsonc rename to config/fastfetch/fastfetch/config.jsonc diff --git a/.config/fastfetch/fastfetch/config.jsonc~ b/config/fastfetch/fastfetch/config.jsonc~ similarity index 100% rename from .config/fastfetch/fastfetch/config.jsonc~ rename to config/fastfetch/fastfetch/config.jsonc~ diff --git a/.config/home-manager/README.md b/config/home-manager/README.md similarity index 100% rename from .config/home-manager/README.md rename to config/home-manager/README.md diff --git a/.config/home-manager/flake.lock b/config/home-manager/flake.lock similarity index 100% rename from .config/home-manager/flake.lock rename to config/home-manager/flake.lock diff --git a/.config/home-manager/flake.nix b/config/home-manager/flake.nix similarity index 100% rename from .config/home-manager/flake.nix rename to config/home-manager/flake.nix diff --git a/.config/home-manager/home.nix b/config/home-manager/home.nix similarity index 100% rename from .config/home-manager/home.nix rename to config/home-manager/home.nix diff --git a/.config/nvim/Makefile b/config/nvim/Makefile similarity index 100% rename from .config/nvim/Makefile rename to config/nvim/Makefile diff --git a/.config/nvim/fnl/config.fnl b/config/nvim/fnl/config.fnl similarity index 100% rename from .config/nvim/fnl/config.fnl rename to config/nvim/fnl/config.fnl diff --git a/.config/nvim/init.lua b/config/nvim/init.lua similarity index 100% rename from .config/nvim/init.lua rename to config/nvim/init.lua diff --git a/.config/nvim/lua/project_nvim/project.lua b/config/nvim/lua/project_nvim/project.lua similarity index 100% rename from .config/nvim/lua/project_nvim/project.lua rename to config/nvim/lua/project_nvim/project.lua diff --git a/.config/picom/picom.conf b/config/picom/picom.conf similarity index 100% rename from .config/picom/picom.conf rename to config/picom/picom.conf diff --git a/.config/picom/picom.conf~ b/config/picom/picom.conf~ similarity index 100% rename from .config/picom/picom.conf~ rename to config/picom/picom.conf~ diff --git a/.config/picom/picom/picom.conf b/config/picom/picom/picom.conf similarity index 100% rename from .config/picom/picom/picom.conf rename to config/picom/picom/picom.conf diff --git a/.config/picom/picom/picom.conf~ b/config/picom/picom/picom.conf~ similarity index 100% rename from .config/picom/picom/picom.conf~ rename to config/picom/picom/picom.conf~ diff --git a/.config/plugin/config.vim b/config/plugin/config.vim similarity index 100% rename from .config/plugin/config.vim rename to config/plugin/config.vim diff --git a/.config/shell/aliases b/config/shell/aliases similarity index 100% rename from .config/shell/aliases rename to config/shell/aliases diff --git a/.config/shell/exports b/config/shell/exports similarity index 100% rename from .config/shell/exports rename to config/shell/exports diff --git a/.config/shell/shell/aliases b/config/shell/shell/aliases similarity index 100% rename from .config/shell/shell/aliases rename to config/shell/shell/aliases diff --git a/.config/shell/shell/aliases.backup b/config/shell/shell/aliases.backup similarity index 100% rename from .config/shell/shell/aliases.backup rename to config/shell/shell/aliases.backup diff --git a/.config/shell/shell/exports b/config/shell/shell/exports similarity index 100% rename from .config/shell/shell/exports rename to config/shell/shell/exports diff --git a/.config/shell/shell/exports.backup b/config/shell/shell/exports.backup similarity index 100% rename from .config/shell/shell/exports.backup rename to config/shell/shell/exports.backup diff --git a/.config/systemd/emacsd.service b/config/systemd/emacsd.service similarity index 100% rename from .config/systemd/emacsd.service rename to config/systemd/emacsd.service diff --git a/.config/user-dirs.dirs b/config/user-dirs.dirs similarity index 100% rename from .config/user-dirs.dirs rename to config/user-dirs.dirs diff --git a/.suckless/dmenu/LICENSE b/suckless/dmenu/LICENSE similarity index 100% rename from .suckless/dmenu/LICENSE rename to suckless/dmenu/LICENSE diff --git a/.suckless/dmenu/Makefile b/suckless/dmenu/Makefile similarity index 100% rename from .suckless/dmenu/Makefile rename to suckless/dmenu/Makefile diff --git a/.suckless/dmenu/README b/suckless/dmenu/README similarity index 100% rename from .suckless/dmenu/README rename to suckless/dmenu/README diff --git a/.suckless/dmenu/arg.h b/suckless/dmenu/arg.h similarity index 100% rename from .suckless/dmenu/arg.h rename to suckless/dmenu/arg.h diff --git a/.suckless/dmenu/config.def.h b/suckless/dmenu/config.def.h similarity index 100% rename from .suckless/dmenu/config.def.h rename to suckless/dmenu/config.def.h diff --git a/.suckless/dmenu/config.h b/suckless/dmenu/config.h similarity index 92% rename from .suckless/dmenu/config.h rename to suckless/dmenu/config.h index ad70a45..1edb647 100644 --- a/.suckless/dmenu/config.h +++ b/suckless/dmenu/config.h @@ -1,7 +1,7 @@ /* See LICENSE file for copyright and license details. */ /* Default settings; can be overriden by command line. */ -static int topbar = 0; /* -b option; if 0, dmenu appears at bottom */ +static int topbar = 1; /* -b option; if 0, dmenu appears at bottom */ /* -fn option overrides fonts[0]; default X11 font or font set */ static const char *fonts[] = { "monospace:size=10" diff --git a/.suckless/dmenu/config.mk b/suckless/dmenu/config.mk similarity index 100% rename from .suckless/dmenu/config.mk rename to suckless/dmenu/config.mk diff --git a/.suckless/dmenu/dmenu b/suckless/dmenu/dmenu similarity index 98% rename from .suckless/dmenu/dmenu rename to suckless/dmenu/dmenu index 9a463a4..656bab8 100755 Binary files a/.suckless/dmenu/dmenu and b/suckless/dmenu/dmenu differ diff --git a/.suckless/dmenu/dmenu.1 b/suckless/dmenu/dmenu.1 similarity index 100% rename from .suckless/dmenu/dmenu.1 rename to suckless/dmenu/dmenu.1 diff --git a/.suckless/dmenu/dmenu.c b/suckless/dmenu/dmenu.c similarity index 100% rename from .suckless/dmenu/dmenu.c rename to suckless/dmenu/dmenu.c diff --git a/.suckless/dmenu/dmenu.o b/suckless/dmenu/dmenu.o similarity index 97% rename from .suckless/dmenu/dmenu.o rename to suckless/dmenu/dmenu.o index abfb67e..e491592 100644 Binary files a/.suckless/dmenu/dmenu.o and b/suckless/dmenu/dmenu.o differ diff --git a/.suckless/dmenu/dmenu_path b/suckless/dmenu/dmenu_path similarity index 100% rename from .suckless/dmenu/dmenu_path rename to suckless/dmenu/dmenu_path diff --git a/.suckless/dmenu/dmenu_run b/suckless/dmenu/dmenu_run similarity index 100% rename from .suckless/dmenu/dmenu_run rename to suckless/dmenu/dmenu_run diff --git a/.suckless/dmenu/drw.c b/suckless/dmenu/drw.c similarity index 100% rename from .suckless/dmenu/drw.c rename to suckless/dmenu/drw.c diff --git a/.suckless/dmenu/drw.h b/suckless/dmenu/drw.h similarity index 100% rename from .suckless/dmenu/drw.h rename to suckless/dmenu/drw.h diff --git a/.suckless/dmenu/drw.o b/suckless/dmenu/drw.o similarity index 100% rename from .suckless/dmenu/drw.o rename to suckless/dmenu/drw.o diff --git a/.suckless/dmenu/stest b/suckless/dmenu/stest similarity index 100% rename from .suckless/dmenu/stest rename to suckless/dmenu/stest diff --git a/.suckless/dmenu/stest.1 b/suckless/dmenu/stest.1 similarity index 100% rename from .suckless/dmenu/stest.1 rename to suckless/dmenu/stest.1 diff --git a/.suckless/dmenu/stest.c b/suckless/dmenu/stest.c similarity index 100% rename from .suckless/dmenu/stest.c rename to suckless/dmenu/stest.c diff --git a/.suckless/dmenu/stest.o b/suckless/dmenu/stest.o similarity index 100% rename from .suckless/dmenu/stest.o rename to suckless/dmenu/stest.o diff --git a/.suckless/dmenu/util.c b/suckless/dmenu/util.c similarity index 100% rename from .suckless/dmenu/util.c rename to suckless/dmenu/util.c diff --git a/.suckless/dmenu/util.h b/suckless/dmenu/util.h similarity index 100% rename from .suckless/dmenu/util.h rename to suckless/dmenu/util.h diff --git a/.suckless/dmenu/util.o b/suckless/dmenu/util.o similarity index 100% rename from .suckless/dmenu/util.o rename to suckless/dmenu/util.o diff --git a/.suckless/dwm/#dwm.c# b/suckless/dwm/#dwm.c# similarity index 100% rename from .suckless/dwm/#dwm.c# rename to suckless/dwm/#dwm.c# diff --git a/.suckless/dwm/LICENSE b/suckless/dwm/LICENSE similarity index 100% rename from .suckless/dwm/LICENSE rename to suckless/dwm/LICENSE diff --git a/.suckless/dwm/Makefile b/suckless/dwm/Makefile similarity index 100% rename from .suckless/dwm/Makefile rename to suckless/dwm/Makefile diff --git a/.suckless/dwm/README b/suckless/dwm/README similarity index 100% rename from .suckless/dwm/README rename to suckless/dwm/README diff --git a/.suckless/dwm/README.md b/suckless/dwm/README.md similarity index 100% rename from .suckless/dwm/README.md rename to suckless/dwm/README.md diff --git a/.suckless/dwm/attachaside.diff b/suckless/dwm/attachaside.diff similarity index 100% rename from .suckless/dwm/attachaside.diff rename to suckless/dwm/attachaside.diff diff --git a/.suckless/dwm/config.def.h b/suckless/dwm/config.def.h similarity index 100% rename from .suckless/dwm/config.def.h rename to suckless/dwm/config.def.h diff --git a/.suckless/dwm/config.h b/suckless/dwm/config.h similarity index 99% rename from .suckless/dwm/config.h rename to suckless/dwm/config.h index c0a1398..95d512e 100644 --- a/.suckless/dwm/config.h +++ b/suckless/dwm/config.h @@ -121,7 +121,7 @@ static Key keys[] = { { MODKEY, XK_h, setmfact, {.f = -0.05} }, { MODKEY, XK_l, setmfact, {.f = +0.05} }, { MODKEY|ShiftMask, XK_q, quit, {0} }, - { MODKEY, XK_b, spawn, SHCMD("mullvad-browser") }, + { MODKEY, XK_b, spawn, SHCMD("floorp") }, { MODKEY, XK_m, togglebar, {0} }, { MODKEY, XK_o, incnmaster, {.i = +1 } }, { MODKEY, XK_Return, spawn, {.v = termcmd } }, diff --git a/.suckless/dwm/config.h~ b/suckless/dwm/config.h~ similarity index 100% rename from .suckless/dwm/config.h~ rename to suckless/dwm/config.h~ diff --git a/.suckless/dwm/config.mk b/suckless/dwm/config.mk similarity index 100% rename from .suckless/dwm/config.mk rename to suckless/dwm/config.mk diff --git a/.suckless/dwm/configure b/suckless/dwm/configure similarity index 100% rename from .suckless/dwm/configure rename to suckless/dwm/configure diff --git a/.suckless/dwm/drw.c b/suckless/dwm/drw.c similarity index 100% rename from .suckless/dwm/drw.c rename to suckless/dwm/drw.c diff --git a/.suckless/dwm/drw.h b/suckless/dwm/drw.h similarity index 100% rename from .suckless/dwm/drw.h rename to suckless/dwm/drw.h diff --git a/.suckless/dwm/drw.o b/suckless/dwm/drw.o similarity index 100% rename from .suckless/dwm/drw.o rename to suckless/dwm/drw.o diff --git a/.suckless/dwm/dwm b/suckless/dwm/dwm similarity index 96% rename from .suckless/dwm/dwm rename to suckless/dwm/dwm index 42b3dcc..3628153 100755 Binary files a/.suckless/dwm/dwm and b/suckless/dwm/dwm differ diff --git a/.suckless/dwm/dwm.1 b/suckless/dwm/dwm.1 similarity index 100% rename from .suckless/dwm/dwm.1 rename to suckless/dwm/dwm.1 diff --git a/.suckless/dwm/dwm.c b/suckless/dwm/dwm.c similarity index 100% rename from .suckless/dwm/dwm.c rename to suckless/dwm/dwm.c diff --git a/.suckless/dwm/dwm.c.orig b/suckless/dwm/dwm.c.orig similarity index 100% rename from .suckless/dwm/dwm.c.orig rename to suckless/dwm/dwm.c.orig diff --git a/.suckless/dwm/dwm.c.rej b/suckless/dwm/dwm.c.rej similarity index 100% rename from .suckless/dwm/dwm.c.rej rename to suckless/dwm/dwm.c.rej diff --git a/.suckless/dwm/dwm.o b/suckless/dwm/dwm.o similarity index 90% rename from .suckless/dwm/dwm.o rename to suckless/dwm/dwm.o index 9719429..7c4854b 100644 Binary files a/.suckless/dwm/dwm.o and b/suckless/dwm/dwm.o differ diff --git a/.suckless/dwm/dwm.png b/suckless/dwm/dwm.png similarity index 100% rename from .suckless/dwm/dwm.png rename to suckless/dwm/dwm.png diff --git a/.suckless/dwm/mkconfig/config.mk.freebsd b/suckless/dwm/mkconfig/config.mk.freebsd similarity index 100% rename from .suckless/dwm/mkconfig/config.mk.freebsd rename to suckless/dwm/mkconfig/config.mk.freebsd diff --git a/.suckless/dwm/mkconfig/config.mk.linux b/suckless/dwm/mkconfig/config.mk.linux similarity index 100% rename from .suckless/dwm/mkconfig/config.mk.linux rename to suckless/dwm/mkconfig/config.mk.linux diff --git a/.suckless/dwm/mkconfig/config.mk.openbsd b/suckless/dwm/mkconfig/config.mk.openbsd similarity index 100% rename from .suckless/dwm/mkconfig/config.mk.openbsd rename to suckless/dwm/mkconfig/config.mk.openbsd diff --git a/.suckless/dwm/mkconfig/config.mk.solaris b/suckless/dwm/mkconfig/config.mk.solaris similarity index 100% rename from .suckless/dwm/mkconfig/config.mk.solaris rename to suckless/dwm/mkconfig/config.mk.solaris diff --git a/.suckless/dwm/movestack.c b/suckless/dwm/movestack.c similarity index 100% rename from .suckless/dwm/movestack.c rename to suckless/dwm/movestack.c diff --git a/.suckless/dwm/patch/attachx.c b/suckless/dwm/patch/attachx.c similarity index 100% rename from .suckless/dwm/patch/attachx.c rename to suckless/dwm/patch/attachx.c diff --git a/.suckless/dwm/patch/attachx.h b/suckless/dwm/patch/attachx.h similarity index 100% rename from .suckless/dwm/patch/attachx.h rename to suckless/dwm/patch/attachx.h diff --git a/.suckless/dwm/patch/bar.c b/suckless/dwm/patch/bar.c similarity index 100% rename from .suckless/dwm/patch/bar.c rename to suckless/dwm/patch/bar.c diff --git a/.suckless/dwm/patch/bar.h b/suckless/dwm/patch/bar.h similarity index 100% rename from .suckless/dwm/patch/bar.h rename to suckless/dwm/patch/bar.h diff --git a/.suckless/dwm/patch/bar_alpha.c b/suckless/dwm/patch/bar_alpha.c similarity index 100% rename from .suckless/dwm/patch/bar_alpha.c rename to suckless/dwm/patch/bar_alpha.c diff --git a/.suckless/dwm/patch/bar_alpha.h b/suckless/dwm/patch/bar_alpha.h similarity index 100% rename from .suckless/dwm/patch/bar_alpha.h rename to suckless/dwm/patch/bar_alpha.h diff --git a/.suckless/dwm/patch/bar_indicators.c b/suckless/dwm/patch/bar_indicators.c similarity index 100% rename from .suckless/dwm/patch/bar_indicators.c rename to suckless/dwm/patch/bar_indicators.c diff --git a/.suckless/dwm/patch/bar_indicators.h b/suckless/dwm/patch/bar_indicators.h similarity index 100% rename from .suckless/dwm/patch/bar_indicators.h rename to suckless/dwm/patch/bar_indicators.h diff --git a/.suckless/dwm/patch/bar_ltsymbol.c b/suckless/dwm/patch/bar_ltsymbol.c similarity index 100% rename from .suckless/dwm/patch/bar_ltsymbol.c rename to suckless/dwm/patch/bar_ltsymbol.c diff --git a/.suckless/dwm/patch/bar_ltsymbol.h b/suckless/dwm/patch/bar_ltsymbol.h similarity index 100% rename from .suckless/dwm/patch/bar_ltsymbol.h rename to suckless/dwm/patch/bar_ltsymbol.h diff --git a/.suckless/dwm/patch/bar_status.c b/suckless/dwm/patch/bar_status.c similarity index 100% rename from .suckless/dwm/patch/bar_status.c rename to suckless/dwm/patch/bar_status.c diff --git a/.suckless/dwm/patch/bar_status.h b/suckless/dwm/patch/bar_status.h similarity index 100% rename from .suckless/dwm/patch/bar_status.h rename to suckless/dwm/patch/bar_status.h diff --git a/.suckless/dwm/patch/bar_tagicons.c b/suckless/dwm/patch/bar_tagicons.c similarity index 100% rename from .suckless/dwm/patch/bar_tagicons.c rename to suckless/dwm/patch/bar_tagicons.c diff --git a/.suckless/dwm/patch/bar_tagicons.h b/suckless/dwm/patch/bar_tagicons.h similarity index 100% rename from .suckless/dwm/patch/bar_tagicons.h rename to suckless/dwm/patch/bar_tagicons.h diff --git a/.suckless/dwm/patch/bar_tags.c b/suckless/dwm/patch/bar_tags.c similarity index 100% rename from .suckless/dwm/patch/bar_tags.c rename to suckless/dwm/patch/bar_tags.c diff --git a/.suckless/dwm/patch/bar_tags.h b/suckless/dwm/patch/bar_tags.h similarity index 100% rename from .suckless/dwm/patch/bar_tags.h rename to suckless/dwm/patch/bar_tags.h diff --git a/.suckless/dwm/patch/bar_wintitle.c b/suckless/dwm/patch/bar_wintitle.c similarity index 100% rename from .suckless/dwm/patch/bar_wintitle.c rename to suckless/dwm/patch/bar_wintitle.c diff --git a/.suckless/dwm/patch/bar_wintitle.h b/suckless/dwm/patch/bar_wintitle.h similarity index 100% rename from .suckless/dwm/patch/bar_wintitle.h rename to suckless/dwm/patch/bar_wintitle.h diff --git a/.suckless/dwm/patch/cool_autostart.c b/suckless/dwm/patch/cool_autostart.c similarity index 100% rename from .suckless/dwm/patch/cool_autostart.c rename to suckless/dwm/patch/cool_autostart.c diff --git a/.suckless/dwm/patch/cool_autostart.h b/suckless/dwm/patch/cool_autostart.h similarity index 100% rename from .suckless/dwm/patch/cool_autostart.h rename to suckless/dwm/patch/cool_autostart.h diff --git a/.suckless/dwm/patch/dwm-alpha-20230401-348f655.diff b/suckless/dwm/patch/dwm-alpha-20230401-348f655.diff similarity index 100% rename from .suckless/dwm/patch/dwm-alpha-20230401-348f655.diff rename to suckless/dwm/patch/dwm-alpha-20230401-348f655.diff diff --git a/.suckless/dwm/patch/dwmc b/suckless/dwm/patch/dwmc similarity index 100% rename from .suckless/dwm/patch/dwmc rename to suckless/dwm/patch/dwmc diff --git a/.suckless/dwm/patch/dwmc.c b/suckless/dwm/patch/dwmc.c similarity index 100% rename from .suckless/dwm/patch/dwmc.c rename to suckless/dwm/patch/dwmc.c diff --git a/.suckless/dwm/patch/dwmc.h b/suckless/dwm/patch/dwmc.h similarity index 100% rename from .suckless/dwm/patch/dwmc.h rename to suckless/dwm/patch/dwmc.h diff --git a/.suckless/dwm/patch/fullscreen.c b/suckless/dwm/patch/fullscreen.c similarity index 100% rename from .suckless/dwm/patch/fullscreen.c rename to suckless/dwm/patch/fullscreen.c diff --git a/.suckless/dwm/patch/fullscreen.h b/suckless/dwm/patch/fullscreen.h similarity index 100% rename from .suckless/dwm/patch/fullscreen.h rename to suckless/dwm/patch/fullscreen.h diff --git a/.suckless/dwm/patch/hidevacanttags.diff b/suckless/dwm/patch/hidevacanttags.diff similarity index 100% rename from .suckless/dwm/patch/hidevacanttags.diff rename to suckless/dwm/patch/hidevacanttags.diff diff --git a/.suckless/dwm/patch/hidevacanttags.diff.orig b/suckless/dwm/patch/hidevacanttags.diff.orig similarity index 100% rename from .suckless/dwm/patch/hidevacanttags.diff.orig rename to suckless/dwm/patch/hidevacanttags.diff.orig diff --git a/.suckless/dwm/patch/hidevacanttags.diff.rej b/suckless/dwm/patch/hidevacanttags.diff.rej similarity index 100% rename from .suckless/dwm/patch/hidevacanttags.diff.rej rename to suckless/dwm/patch/hidevacanttags.diff.rej diff --git a/.suckless/dwm/patch/include.c b/suckless/dwm/patch/include.c similarity index 100% rename from .suckless/dwm/patch/include.c rename to suckless/dwm/patch/include.c diff --git a/.suckless/dwm/patch/include.h b/suckless/dwm/patch/include.h similarity index 100% rename from .suckless/dwm/patch/include.h rename to suckless/dwm/patch/include.h diff --git a/.suckless/dwm/patch/ipc/IPCClient.h b/suckless/dwm/patch/ipc/IPCClient.h similarity index 100% rename from .suckless/dwm/patch/ipc/IPCClient.h rename to suckless/dwm/patch/ipc/IPCClient.h diff --git a/.suckless/dwm/patch/ipc/dwm-msg.c b/suckless/dwm/patch/ipc/dwm-msg.c similarity index 100% rename from .suckless/dwm/patch/ipc/dwm-msg.c rename to suckless/dwm/patch/ipc/dwm-msg.c diff --git a/.suckless/dwm/patch/ipc/yajl_dumps.h b/suckless/dwm/patch/ipc/yajl_dumps.h similarity index 100% rename from .suckless/dwm/patch/ipc/yajl_dumps.h rename to suckless/dwm/patch/ipc/yajl_dumps.h diff --git a/.suckless/dwm/patch/layout_facts.c b/suckless/dwm/patch/layout_facts.c similarity index 100% rename from .suckless/dwm/patch/layout_facts.c rename to suckless/dwm/patch/layout_facts.c diff --git a/.suckless/dwm/patch/layout_tile.c b/suckless/dwm/patch/layout_tile.c similarity index 100% rename from .suckless/dwm/patch/layout_tile.c rename to suckless/dwm/patch/layout_tile.c diff --git a/.suckless/dwm/patch/layout_tile.h b/suckless/dwm/patch/layout_tile.h similarity index 100% rename from .suckless/dwm/patch/layout_tile.h rename to suckless/dwm/patch/layout_tile.h diff --git a/.suckless/dwm/patch/moveresize.c b/suckless/dwm/patch/moveresize.c similarity index 100% rename from .suckless/dwm/patch/moveresize.c rename to suckless/dwm/patch/moveresize.c diff --git a/.suckless/dwm/patch/moveresize.h b/suckless/dwm/patch/moveresize.h similarity index 100% rename from .suckless/dwm/patch/moveresize.h rename to suckless/dwm/patch/moveresize.h diff --git a/.suckless/dwm/patch/movestack.c b/suckless/dwm/patch/movestack.c similarity index 100% rename from .suckless/dwm/patch/movestack.c rename to suckless/dwm/patch/movestack.c diff --git a/.suckless/dwm/patch/movestack.h b/suckless/dwm/patch/movestack.h similarity index 100% rename from .suckless/dwm/patch/movestack.h rename to suckless/dwm/patch/movestack.h diff --git a/.suckless/dwm/patch/scratchpad.c b/suckless/dwm/patch/scratchpad.c similarity index 100% rename from .suckless/dwm/patch/scratchpad.c rename to suckless/dwm/patch/scratchpad.c diff --git a/.suckless/dwm/patch/scratchpad.h b/suckless/dwm/patch/scratchpad.h similarity index 100% rename from .suckless/dwm/patch/scratchpad.h rename to suckless/dwm/patch/scratchpad.h diff --git a/.suckless/dwm/patch/swallow.c b/suckless/dwm/patch/swallow.c similarity index 100% rename from .suckless/dwm/patch/swallow.c rename to suckless/dwm/patch/swallow.c diff --git a/.suckless/dwm/patch/swallow.h b/suckless/dwm/patch/swallow.h similarity index 100% rename from .suckless/dwm/patch/swallow.h rename to suckless/dwm/patch/swallow.h diff --git a/.suckless/dwm/patch/togglefullscreen.c b/suckless/dwm/patch/togglefullscreen.c similarity index 100% rename from .suckless/dwm/patch/togglefullscreen.c rename to suckless/dwm/patch/togglefullscreen.c diff --git a/.suckless/dwm/patch/togglefullscreen.h b/suckless/dwm/patch/togglefullscreen.h similarity index 100% rename from .suckless/dwm/patch/togglefullscreen.h rename to suckless/dwm/patch/togglefullscreen.h diff --git a/.suckless/dwm/patch/vanitygaps.c b/suckless/dwm/patch/vanitygaps.c similarity index 100% rename from .suckless/dwm/patch/vanitygaps.c rename to suckless/dwm/patch/vanitygaps.c diff --git a/.suckless/dwm/patch/vanitygaps.h b/suckless/dwm/patch/vanitygaps.h similarity index 100% rename from .suckless/dwm/patch/vanitygaps.h rename to suckless/dwm/patch/vanitygaps.h diff --git a/.suckless/dwm/patch/xrdb.c b/suckless/dwm/patch/xrdb.c similarity index 100% rename from .suckless/dwm/patch/xrdb.c rename to suckless/dwm/patch/xrdb.c diff --git a/.suckless/dwm/patch/xrdb.h b/suckless/dwm/patch/xrdb.h similarity index 100% rename from .suckless/dwm/patch/xrdb.h rename to suckless/dwm/patch/xrdb.h diff --git a/.suckless/dwm/patches/dwm-attachaside-20160718-56a31dc.diff b/suckless/dwm/patches/dwm-attachaside-20160718-56a31dc.diff similarity index 100% rename from .suckless/dwm/patches/dwm-attachaside-20160718-56a31dc.diff rename to suckless/dwm/patches/dwm-attachaside-20160718-56a31dc.diff diff --git a/.suckless/dwm/patches/dwm-bar-height-spacing-6.3.diff b/suckless/dwm/patches/dwm-bar-height-spacing-6.3.diff similarity index 100% rename from .suckless/dwm/patches/dwm-bar-height-spacing-6.3.diff rename to suckless/dwm/patches/dwm-bar-height-spacing-6.3.diff diff --git a/.suckless/dwm/patches/dwm-barpadding-20211020-a786211.diff b/suckless/dwm/patches/dwm-barpadding-20211020-a786211.diff similarity index 100% rename from .suckless/dwm/patches/dwm-barpadding-20211020-a786211.diff rename to suckless/dwm/patches/dwm-barpadding-20211020-a786211.diff diff --git a/.suckless/dwm/patches/dwm-fullgaps-6.4.diff b/suckless/dwm/patches/dwm-fullgaps-6.4.diff similarity index 100% rename from .suckless/dwm/patches/dwm-fullgaps-6.4.diff rename to suckless/dwm/patches/dwm-fullgaps-6.4.diff diff --git a/.suckless/dwm/patches/dwm-notitle-20210715-138b405.diff b/suckless/dwm/patches/dwm-notitle-20210715-138b405.diff similarity index 100% rename from .suckless/dwm/patches/dwm-notitle-20210715-138b405.diff rename to suckless/dwm/patches/dwm-notitle-20210715-138b405.diff diff --git a/.suckless/dwm/patches/dwm-restartsig-20180523-6.2.diff b/suckless/dwm/patches/dwm-restartsig-20180523-6.2.diff similarity index 100% rename from .suckless/dwm/patches/dwm-restartsig-20180523-6.2.diff rename to suckless/dwm/patches/dwm-restartsig-20180523-6.2.diff diff --git a/.suckless/dwm/patches/dwm-statusallmons-6.2.diff b/suckless/dwm/patches/dwm-statusallmons-6.2.diff similarity index 100% rename from .suckless/dwm/patches/dwm-statusallmons-6.2.diff rename to suckless/dwm/patches/dwm-statusallmons-6.2.diff diff --git a/.suckless/dwm/patches/dwm-warp-6.4.diff b/suckless/dwm/patches/dwm-warp-6.4.diff similarity index 100% rename from .suckless/dwm/patches/dwm-warp-6.4.diff rename to suckless/dwm/patches/dwm-warp-6.4.diff diff --git a/.suckless/dwm/patches/dwm-xrdb-6.4.diff b/suckless/dwm/patches/dwm-xrdb-6.4.diff similarity index 100% rename from .suckless/dwm/patches/dwm-xrdb-6.4.diff rename to suckless/dwm/patches/dwm-xrdb-6.4.diff diff --git a/.suckless/dwm/patches/hidevacanttags.diff b/suckless/dwm/patches/hidevacanttags.diff similarity index 100% rename from .suckless/dwm/patches/hidevacanttags.diff rename to suckless/dwm/patches/hidevacanttags.diff diff --git a/.suckless/dwm/readme.dwm.txt b/suckless/dwm/readme.dwm.txt similarity index 100% rename from .suckless/dwm/readme.dwm.txt rename to suckless/dwm/readme.dwm.txt diff --git a/.suckless/dwm/transient.c b/suckless/dwm/transient.c similarity index 100% rename from .suckless/dwm/transient.c rename to suckless/dwm/transient.c diff --git a/.suckless/dwm/util.c b/suckless/dwm/util.c similarity index 100% rename from .suckless/dwm/util.c rename to suckless/dwm/util.c diff --git a/.suckless/dwm/util.h b/suckless/dwm/util.h similarity index 100% rename from .suckless/dwm/util.h rename to suckless/dwm/util.h diff --git a/.suckless/dwm/util.o b/suckless/dwm/util.o similarity index 100% rename from .suckless/dwm/util.o rename to suckless/dwm/util.o diff --git a/.suckless/dwmblocks b/suckless/dwmblocks similarity index 100% rename from .suckless/dwmblocks rename to suckless/dwmblocks diff --git a/.suckless/slstatus/LICENSE b/suckless/slstatus/LICENSE similarity index 100% rename from .suckless/slstatus/LICENSE rename to suckless/slstatus/LICENSE diff --git a/.suckless/slstatus/Makefile b/suckless/slstatus/Makefile similarity index 100% rename from .suckless/slstatus/Makefile rename to suckless/slstatus/Makefile diff --git a/.suckless/slstatus/arg.h b/suckless/slstatus/arg.h similarity index 100% rename from .suckless/slstatus/arg.h rename to suckless/slstatus/arg.h diff --git a/.suckless/slstatus/components/battery.c b/suckless/slstatus/components/battery.c similarity index 100% rename from .suckless/slstatus/components/battery.c rename to suckless/slstatus/components/battery.c diff --git a/.suckless/slstatus/components/battery.o b/suckless/slstatus/components/battery.o similarity index 100% rename from .suckless/slstatus/components/battery.o rename to suckless/slstatus/components/battery.o diff --git a/.suckless/slstatus/components/cat.c b/suckless/slstatus/components/cat.c similarity index 100% rename from .suckless/slstatus/components/cat.c rename to suckless/slstatus/components/cat.c diff --git a/.suckless/slstatus/components/cat.o b/suckless/slstatus/components/cat.o similarity index 100% rename from .suckless/slstatus/components/cat.o rename to suckless/slstatus/components/cat.o diff --git a/.suckless/slstatus/components/cpu.c b/suckless/slstatus/components/cpu.c similarity index 100% rename from .suckless/slstatus/components/cpu.c rename to suckless/slstatus/components/cpu.c diff --git a/.suckless/slstatus/components/cpu.o b/suckless/slstatus/components/cpu.o similarity index 100% rename from .suckless/slstatus/components/cpu.o rename to suckless/slstatus/components/cpu.o diff --git a/.suckless/slstatus/components/datetime.c b/suckless/slstatus/components/datetime.c similarity index 100% rename from .suckless/slstatus/components/datetime.c rename to suckless/slstatus/components/datetime.c diff --git a/.suckless/slstatus/components/datetime.o b/suckless/slstatus/components/datetime.o similarity index 100% rename from .suckless/slstatus/components/datetime.o rename to suckless/slstatus/components/datetime.o diff --git a/.suckless/slstatus/components/disk.c b/suckless/slstatus/components/disk.c similarity index 100% rename from .suckless/slstatus/components/disk.c rename to suckless/slstatus/components/disk.c diff --git a/.suckless/slstatus/components/disk.o b/suckless/slstatus/components/disk.o similarity index 100% rename from .suckless/slstatus/components/disk.o rename to suckless/slstatus/components/disk.o diff --git a/.suckless/slstatus/components/entropy.c b/suckless/slstatus/components/entropy.c similarity index 100% rename from .suckless/slstatus/components/entropy.c rename to suckless/slstatus/components/entropy.c diff --git a/.suckless/slstatus/components/entropy.o b/suckless/slstatus/components/entropy.o similarity index 100% rename from .suckless/slstatus/components/entropy.o rename to suckless/slstatus/components/entropy.o diff --git a/.suckless/slstatus/components/hostname.c b/suckless/slstatus/components/hostname.c similarity index 100% rename from .suckless/slstatus/components/hostname.c rename to suckless/slstatus/components/hostname.c diff --git a/.suckless/slstatus/components/hostname.o b/suckless/slstatus/components/hostname.o similarity index 100% rename from .suckless/slstatus/components/hostname.o rename to suckless/slstatus/components/hostname.o diff --git a/.suckless/slstatus/components/ip.c b/suckless/slstatus/components/ip.c similarity index 100% rename from .suckless/slstatus/components/ip.c rename to suckless/slstatus/components/ip.c diff --git a/.suckless/slstatus/components/ip.o b/suckless/slstatus/components/ip.o similarity index 100% rename from .suckless/slstatus/components/ip.o rename to suckless/slstatus/components/ip.o diff --git a/.suckless/slstatus/components/kernel_release.c b/suckless/slstatus/components/kernel_release.c similarity index 100% rename from .suckless/slstatus/components/kernel_release.c rename to suckless/slstatus/components/kernel_release.c diff --git a/.suckless/slstatus/components/kernel_release.o b/suckless/slstatus/components/kernel_release.o similarity index 100% rename from .suckless/slstatus/components/kernel_release.o rename to suckless/slstatus/components/kernel_release.o diff --git a/.suckless/slstatus/components/keyboard_indicators.c b/suckless/slstatus/components/keyboard_indicators.c similarity index 100% rename from .suckless/slstatus/components/keyboard_indicators.c rename to suckless/slstatus/components/keyboard_indicators.c diff --git a/.suckless/slstatus/components/keyboard_indicators.o b/suckless/slstatus/components/keyboard_indicators.o similarity index 100% rename from .suckless/slstatus/components/keyboard_indicators.o rename to suckless/slstatus/components/keyboard_indicators.o diff --git a/.suckless/slstatus/components/keymap.c b/suckless/slstatus/components/keymap.c similarity index 100% rename from .suckless/slstatus/components/keymap.c rename to suckless/slstatus/components/keymap.c diff --git a/.suckless/slstatus/components/keymap.o b/suckless/slstatus/components/keymap.o similarity index 100% rename from .suckless/slstatus/components/keymap.o rename to suckless/slstatus/components/keymap.o diff --git a/.suckless/slstatus/components/load_avg.c b/suckless/slstatus/components/load_avg.c similarity index 100% rename from .suckless/slstatus/components/load_avg.c rename to suckless/slstatus/components/load_avg.c diff --git a/.suckless/slstatus/components/load_avg.o b/suckless/slstatus/components/load_avg.o similarity index 100% rename from .suckless/slstatus/components/load_avg.o rename to suckless/slstatus/components/load_avg.o diff --git a/.suckless/slstatus/components/netspeeds.c b/suckless/slstatus/components/netspeeds.c similarity index 100% rename from .suckless/slstatus/components/netspeeds.c rename to suckless/slstatus/components/netspeeds.c diff --git a/.suckless/slstatus/components/netspeeds.o b/suckless/slstatus/components/netspeeds.o similarity index 100% rename from .suckless/slstatus/components/netspeeds.o rename to suckless/slstatus/components/netspeeds.o diff --git a/.suckless/slstatus/components/num_files.c b/suckless/slstatus/components/num_files.c similarity index 100% rename from .suckless/slstatus/components/num_files.c rename to suckless/slstatus/components/num_files.c diff --git a/.suckless/slstatus/components/num_files.o b/suckless/slstatus/components/num_files.o similarity index 100% rename from .suckless/slstatus/components/num_files.o rename to suckless/slstatus/components/num_files.o diff --git a/.suckless/slstatus/components/pixVol.sh b/suckless/slstatus/components/pixVol.sh similarity index 100% rename from .suckless/slstatus/components/pixVol.sh rename to suckless/slstatus/components/pixVol.sh diff --git a/.suckless/slstatus/components/ram.c b/suckless/slstatus/components/ram.c similarity index 100% rename from .suckless/slstatus/components/ram.c rename to suckless/slstatus/components/ram.c diff --git a/.suckless/slstatus/components/ram.o b/suckless/slstatus/components/ram.o similarity index 100% rename from .suckless/slstatus/components/ram.o rename to suckless/slstatus/components/ram.o diff --git a/.suckless/slstatus/components/run_command.c b/suckless/slstatus/components/run_command.c similarity index 100% rename from .suckless/slstatus/components/run_command.c rename to suckless/slstatus/components/run_command.c diff --git a/.suckless/slstatus/components/run_command.o b/suckless/slstatus/components/run_command.o similarity index 100% rename from .suckless/slstatus/components/run_command.o rename to suckless/slstatus/components/run_command.o diff --git a/.suckless/slstatus/components/swap.c b/suckless/slstatus/components/swap.c similarity index 100% rename from .suckless/slstatus/components/swap.c rename to suckless/slstatus/components/swap.c diff --git a/.suckless/slstatus/components/swap.o b/suckless/slstatus/components/swap.o similarity index 100% rename from .suckless/slstatus/components/swap.o rename to suckless/slstatus/components/swap.o diff --git a/.suckless/slstatus/components/temperature.c b/suckless/slstatus/components/temperature.c similarity index 100% rename from .suckless/slstatus/components/temperature.c rename to suckless/slstatus/components/temperature.c diff --git a/.suckless/slstatus/components/temperature.o b/suckless/slstatus/components/temperature.o similarity index 100% rename from .suckless/slstatus/components/temperature.o rename to suckless/slstatus/components/temperature.o diff --git a/.suckless/slstatus/components/uptime.c b/suckless/slstatus/components/uptime.c similarity index 100% rename from .suckless/slstatus/components/uptime.c rename to suckless/slstatus/components/uptime.c diff --git a/.suckless/slstatus/components/uptime.o b/suckless/slstatus/components/uptime.o similarity index 100% rename from .suckless/slstatus/components/uptime.o rename to suckless/slstatus/components/uptime.o diff --git a/.suckless/slstatus/components/user.c b/suckless/slstatus/components/user.c similarity index 100% rename from .suckless/slstatus/components/user.c rename to suckless/slstatus/components/user.c diff --git a/.suckless/slstatus/components/user.o b/suckless/slstatus/components/user.o similarity index 100% rename from .suckless/slstatus/components/user.o rename to suckless/slstatus/components/user.o diff --git a/.suckless/slstatus/components/volume.c b/suckless/slstatus/components/volume.c similarity index 100% rename from .suckless/slstatus/components/volume.c rename to suckless/slstatus/components/volume.c diff --git a/.suckless/slstatus/components/volume.o b/suckless/slstatus/components/volume.o similarity index 100% rename from .suckless/slstatus/components/volume.o rename to suckless/slstatus/components/volume.o diff --git a/.suckless/slstatus/components/wifi.c b/suckless/slstatus/components/wifi.c similarity index 100% rename from .suckless/slstatus/components/wifi.c rename to suckless/slstatus/components/wifi.c diff --git a/.suckless/slstatus/components/wifi.o b/suckless/slstatus/components/wifi.o similarity index 100% rename from .suckless/slstatus/components/wifi.o rename to suckless/slstatus/components/wifi.o diff --git a/.suckless/slstatus/config.def.h b/suckless/slstatus/config.def.h similarity index 100% rename from .suckless/slstatus/config.def.h rename to suckless/slstatus/config.def.h diff --git a/.suckless/slstatus/config.h b/suckless/slstatus/config.h similarity index 100% rename from .suckless/slstatus/config.h rename to suckless/slstatus/config.h diff --git a/.suckless/slstatus/config.h~ b/suckless/slstatus/config.h~ similarity index 100% rename from .suckless/slstatus/config.h~ rename to suckless/slstatus/config.h~ diff --git a/.suckless/slstatus/config.mk b/suckless/slstatus/config.mk similarity index 100% rename from .suckless/slstatus/config.mk rename to suckless/slstatus/config.mk diff --git a/.suckless/slstatus/slstatus b/suckless/slstatus/slstatus similarity index 100% rename from .suckless/slstatus/slstatus rename to suckless/slstatus/slstatus diff --git a/.suckless/slstatus/slstatus.1 b/suckless/slstatus/slstatus.1 similarity index 100% rename from .suckless/slstatus/slstatus.1 rename to suckless/slstatus/slstatus.1 diff --git a/.suckless/slstatus/slstatus.c b/suckless/slstatus/slstatus.c similarity index 100% rename from .suckless/slstatus/slstatus.c rename to suckless/slstatus/slstatus.c diff --git a/.suckless/slstatus/slstatus.h b/suckless/slstatus/slstatus.h similarity index 100% rename from .suckless/slstatus/slstatus.h rename to suckless/slstatus/slstatus.h diff --git a/.suckless/slstatus/slstatus.o b/suckless/slstatus/slstatus.o similarity index 100% rename from .suckless/slstatus/slstatus.o rename to suckless/slstatus/slstatus.o diff --git a/.suckless/slstatus/util.c b/suckless/slstatus/util.c similarity index 100% rename from .suckless/slstatus/util.c rename to suckless/slstatus/util.c diff --git a/.suckless/slstatus/util.h b/suckless/slstatus/util.h similarity index 100% rename from .suckless/slstatus/util.h rename to suckless/slstatus/util.h diff --git a/.suckless/slstatus/util.o b/suckless/slstatus/util.o similarity index 100% rename from .suckless/slstatus/util.o rename to suckless/slstatus/util.o diff --git a/.suckless/st/LEGACY b/suckless/st/LEGACY similarity index 100% rename from .suckless/st/LEGACY rename to suckless/st/LEGACY diff --git a/.suckless/st/LICENSE b/suckless/st/LICENSE similarity index 100% rename from .suckless/st/LICENSE rename to suckless/st/LICENSE diff --git a/.suckless/st/Makefile b/suckless/st/Makefile similarity index 87% rename from .suckless/st/Makefile rename to suckless/st/Makefile index fa43eea..dfcea0f 100644 --- a/.suckless/st/Makefile +++ b/suckless/st/Makefile @@ -4,7 +4,7 @@ include config.mk -SRC = st.c x.c boxdraw.c rowcolumn_diacritics_helpers.c graphics.c +SRC = st.c x.c hb.c OBJ = $(SRC:.c=.o) all: st @@ -16,8 +16,8 @@ config.h: $(CC) $(STCFLAGS) -c $< st.o: config.h st.h win.h -x.o: arg.h config.h st.h win.h graphics.h -boxdraw.o: config.h st.h boxdraw_data.h +x.o: arg.h config.h st.h win.h hb.h +hb.o: st.h $(OBJ): config.h config.mk diff --git a/.suckless/st/README b/suckless/st/README similarity index 100% rename from .suckless/st/README rename to suckless/st/README diff --git a/.suckless/st/TODO b/suckless/st/TODO similarity index 100% rename from .suckless/st/TODO rename to suckless/st/TODO diff --git a/.suckless/st/arg.h b/suckless/st/arg.h similarity index 100% rename from .suckless/st/arg.h rename to suckless/st/arg.h diff --git a/.suckless/st/boxdraw.c b/suckless/st/boxdraw.c similarity index 100% rename from .suckless/st/boxdraw.c rename to suckless/st/boxdraw.c diff --git a/.suckless/st/boxdraw_data.h b/suckless/st/boxdraw_data.h similarity index 100% rename from .suckless/st/boxdraw_data.h rename to suckless/st/boxdraw_data.h diff --git a/.suckless/st/config.def.h b/suckless/st/config.def.h similarity index 100% rename from .suckless/st/config.def.h rename to suckless/st/config.def.h diff --git a/suckless/st/config.h b/suckless/st/config.h new file mode 100644 index 0000000..7c73a85 --- /dev/null +++ b/suckless/st/config.h @@ -0,0 +1,479 @@ +/* See LICENSE file for copyright and license details. */ + +/* + * appearance + * + * font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html + */ +static char *font = "monospace:size=12:antialias=true:autohint=true"; +static int borderpx = 4; + +/* + * 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; + +/* default TERM value */ +char *termname = "st-256color"; + +/* + * spaces per tab + * + * When you are changing this value, don't forget to adapt the »it« value in + * the st.info and appropriately install the st.info in the environment where + * you use this st version. + * + * it#$tabspaces, + * + * Secondly make sure your kernel is not expanding tabs. When running `stty + * -a` »tab0« should appear. You can tell the terminal to not expand tabs by + * running following command: + * + * stty tabs + */ +unsigned int tabspaces = 8; + +/* bg opacity */ +float alpha = 0.8; + +/* Background opacity */ +float alpha_def; + +/* Terminal colors (16 first used in escape sequence) */ +static const char *colorname[] = { + /* 8 normal colors */ + "#282828", // black (soft bg) + "#fb4934", // red + "#b8bb26", // green + "#fabd2f", // yellow + "#83a598", // blue + "#d3869b", // magenta + "#8ec07c", // cyan + "#ebdbb2", // white (light fg) + + /* 8 bright colors */ + "#3c3836", // bright black + "#cc241d", // bright red + "#98971a", // bright green + "#d79921", // bright yellow + "#458588", // bright blue + "#b16286", // bright magenta + "#689d6a", // bright cyan + "#f9f5d7", // bright white + + [255] = 0, + "gray90", // default foreground colour + "#000000", // default background colour +}; + +/* + * Default colors (colorname index) + * foreground, background, cursor, reverse cursor + */ +unsigned int defaultfg = 256; +unsigned int defaultbg = 257; +unsigned int defaultcs = 256; +static unsigned int defaultrcs = 257; + +/* + * Default shape of cursor + * 2: Block ("█") + * 4: Underline ("_") + * 6: Bar ("|") + * 7: Snowman ("☃") + */ +static unsigned int cursorshape = 2; + +/* + * Default columns and rows numbers + */ + +static unsigned int cols = 140; +static unsigned int rows = 40; + +/* + * Default colour and shape of the mouse cursor + */ +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_NO_MOD, Button4, kscrollup, {.i = 1} }, + { XK_NO_MOD, Button5, kscrolldown, {.i = 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~"} }, + { XK_ANY_MOD, Button5, ttysend, {.s = "\005"} }, +}; + +/* Internal keyboard shortcuts. */ +#define MODKEY Mod1Mask +#define TERMMOD (Mod1Mask|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} }, + { ControlMask, XK_equal, zoom, {.f = +1} }, + { ControlMask, XK_minus, zoom, {.f = -1} }, + { TERMMOD, XK_Home, zoomreset, {.f = 0} }, + { MODKEY, XK_c, clipcopy, {.i = 0} }, + { MODKEY, XK_v, clippaste, {.i = 0} }, + { TERMMOD, XK_Y, selpaste, {.i = 0} }, + { ShiftMask, XK_Insert, selpaste, {.i = 0} }, + { TERMMOD, XK_Num_Lock, numlock, {.i = 0} }, + { MODKEY, XK_k, kscrollup, {.i = 1} }, + { MODKEY, XK_j, 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}, + { XK_F1, XK_NO_MOD, "\033OP" , 0, 0}, + { XK_F1, /* F13 */ ShiftMask, "\033[1;2P", 0, 0}, + { XK_F1, /* F25 */ ControlMask, "\033[1;5P", 0, 0}, + { XK_F1, /* F37 */ Mod4Mask, "\033[1;6P", 0, 0}, + { XK_F1, /* F49 */ Mod1Mask, "\033[1;3P", 0, 0}, + { XK_F1, /* F61 */ Mod3Mask, "\033[1;4P", 0, 0}, + { XK_F2, XK_NO_MOD, "\033OQ" , 0, 0}, + { XK_F2, /* F14 */ ShiftMask, "\033[1;2Q", 0, 0}, + { XK_F2, /* F26 */ ControlMask, "\033[1;5Q", 0, 0}, + { XK_F2, /* F38 */ Mod4Mask, "\033[1;6Q", 0, 0}, + { XK_F2, /* F50 */ Mod1Mask, "\033[1;3Q", 0, 0}, + { XK_F2, /* F62 */ Mod3Mask, "\033[1;4Q", 0, 0}, + { XK_F3, XK_NO_MOD, "\033OR" , 0, 0}, + { XK_F3, /* F15 */ ShiftMask, "\033[1;2R", 0, 0}, + { XK_F3, /* F27 */ ControlMask, "\033[1;5R", 0, 0}, + { XK_F3, /* F39 */ Mod4Mask, "\033[1;6R", 0, 0}, + { XK_F3, /* F51 */ Mod1Mask, "\033[1;3R", 0, 0}, + { XK_F3, /* F63 */ Mod3Mask, "\033[1;4R", 0, 0}, + { XK_F4, XK_NO_MOD, "\033OS" , 0, 0}, + { XK_F4, /* F16 */ ShiftMask, "\033[1;2S", 0, 0}, + { XK_F4, /* F28 */ ControlMask, "\033[1;5S", 0, 0}, + { XK_F4, /* F40 */ Mod4Mask, "\033[1;6S", 0, 0}, + { XK_F4, /* F52 */ Mod1Mask, "\033[1;3S", 0, 0}, + { XK_F5, XK_NO_MOD, "\033[15~", 0, 0}, + { XK_F5, /* F17 */ ShiftMask, "\033[15;2~", 0, 0}, + { XK_F5, /* F29 */ ControlMask, "\033[15;5~", 0, 0}, + { XK_F5, /* F41 */ Mod4Mask, "\033[15;6~", 0, 0}, + { XK_F5, /* F53 */ Mod1Mask, "\033[15;3~", 0, 0}, + { XK_F6, XK_NO_MOD, "\033[17~", 0, 0}, + { XK_F6, /* F18 */ ShiftMask, "\033[17;2~", 0, 0}, + { XK_F6, /* F30 */ ControlMask, "\033[17;5~", 0, 0}, + { XK_F6, /* F42 */ Mod4Mask, "\033[17;6~", 0, 0}, + { XK_F6, /* F54 */ Mod1Mask, "\033[17;3~", 0, 0}, + { XK_F7, XK_NO_MOD, "\033[18~", 0, 0}, + { XK_F7, /* F19 */ ShiftMask, "\033[18;2~", 0, 0}, + { XK_F7, /* F31 */ ControlMask, "\033[18;5~", 0, 0}, + { XK_F7, /* F43 */ Mod4Mask, "\033[18;6~", 0, 0}, + { XK_F7, /* F55 */ Mod1Mask, "\033[18;3~", 0, 0}, + { XK_F8, XK_NO_MOD, "\033[19~", 0, 0}, + { XK_F8, /* F20 */ ShiftMask, "\033[19;2~", 0, 0}, + { XK_F8, /* F32 */ ControlMask, "\033[19;5~", 0, 0}, + { XK_F8, /* F44 */ Mod4Mask, "\033[19;6~", 0, 0}, + { XK_F8, /* F56 */ Mod1Mask, "\033[19;3~", 0, 0}, + { XK_F9, XK_NO_MOD, "\033[20~", 0, 0}, + { XK_F9, /* F21 */ ShiftMask, "\033[20;2~", 0, 0}, + { XK_F9, /* F33 */ ControlMask, "\033[20;5~", 0, 0}, + { XK_F9, /* F45 */ Mod4Mask, "\033[20;6~", 0, 0}, + { XK_F9, /* F57 */ Mod1Mask, "\033[20;3~", 0, 0}, + { XK_F10, XK_NO_MOD, "\033[21~", 0, 0}, + { XK_F10, /* F22 */ ShiftMask, "\033[21;2~", 0, 0}, + { XK_F10, /* F34 */ ControlMask, "\033[21;5~", 0, 0}, + { XK_F10, /* F46 */ Mod4Mask, "\033[21;6~", 0, 0}, + { XK_F10, /* F58 */ Mod1Mask, "\033[21;3~", 0, 0}, + { XK_F16, XK_NO_MOD, "\033[23~", 0, 0}, + { XK_F11, /* F23 */ ShiftMask, "\033[23;2~", 0, 0}, + { XK_F11, /* F35 */ ControlMask, "\033[23;5~", 0, 0}, + { XK_F11, /* F47 */ Mod4Mask, "\033[23;6~", 0, 0}, + { XK_F11, /* F59 */ Mod1Mask, "\033[23;3~", 0, 0}, + { XK_F12, XK_NO_MOD, "\033[24~", 0, 0}, + { XK_F12, /* F24 */ ShiftMask, "\033[24;2~", 0, 0}, + { XK_F12, /* F36 */ ControlMask, "\033[24;5~", 0, 0}, + { XK_F12, /* F48 */ Mod4Mask, "\033[24;6~", 0, 0}, + { XK_F12, /* F60 */ Mod1Mask, "\033[24;3~", 0, 0}, + { XK_F13, XK_NO_MOD, "\033[1;2P", 0, 0}, + { XK_F14, XK_NO_MOD, "\033[1;2Q", 0, 0}, + { XK_F15, XK_NO_MOD, "\033[1;2R", 0, 0}, + { XK_F16, XK_NO_MOD, "\033[1;2S", 0, 0}, + { XK_F17, XK_NO_MOD, "\033[15;2~", 0, 0}, + { XK_F18, XK_NO_MOD, "\033[17;2~", 0, 0}, + { XK_F19, XK_NO_MOD, "\033[18;2~", 0, 0}, + { XK_F20, XK_NO_MOD, "\033[19;2~", 0, 0}, + { XK_F21, XK_NO_MOD, "\033[20;2~", 0, 0}, + { XK_F22, XK_NO_MOD, "\033[21;2~", 0, 0}, + { XK_F23, XK_NO_MOD, "\033[23;2~", 0, 0}, + { XK_F24, XK_NO_MOD, "\033[24;2~", 0, 0}, + { XK_F25, XK_NO_MOD, "\033[1;5P", 0, 0}, + { XK_F26, XK_NO_MOD, "\033[1;5Q", 0, 0}, + { XK_F27, XK_NO_MOD, "\033[1;5R", 0, 0}, + { XK_F28, XK_NO_MOD, "\033[1;5S", 0, 0}, + { XK_F29, XK_NO_MOD, "\033[15;5~", 0, 0}, + { XK_F30, XK_NO_MOD, "\033[17;5~", 0, 0}, + { XK_F31, XK_NO_MOD, "\033[18;5~", 0, 0}, + { XK_F32, XK_NO_MOD, "\033[19;5~", 0, 0}, + { XK_F33, XK_NO_MOD, "\033[20;5~", 0, 0}, + { XK_F34, XK_NO_MOD, "\033[21;5~", 0, 0}, + { XK_F35, XK_NO_MOD, "\033[23;5~", 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{|}~"; diff --git a/suckless/st/config.h.save b/suckless/st/config.h.save new file mode 100644 index 0000000..b25362c --- /dev/null +++ b/suckless/st/config.h.save @@ -0,0 +1,486 @@ +/* See LICENSE file for copyright and license details. */ + +/* + * appearance + * + * font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html + */ +static char *font = "Terminus-9:antialias=true:autohint=true"; +static int borderpx = 2; + +/* + * 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; + +/* default TERM value */ +char *termname = "st-256color"; + +/* + * spaces per tab + * + * When you are changing this value, don't forget to adapt the »it« value in + * the st.info and appropriately install the st.info in the environment where + * you use this st version. + * + * it#$tabspaces, + * + * Secondly make sure your kernel is not expanding tabs. When running `stty + * -a` »tab0« should appear. You can tell the terminal to not expand tabs by + * running following command: + * + * stty tabs + */ +unsigned int tabspaces = 8; + +/* bg opacity */ +float alpha = 0.8; + +/* Background opacity */ +float alpha_def; + +/* Terminal colors (16 first used in escape sequence) */ +static const char *colorname[] = { + + /* 8 normal colors */ + "#0a0a0a", /* black */ + "#44516d", /* red */ + "#c95d38", /* green */ + "#de9e68", /* yellow */ + "#8b7675", /* blue */ + "#7e5f8c", /* magenta */ + "#8c82c2", /* cyan */ + "#eff7d0", /* white */ + + /* 8 bright colors */ + "#181818", /* black */ + "#7d87a1", /* red */ + "#e9673c", /* green */ + "#e0b18b", /* yellow */ + "#b9a192", /* blue */ + "#9a7ebd", /* magenta */ + "#bccce2", /* cyan */ + "#ffffff", /* white */ + + [255] = 0, + + /* more colors can be added after 255 to use with DefaultXX */ + "#gray90", /* default foreground colour */ + "#black", /* default background colour */ +}; + + +/* + * Default colors (colorname index) + * foreground, background, cursor, reverse cursor + */ +unsigned int defaultfg = 256; +unsigned int defaultbg = 257; +unsigned int defaultcs = 256; +static unsigned int defaultrcs = 257; + +/* + * Default shape of cursor + * 2: Block ("█") + * 4: Underline ("_") + * 6: Bar ("|") + * 7: Snowman ("☃") + */ +static unsigned int cursorshape = 6; + +/* + * Default columns and rows numbers + */ + +static unsigned int cols = 80; +static unsigned int rows = 24; + +/* + * Default colour and shape of the mouse cursor + */ +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_NO_MOD, Button4, kscrollup, {.i = 1} }, + { XK_NO_MOD, Button5, kscrolldown, {.i = 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~"} }, + { XK_ANY_MOD, Button5, ttysend, {.s = "\005"} }, +}; + +/* Internal keyboard shortcuts. */ +#define MODKEY Mod1Mask +#define TERMMOD (Mod1Mask|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} }, + { ControlMask, XK_j, zoom, {.f = +1} }, + { ControlMask, XK_minus, zoom, {.f = -1} }, + { TERMMOD, XK_Home, zoomreset, {.f = 0} }, + { MODKEY, XK_c, clipcopy, {.i = 0} }, + { MODKEY, XK_v, clippaste, {.i = 0} }, + { TERMMOD, XK_Y, selpaste, {.i = 0} }, + { ShiftMask, XK_Insert, selpaste, {.i = 0} }, + { TERMMOD, XK_Num_Lock, numlock, {.i = 0} }, + { MODKEY, XK_k, kscrollup, {.i = 1} }, + { MODKEY, XK_j, kscrolldown, {.i = 1} }, + { MODKEY, XK_a, chgalpha, {.f = -1} }, + { MODKEY, XK_s, chgalpha, {.f = +1} }, + { MODKEY, XK_d, chgalpha, {.f = 0} }, +}; + +/* + * 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}, + { XK_F1, XK_NO_MOD, "\033OP" , 0, 0}, + { XK_F1, /* F13 */ ShiftMask, "\033[1;2P", 0, 0}, + { XK_F1, /* F25 */ ControlMask, "\033[1;5P", 0, 0}, + { XK_F1, /* F37 */ Mod4Mask, "\033[1;6P", 0, 0}, + { XK_F1, /* F49 */ Mod1Mask, "\033[1;3P", 0, 0}, + { XK_F1, /* F61 */ Mod3Mask, "\033[1;4P", 0, 0}, + { XK_F2, XK_NO_MOD, "\033OQ" , 0, 0}, + { XK_F2, /* F14 */ ShiftMask, "\033[1;2Q", 0, 0}, + { XK_F2, /* F26 */ ControlMask, "\033[1;5Q", 0, 0}, + { XK_F2, /* F38 */ Mod4Mask, "\033[1;6Q", 0, 0}, + { XK_F2, /* F50 */ Mod1Mask, "\033[1;3Q", 0, 0}, + { XK_F2, /* F62 */ Mod3Mask, "\033[1;4Q", 0, 0}, + { XK_F3, XK_NO_MOD, "\033OR" , 0, 0}, + { XK_F3, /* F15 */ ShiftMask, "\033[1;2R", 0, 0}, + { XK_F3, /* F27 */ ControlMask, "\033[1;5R", 0, 0}, + { XK_F3, /* F39 */ Mod4Mask, "\033[1;6R", 0, 0}, + { XK_F3, /* F51 */ Mod1Mask, "\033[1;3R", 0, 0}, + { XK_F3, /* F63 */ Mod3Mask, "\033[1;4R", 0, 0}, + { XK_F4, XK_NO_MOD, "\033OS" , 0, 0}, + { XK_F4, /* F16 */ ShiftMask, "\033[1;2S", 0, 0}, + { XK_F4, /* F28 */ ControlMask, "\033[1;5S", 0, 0}, + { XK_F4, /* F40 */ Mod4Mask, "\033[1;6S", 0, 0}, + { XK_F4, /* F52 */ Mod1Mask, "\033[1;3S", 0, 0}, + { XK_F5, XK_NO_MOD, "\033[15~", 0, 0}, + { XK_F5, /* F17 */ ShiftMask, "\033[15;2~", 0, 0}, + { XK_F5, /* F29 */ ControlMask, "\033[15;5~", 0, 0}, + { XK_F5, /* F41 */ Mod4Mask, "\033[15;6~", 0, 0}, + { XK_F5, /* F53 */ Mod1Mask, "\033[15;3~", 0, 0}, + { XK_F6, XK_NO_MOD, "\033[17~", 0, 0}, + { XK_F6, /* F18 */ ShiftMask, "\033[17;2~", 0, 0}, + { XK_F6, /* F30 */ ControlMask, "\033[17;5~", 0, 0}, + { XK_F6, /* F42 */ Mod4Mask, "\033[17;6~", 0, 0}, + { XK_F6, /* F54 */ Mod1Mask, "\033[17;3~", 0, 0}, + { XK_F7, XK_NO_MOD, "\033[18~", 0, 0}, + { XK_F7, /* F19 */ ShiftMask, "\033[18;2~", 0, 0}, + { XK_F7, /* F31 */ ControlMask, "\033[18;5~", 0, 0}, + { XK_F7, /* F43 */ Mod4Mask, "\033[18;6~", 0, 0}, + { XK_F7, /* F55 */ Mod1Mask, "\033[18;3~", 0, 0}, + { XK_F8, XK_NO_MOD, "\033[19~", 0, 0}, + { XK_F8, /* F20 */ ShiftMask, "\033[19;2~", 0, 0}, + { XK_F8, /* F32 */ ControlMask, "\033[19;5~", 0, 0}, + { XK_F8, /* F44 */ Mod4Mask, "\033[19;6~", 0, 0}, + { XK_F8, /* F56 */ Mod1Mask, "\033[19;3~", 0, 0}, + { XK_F9, XK_NO_MOD, "\033[20~", 0, 0}, + { XK_F9, /* F21 */ ShiftMask, "\033[20;2~", 0, 0}, + { XK_F9, /* F33 */ ControlMask, "\033[20;5~", 0, 0}, + { XK_F9, /* F45 */ Mod4Mask, "\033[20;6~", 0, 0}, + { XK_F9, /* F57 */ Mod1Mask, "\033[20;3~", 0, 0}, + { XK_F10, XK_NO_MOD, "\033[21~", 0, 0}, + { XK_F10, /* F22 */ ShiftMask, "\033[21;2~", 0, 0}, + { XK_F10, /* F34 */ ControlMask, "\033[21;5~", 0, 0}, + { XK_F10, /* F46 */ Mod4Mask, "\033[21;6~", 0, 0}, + { XK_F10, /* F58 */ Mod1Mask, "\033[21;3~", 0, 0}, + { XK_F11, XK_NO_MOD, "\033[23~", 0, 0}, + { XK_F11, /* F23 */ ShiftMask, "\033[23;2~", 0, 0}, + { XK_F11, /* F35 */ ControlMask, "\033[23;5~", 0, 0}, + { XK_F11, /* F47 */ Mod4Mask, "\033[23;6~", 0, 0}, + { XK_F11, /* F59 */ Mod1Mask, "\033[23;3~", 0, 0}, + { XK_F12, XK_NO_MOD, "\033[24~", 0, 0}, + { XK_F12, /* F24 */ ShiftMask, "\033[24;2~", 0, 0}, + { XK_F12, /* F36 */ ControlMask, "\033[24;5~", 0, 0}, + { XK_F12, /* F48 */ Mod4Mask, "\033[24;6~", 0, 0}, + { XK_F12, /* F60 */ Mod1Mask, "\033[24;3~", 0, 0}, + { XK_F13, XK_NO_MOD, "\033[1;2P", 0, 0}, + { XK_F14, XK_NO_MOD, "\033[1;2Q", 0, 0}, + { XK_F15, XK_NO_MOD, "\033[1;2R", 0, 0}, + { XK_F16, XK_NO_MOD, "\033[1;2S", 0, 0}, + { XK_F17, XK_NO_MOD, "\033[15;2~", 0, 0}, + { XK_F18, XK_NO_MOD, "\033[17;2~", 0, 0}, + { XK_F19, XK_NO_MOD, "\033[18;2~", 0, 0}, + { XK_F20, XK_NO_MOD, "\033[19;2~", 0, 0}, + { XK_F21, XK_NO_MOD, "\033[20;2~", 0, 0}, + { XK_F22, XK_NO_MOD, "\033[21;2~", 0, 0}, + { XK_F23, XK_NO_MOD, "\033[23;2~", 0, 0}, + { XK_F24, XK_NO_MOD, "\033[24;2~", 0, 0}, + { XK_F25, XK_NO_MOD, "\033[1;5P", 0, 0}, + { XK_F26, XK_NO_MOD, "\033[1;5Q", 0, 0}, + { XK_F27, XK_NO_MOD, "\033[1;5R", 0, 0}, + { XK_F28, XK_NO_MOD, "\033[1;5S", 0, 0}, + { XK_F29, XK_NO_MOD, "\033[15;5~", 0, 0}, + { XK_F30, XK_NO_MOD, "\033[17;5~", 0, 0}, + { XK_F31, XK_NO_MOD, "\033[18;5~", 0, 0}, + { XK_F32, XK_NO_MOD, "\033[19;5~", 0, 0}, + { XK_F33, XK_NO_MOD, "\033[20;5~", 0, 0}, + { XK_F34, XK_NO_MOD, "\033[21;5~", 0, 0}, + { XK_F35, XK_NO_MOD, "\033[23;5~", 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{|}~"; diff --git a/suckless/st/config.h.save.1 b/suckless/st/config.h.save.1 new file mode 100644 index 0000000..d608c5a --- /dev/null +++ b/suckless/st/config.h.save.1 @@ -0,0 +1,486 @@ +/* See LICENSE file for copyright and license details. */ + +/* + * appearance + * + * font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html + */ +static char *font = "Terminus-9:antialias=true:autohint=true"; +static int borderpx = 2; + +/* + * 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; + +/* default TERM value */ +char *termname = "st-256color"; + +/* + * spaces per tab + * + * When you are changing this value, don't forget to adapt the »it« value in + * the st.info and appropriately install the st.info in the environment where + * you use this st version. + * + * it#$tabspaces, + * + * Secondly make sure your kernel is not expanding tabs. When running `stty + * -a` »tab0« should appear. You can tell the terminal to not expand tabs by + * running following command: + * + * stty tabs + */ +unsigned int tabspaces = 8; + +/* bg opacity */ +float alpha = 0.8; + +/* Background opacity */ +float alpha_def; + +/* Terminal colors (16 first used in escape sequence) */ +static const char *colorname[] = { + + /* 8 normal colors */ + "#0a0a0a", /* black */ + "#44516d", /* red */ + "#c95d38", /* green */ + "#de9e68", /* yellow */ + "#8b7675", /* blue */ + "#7e5f8c", /* magenta */ + "#8c82c2", /* cyan */ + "#eff7d0", /* white */ + + /* 8 bright colors */ + "#181818", /* black */ + "#7d87a1", /* red */ + "#e9673c", /* green */ + "#e0b18b", /* yellow */ + "#b9a192", /* blue */ + "#9a7ebd", /* magenta */ + "#bccce2", /* cyan */ + "#ffffff", /* white */ + + [255] = 0, + + /* more colors can be added after 255 to use with DefaultXX */ + "gray90", /* default foreground colour */ + "black", /* default background colour */ +}; + + +/* + * Default colors (colorname index) + * foreground, background, cursor, reverse cursor + */ +unsigned int defaultfg = 256; +unsigned int defaultbg = 257; +unsigned int defaultcs = 256; +static unsigned int defaultrcs = 257; + +/* + * Default shape of cursor + * 2: Block ("█") + * 4: Underline ("_") + * 6: Bar ("|") + * 7: Snowman ("☃") + */ +static unsigned int cursorshape = 6; + +/* + * Default columns and rows numbers + */ + +static unsigned int cols = 80; +static unsigned int rows = 24; + +/* + * Default colour and shape of the mouse cursor + */ +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_NO_MOD, Button4, kscrollup, {.i = 1} }, + { XK_NO_MOD, Button5, kscrolldown, {.i = 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~"} }, + { XK_ANY_MOD, Button5, ttysend, {.s = "\005"} }, +}; + +/* Internal keyboard shortcuts. */ +#define MODKEY Mod1Mask +#define TERMMOD (Mod1Mask|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} }, + { ControlMask, XK_equal, zoom, {.f = +1} }, + { ControlMask, XK_minus, zoom, {.f = -1} }, + { TERMMOD, XK_Home, zoomreset, {.f = 0} }, + { MODKEY, XK_c, clipcopy, {.i = 0} }, + { MODKEY, XK_v, clippaste, {.i = 0} }, + { TERMMOD, XK_Y, selpaste, {.i = 0} }, + { ShiftMask, XK_Insert, selpaste, {.i = 0} }, + { TERMMOD, XK_Num_Lock, numlock, {.i = 0} }, + { ControlMask, XK_k, kscrollup, {.i = 1} }, + { ControlMask, XK_j, kscrolldown, {.i = 1} }, + { MODKEY, XK_a, chgalpha, {.f = -1} }, + { MODKEY, XK_s, chgalpha, {.f = +1} }, + { MODKEY, XK_d, chgalpha, {.f = 0} }, +}; + +/* + * 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}, + { XK_F1, XK_NO_MOD, "\033OP" , 0, 0}, + { XK_F1, /* F13 */ ShiftMask, "\033[1;2P", 0, 0}, + { XK_F1, /* F25 */ ControlMask, "\033[1;5P", 0, 0}, + { XK_F1, /* F37 */ Mod4Mask, "\033[1;6P", 0, 0}, + { XK_F1, /* F49 */ Mod1Mask, "\033[1;3P", 0, 0}, + { XK_F1, /* F61 */ Mod3Mask, "\033[1;4P", 0, 0}, + { XK_F2, XK_NO_MOD, "\033OQ" , 0, 0}, + { XK_F2, /* F14 */ ShiftMask, "\033[1;2Q", 0, 0}, + { XK_F2, /* F26 */ ControlMask, "\033[1;5Q", 0, 0}, + { XK_F2, /* F38 */ Mod4Mask, "\033[1;6Q", 0, 0}, + { XK_F2, /* F50 */ Mod1Mask, "\033[1;3Q", 0, 0}, + { XK_F2, /* F62 */ Mod3Mask, "\033[1;4Q", 0, 0}, + { XK_F3, XK_NO_MOD, "\033OR" , 0, 0}, + { XK_F3, /* F15 */ ShiftMask, "\033[1;2R", 0, 0}, + { XK_F3, /* F27 */ ControlMask, "\033[1;5R", 0, 0}, + { XK_F3, /* F39 */ Mod4Mask, "\033[1;6R", 0, 0}, + { XK_F3, /* F51 */ Mod1Mask, "\033[1;3R", 0, 0}, + { XK_F3, /* F63 */ Mod3Mask, "\033[1;4R", 0, 0}, + { XK_F4, XK_NO_MOD, "\033OS" , 0, 0}, + { XK_F4, /* F16 */ ShiftMask, "\033[1;2S", 0, 0}, + { XK_F4, /* F28 */ ControlMask, "\033[1;5S", 0, 0}, + { XK_F4, /* F40 */ Mod4Mask, "\033[1;6S", 0, 0}, + { XK_F4, /* F52 */ Mod1Mask, "\033[1;3S", 0, 0}, + { XK_F5, XK_NO_MOD, "\033[15~", 0, 0}, + { XK_F5, /* F17 */ ShiftMask, "\033[15;2~", 0, 0}, + { XK_F5, /* F29 */ ControlMask, "\033[15;5~", 0, 0}, + { XK_F5, /* F41 */ Mod4Mask, "\033[15;6~", 0, 0}, + { XK_F5, /* F53 */ Mod1Mask, "\033[15;3~", 0, 0}, + { XK_F6, XK_NO_MOD, "\033[17~", 0, 0}, + { XK_F6, /* F18 */ ShiftMask, "\033[17;2~", 0, 0}, + { XK_F6, /* F30 */ ControlMask, "\033[17;5~", 0, 0}, + { XK_F6, /* F42 */ Mod4Mask, "\033[17;6~", 0, 0}, + { XK_F6, /* F54 */ Mod1Mask, "\033[17;3~", 0, 0}, + { XK_F7, XK_NO_MOD, "\033[18~", 0, 0}, + { XK_F7, /* F19 */ ShiftMask, "\033[18;2~", 0, 0}, + { XK_F7, /* F31 */ ControlMask, "\033[18;5~", 0, 0}, + { XK_F7, /* F43 */ Mod4Mask, "\033[18;6~", 0, 0}, + { XK_F7, /* F55 */ Mod1Mask, "\033[18;3~", 0, 0}, + { XK_F8, XK_NO_MOD, "\033[19~", 0, 0}, + { XK_F8, /* F20 */ ShiftMask, "\033[19;2~", 0, 0}, + { XK_F8, /* F32 */ ControlMask, "\033[19;5~", 0, 0}, + { XK_F8, /* F44 */ Mod4Mask, "\033[19;6~", 0, 0}, + { XK_F8, /* F56 */ Mod1Mask, "\033[19;3~", 0, 0}, + { XK_F9, XK_NO_MOD, "\033[20~", 0, 0}, + { XK_F9, /* F21 */ ShiftMask, "\033[20;2~", 0, 0}, + { XK_F9, /* F33 */ ControlMask, "\033[20;5~", 0, 0}, + { XK_F9, /* F45 */ Mod4Mask, "\033[20;6~", 0, 0}, + { XK_F9, /* F57 */ Mod1Mask, "\033[20;3~", 0, 0}, + { XK_F10, XK_NO_MOD, "\033[21~", 0, 0}, + { XK_F10, /* F22 */ ShiftMask, "\033[21;2~", 0, 0}, + { XK_F10, /* F34 */ ControlMask, "\033[21;5~", 0, 0}, + { XK_F10, /* F46 */ Mod4Mask, "\033[21;6~", 0, 0}, + { XK_F10, /* F58 */ Mod1Mask, "\033[21;3~", 0, 0}, + { XK_F11, XK_NO_MOD, "\033[23~", 0, 0}, + { XK_F11, /* F23 */ ShiftMask, "\033[23;2~", 0, 0}, + { XK_F11, /* F35 */ ControlMask, "\033[23;5~", 0, 0}, + { XK_F11, /* F47 */ Mod4Mask, "\033[23;6~", 0, 0}, + { XK_F11, /* F59 */ Mod1Mask, "\033[23;3~", 0, 0}, + { XK_F12, XK_NO_MOD, "\033[24~", 0, 0}, + { XK_F12, /* F24 */ ShiftMask, "\033[24;2~", 0, 0}, + { XK_F12, /* F36 */ ControlMask, "\033[24;5~", 0, 0}, + { XK_F12, /* F48 */ Mod4Mask, "\033[24;6~", 0, 0}, + { XK_F12, /* F60 */ Mod1Mask, "\033[24;3~", 0, 0}, + { XK_F13, XK_NO_MOD, "\033[1;2P", 0, 0}, + { XK_F14, XK_NO_MOD, "\033[1;2Q", 0, 0}, + { XK_F15, XK_NO_MOD, "\033[1;2R", 0, 0}, + { XK_F16, XK_NO_MOD, "\033[1;2S", 0, 0}, + { XK_F17, XK_NO_MOD, "\033[15;2~", 0, 0}, + { XK_F18, XK_NO_MOD, "\033[17;2~", 0, 0}, + { XK_F19, XK_NO_MOD, "\033[18;2~", 0, 0}, + { XK_F20, XK_NO_MOD, "\033[19;2~", 0, 0}, + { XK_F21, XK_NO_MOD, "\033[20;2~", 0, 0}, + { XK_F22, XK_NO_MOD, "\033[21;2~", 0, 0}, + { XK_F23, XK_NO_MOD, "\033[23;2~", 0, 0}, + { XK_F24, XK_NO_MOD, "\033[24;2~", 0, 0}, + { XK_F25, XK_NO_MOD, "\033[1;5P", 0, 0}, + { XK_F26, XK_NO_MOD, "\033[1;5Q", 0, 0}, + { XK_F27, XK_NO_MOD, "\033[1;5R", 0, 0}, + { XK_F28, XK_NO_MOD, "\033[1;5S", 0, 0}, + { XK_F29, XK_NO_MOD, "\033[15;5~", 0, 0}, + { XK_F30, XK_NO_MOD, "\033[17;5~", 0, 0}, + { XK_F31, XK_NO_MOD, "\033[18;5~", 0, 0}, + { XK_F32, XK_NO_MOD, "\033[19;5~", 0, 0}, + { XK_F33, XK_NO_MOD, "\033[20;5~", 0, 0}, + { XK_F34, XK_NO_MOD, "\033[21;5~", 0, 0}, + { XK_F35, XK_NO_MOD, "\033[23;5~", 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{|}~"; diff --git a/suckless/st/config.h.save.2 b/suckless/st/config.h.save.2 new file mode 100644 index 0000000..4869423 --- /dev/null +++ b/suckless/st/config.h.save.2 @@ -0,0 +1,486 @@ +/* See LICENSE file for copyright and license details. */ + +/* + * appearance + * + * font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html + */ +static char *font = "Terminus-9:antialias=true:autohint=true"; +static int borderpx = 2; + +/* + * 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; + +/* default TERM value */ +char *termname = "st-256color"; + +/* + * spaces per tab + * + * When you are changing this value, don't forget to adapt the »it« value in + * the st.info and appropriately install the st.info in the environment where + * you use this st version. + * + * it#$tabspaces, + * + * Secondly make sure your kernel is not expanding tabs. When running `stty + * -a` »tab0« should appear. You can tell the terminal to not expand tabs by + * running following command: + * + * stty tabs + */ +unsigned int tabspaces = 8; + +/* bg opacity */ +float alpha = 0.8; + +/* Background opacity */ +float alpha_def; + +/* Terminal colors (16 first used in escape sequence) */ +static const char *colorname[] = { + + /* 8 normal colors */ + "#0a0a0a", /* black */ + "#44516d", /* red */ + "#c95d38", /* green */ + "#de9e68", /* yellow */ + "#8b7675", /* blue */ + "#7e5f8c", /* magenta */ + "#8c82c2", /* cyan */ + "#eff7d0", /* white */ + + /* 8 bright colors */ + "#181818", /* black */ + "#7d87a1", /* red */ + "#e9673c", /* green */ + "#e0b18b", /* yellow */ + "#b9a192", /* blue */ + "#9a7ebd", /* magenta */ + "#bccce2", /* cyan */ + "#ffffff", /* white */ + + [255] = 0, + + /* more colors can be added after 255 to use with DefaultXX */ + "gray90", /* default foreground colour */ + "black", /* default background colour */ +}; + + +/* + * Default colors (colorname index) + * foreground, background, cursor, reverse cursor + */ +unsigned int defaultfg = 256; +unsigned int defaultbg = 257; +unsigned int defaultcs = 256; +static unsigned int defaultrcs = 257; + +/* + * Default shape of cursor + * 2: Block ("█") + * 4: Underline ("_") + * 6: Bar ("|") + * 7: Snowman ("☃") + */ +static unsigned int cursorshape = 6; + +/* + * Default columns and rows numbers + */ + +static unsigned int cols = 80; +static unsigned int rows = 24; + +/* + * Default colour and shape of the mouse cursor + */ +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_NO_MOD, Button4, kscrollup, {.i = 1} }, + { XK_NO_MOD, Button5, kscrolldown, {.i = 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~"} }, + { XK_ANY_MOD, Button5, ttysend, {.s = "\005"} }, +}; + +/* Internal keyboard shortcuts. */ +#define MODKEY Mod1Mask +#define TERMMOD (Mod1Mask|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} }, + { ControlMask, XK_equal, zoom, {.f = +1} }, + { ControlMask, XK_minus, zoom, {.f = -1} }, + { TERMMOD, XK_Home, zoomreset, {.f = 0} }, + { ControlMask|Shift, XK_c, clipcopy, {.i = 0} }, + { MODKEY, XK_v, clippaste, {.i = 0} }, + { TERMMOD, XK_Y, selpaste, {.i = 0} }, + { ShiftMask, XK_Insert, selpaste, {.i = 0} }, + { TERMMOD, XK_Num_Lock, numlock, {.i = 0} }, + { ControlMask, XK_k, kscrollup, {.i = 1} }, + { ControlMask, XK_j, kscrolldown, {.i = 1} }, + { MODKEY, XK_a, chgalpha, {.f = -1} }, + { MODKEY, XK_s, chgalpha, {.f = +1} }, + { MODKEY, XK_d, chgalpha, {.f = 0} }, +}; + +/* + * 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}, + { XK_F1, XK_NO_MOD, "\033OP" , 0, 0}, + { XK_F1, /* F13 */ ShiftMask, "\033[1;2P", 0, 0}, + { XK_F1, /* F25 */ ControlMask, "\033[1;5P", 0, 0}, + { XK_F1, /* F37 */ Mod4Mask, "\033[1;6P", 0, 0}, + { XK_F1, /* F49 */ Mod1Mask, "\033[1;3P", 0, 0}, + { XK_F1, /* F61 */ Mod3Mask, "\033[1;4P", 0, 0}, + { XK_F2, XK_NO_MOD, "\033OQ" , 0, 0}, + { XK_F2, /* F14 */ ShiftMask, "\033[1;2Q", 0, 0}, + { XK_F2, /* F26 */ ControlMask, "\033[1;5Q", 0, 0}, + { XK_F2, /* F38 */ Mod4Mask, "\033[1;6Q", 0, 0}, + { XK_F2, /* F50 */ Mod1Mask, "\033[1;3Q", 0, 0}, + { XK_F2, /* F62 */ Mod3Mask, "\033[1;4Q", 0, 0}, + { XK_F3, XK_NO_MOD, "\033OR" , 0, 0}, + { XK_F3, /* F15 */ ShiftMask, "\033[1;2R", 0, 0}, + { XK_F3, /* F27 */ ControlMask, "\033[1;5R", 0, 0}, + { XK_F3, /* F39 */ Mod4Mask, "\033[1;6R", 0, 0}, + { XK_F3, /* F51 */ Mod1Mask, "\033[1;3R", 0, 0}, + { XK_F3, /* F63 */ Mod3Mask, "\033[1;4R", 0, 0}, + { XK_F4, XK_NO_MOD, "\033OS" , 0, 0}, + { XK_F4, /* F16 */ ShiftMask, "\033[1;2S", 0, 0}, + { XK_F4, /* F28 */ ControlMask, "\033[1;5S", 0, 0}, + { XK_F4, /* F40 */ Mod4Mask, "\033[1;6S", 0, 0}, + { XK_F4, /* F52 */ Mod1Mask, "\033[1;3S", 0, 0}, + { XK_F5, XK_NO_MOD, "\033[15~", 0, 0}, + { XK_F5, /* F17 */ ShiftMask, "\033[15;2~", 0, 0}, + { XK_F5, /* F29 */ ControlMask, "\033[15;5~", 0, 0}, + { XK_F5, /* F41 */ Mod4Mask, "\033[15;6~", 0, 0}, + { XK_F5, /* F53 */ Mod1Mask, "\033[15;3~", 0, 0}, + { XK_F6, XK_NO_MOD, "\033[17~", 0, 0}, + { XK_F6, /* F18 */ ShiftMask, "\033[17;2~", 0, 0}, + { XK_F6, /* F30 */ ControlMask, "\033[17;5~", 0, 0}, + { XK_F6, /* F42 */ Mod4Mask, "\033[17;6~", 0, 0}, + { XK_F6, /* F54 */ Mod1Mask, "\033[17;3~", 0, 0}, + { XK_F7, XK_NO_MOD, "\033[18~", 0, 0}, + { XK_F7, /* F19 */ ShiftMask, "\033[18;2~", 0, 0}, + { XK_F7, /* F31 */ ControlMask, "\033[18;5~", 0, 0}, + { XK_F7, /* F43 */ Mod4Mask, "\033[18;6~", 0, 0}, + { XK_F7, /* F55 */ Mod1Mask, "\033[18;3~", 0, 0}, + { XK_F8, XK_NO_MOD, "\033[19~", 0, 0}, + { XK_F8, /* F20 */ ShiftMask, "\033[19;2~", 0, 0}, + { XK_F8, /* F32 */ ControlMask, "\033[19;5~", 0, 0}, + { XK_F8, /* F44 */ Mod4Mask, "\033[19;6~", 0, 0}, + { XK_F8, /* F56 */ Mod1Mask, "\033[19;3~", 0, 0}, + { XK_F9, XK_NO_MOD, "\033[20~", 0, 0}, + { XK_F9, /* F21 */ ShiftMask, "\033[20;2~", 0, 0}, + { XK_F9, /* F33 */ ControlMask, "\033[20;5~", 0, 0}, + { XK_F9, /* F45 */ Mod4Mask, "\033[20;6~", 0, 0}, + { XK_F9, /* F57 */ Mod1Mask, "\033[20;3~", 0, 0}, + { XK_F10, XK_NO_MOD, "\033[21~", 0, 0}, + { XK_F10, /* F22 */ ShiftMask, "\033[21;2~", 0, 0}, + { XK_F10, /* F34 */ ControlMask, "\033[21;5~", 0, 0}, + { XK_F10, /* F46 */ Mod4Mask, "\033[21;6~", 0, 0}, + { XK_F10, /* F58 */ Mod1Mask, "\033[21;3~", 0, 0}, + { XK_F11, XK_NO_MOD, "\033[23~", 0, 0}, + { XK_F11, /* F23 */ ShiftMask, "\033[23;2~", 0, 0}, + { XK_F11, /* F35 */ ControlMask, "\033[23;5~", 0, 0}, + { XK_F11, /* F47 */ Mod4Mask, "\033[23;6~", 0, 0}, + { XK_F11, /* F59 */ Mod1Mask, "\033[23;3~", 0, 0}, + { XK_F12, XK_NO_MOD, "\033[24~", 0, 0}, + { XK_F12, /* F24 */ ShiftMask, "\033[24;2~", 0, 0}, + { XK_F12, /* F36 */ ControlMask, "\033[24;5~", 0, 0}, + { XK_F12, /* F48 */ Mod4Mask, "\033[24;6~", 0, 0}, + { XK_F12, /* F60 */ Mod1Mask, "\033[24;3~", 0, 0}, + { XK_F13, XK_NO_MOD, "\033[1;2P", 0, 0}, + { XK_F14, XK_NO_MOD, "\033[1;2Q", 0, 0}, + { XK_F15, XK_NO_MOD, "\033[1;2R", 0, 0}, + { XK_F16, XK_NO_MOD, "\033[1;2S", 0, 0}, + { XK_F17, XK_NO_MOD, "\033[15;2~", 0, 0}, + { XK_F18, XK_NO_MOD, "\033[17;2~", 0, 0}, + { XK_F19, XK_NO_MOD, "\033[18;2~", 0, 0}, + { XK_F20, XK_NO_MOD, "\033[19;2~", 0, 0}, + { XK_F21, XK_NO_MOD, "\033[20;2~", 0, 0}, + { XK_F22, XK_NO_MOD, "\033[21;2~", 0, 0}, + { XK_F23, XK_NO_MOD, "\033[23;2~", 0, 0}, + { XK_F24, XK_NO_MOD, "\033[24;2~", 0, 0}, + { XK_F25, XK_NO_MOD, "\033[1;5P", 0, 0}, + { XK_F26, XK_NO_MOD, "\033[1;5Q", 0, 0}, + { XK_F27, XK_NO_MOD, "\033[1;5R", 0, 0}, + { XK_F28, XK_NO_MOD, "\033[1;5S", 0, 0}, + { XK_F29, XK_NO_MOD, "\033[15;5~", 0, 0}, + { XK_F30, XK_NO_MOD, "\033[17;5~", 0, 0}, + { XK_F31, XK_NO_MOD, "\033[18;5~", 0, 0}, + { XK_F32, XK_NO_MOD, "\033[19;5~", 0, 0}, + { XK_F33, XK_NO_MOD, "\033[20;5~", 0, 0}, + { XK_F34, XK_NO_MOD, "\033[21;5~", 0, 0}, + { XK_F35, XK_NO_MOD, "\033[23;5~", 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{|}~"; diff --git a/suckless/st/config.h.save.3 b/suckless/st/config.h.save.3 new file mode 100644 index 0000000..e2169a7 --- /dev/null +++ b/suckless/st/config.h.save.3 @@ -0,0 +1,486 @@ +/* See LICENSE file for copyright and license details. */ + +/* + * appearance + * + * font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html + */ +static char *font = "Terminus-9:antialias=true:autohint=true"; +static int borderpx = 2; + +/* + * 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; + +/* default TERM value */ +char *termname = "st-256color"; + +/* + * spaces per tab + * + * When you are changing this value, don't forget to adapt the »it« value in + * the st.info and appropriately install the st.info in the environment where + * you use this st version. + * + * it#$tabspaces, + * + * Secondly make sure your kernel is not expanding tabs. When running `stty + * -a` »tab0« should appear. You can tell the terminal to not expand tabs by + * running following command: + * + * stty tabs + */ +unsigned int tabspaces = 8; + +/* bg opacity */ +float alpha = 0.8; + +/* Background opacity */ +float alpha_def; + +/* Terminal colors (16 first used in escape sequence) */ +static const char *colorname[] = { + + /* 8 normal colors */ + "#333e21", /* black */ + "#757849", /* red */ + "#FF432A", /* green */ + "#c83e72", /* yellow */ + "#448C2C", /* blue */ + "#7d5f5f", /* magenta */ + "#bd8c77", /* cyan */ + "#efdceb", /* white */ + + /* 8 bright colors */ + "#686e50", /* black */ + "#A6AA6A", /* red */ + "#fa6d5a", /* green */ + "#d3658e", /* yellow */ + "#80BD6C", /* blue */ + "#B38887", /* magenta */ + "#f0bfaa", /* cyan */ + "#ffffff", /* white */ + + [255] = 0, + + /* more colors can be added after 255 to use with DefaultXX */ + "gray90", /* default foreground colour */ + "black", /* default background colour */ +}; + + +/* + * Default colors (colorname index) + * foreground, background, cursor, reverse cursor + */ +unsigned int defaultfg = 256; +unsigned int defaultbg = 257; +unsigned int defaultcs = 256; +static unsigned int defaultrcs = 257; + +/* + * Default shape of cursor + * 2: Block ("█") + * 4: Underline ("_") + * 6: Bar ("|") + * 7: Snowman ("☃") + */ +static unsigned int cursorshape = 6; + +/* + * Default columns and rows numbers + */ + +static unsigned int cols = 80; +static unsigned int rows = 24; + +/* + * Default colour and shape of the mouse cursor + */ +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_NO_MOD, Button4, kscrollup, {.i = 1} }, + { XK_NO_MOD, Button5, kscrolldown, {.i = 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~"} }, + { XK_ANY_MOD, Button5, ttysend, {.s = "\005"} }, +}; + +/* Internal keyboard shortcuts. */ +#define MODKEY Mod1Mask +#define TERMMOD (Mod1Mask|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} }, + { ControlMask, XK_equal, zoom, {.f = +1} }, + { ControlMask, XK_minus, zoom, {.f = -1} }, + { TERMMOD, XK_Home, zoomreset, {.f = 0} }, + { MODKEY, XK_c, clipcopy, {.i = 0} }, + { MODKEY, 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_k, kscrollup, {.i = 1} }, + { ShiftMask, XK_j, kscrolldown, {.i = 1} }, + { MODKEY, XK_a, chgalpha, {.f = -1} }, + { MODKEY, XK_s, chgalpha, {.f = +1} }, + { MODKEY, XK_d, chgalpha, {.f = 0} }, +}; + +/* + * 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}, + { XK_F1, XK_NO_MOD, "\033OP" , 0, 0}, + { XK_F1, /* F13 */ ShiftMask, "\033[1;2P", 0, 0}, + { XK_F1, /* F25 */ ControlMask, "\033[1;5P", 0, 0}, + { XK_F1, /* F37 */ Mod4Mask, "\033[1;6P", 0, 0}, + { XK_F1, /* F49 */ Mod1Mask, "\033[1;3P", 0, 0}, + { XK_F1, /* F61 */ Mod3Mask, "\033[1;4P", 0, 0}, + { XK_F2, XK_NO_MOD, "\033OQ" , 0, 0}, + { XK_F2, /* F14 */ ShiftMask, "\033[1;2Q", 0, 0}, + { XK_F2, /* F26 */ ControlMask, "\033[1;5Q", 0, 0}, + { XK_F2, /* F38 */ Mod4Mask, "\033[1;6Q", 0, 0}, + { XK_F2, /* F50 */ Mod1Mask, "\033[1;3Q", 0, 0}, + { XK_F2, /* F62 */ Mod3Mask, "\033[1;4Q", 0, 0}, + { XK_F3, XK_NO_MOD, "\033OR" , 0, 0}, + { XK_F3, /* F15 */ ShiftMask, "\033[1;2R", 0, 0}, + { XK_F3, /* F27 */ ControlMask, "\033[1;5R", 0, 0}, + { XK_F3, /* F39 */ Mod4Mask, "\033[1;6R", 0, 0}, + { XK_F3, /* F51 */ Mod1Mask, "\033[1;3R", 0, 0}, + { XK_F3, /* F63 */ Mod3Mask, "\033[1;4R", 0, 0}, + { XK_F4, XK_NO_MOD, "\033OS" , 0, 0}, + { XK_F4, /* F16 */ ShiftMask, "\033[1;2S", 0, 0}, + { XK_F4, /* F28 */ ControlMask, "\033[1;5S", 0, 0}, + { XK_F4, /* F40 */ Mod4Mask, "\033[1;6S", 0, 0}, + { XK_F4, /* F52 */ Mod1Mask, "\033[1;3S", 0, 0}, + { XK_F5, XK_NO_MOD, "\033[15~", 0, 0}, + { XK_F5, /* F17 */ ShiftMask, "\033[15;2~", 0, 0}, + { XK_F5, /* F29 */ ControlMask, "\033[15;5~", 0, 0}, + { XK_F5, /* F41 */ Mod4Mask, "\033[15;6~", 0, 0}, + { XK_F5, /* F53 */ Mod1Mask, "\033[15;3~", 0, 0}, + { XK_F6, XK_NO_MOD, "\033[17~", 0, 0}, + { XK_F6, /* F18 */ ShiftMask, "\033[17;2~", 0, 0}, + { XK_F6, /* F30 */ ControlMask, "\033[17;5~", 0, 0}, + { XK_F6, /* F42 */ Mod4Mask, "\033[17;6~", 0, 0}, + { XK_F6, /* F54 */ Mod1Mask, "\033[17;3~", 0, 0}, + { XK_F7, XK_NO_MOD, "\033[18~", 0, 0}, + { XK_F7, /* F19 */ ShiftMask, "\033[18;2~", 0, 0}, + { XK_F7, /* F31 */ ControlMask, "\033[18;5~", 0, 0}, + { XK_F7, /* F43 */ Mod4Mask, "\033[18;6~", 0, 0}, + { XK_F7, /* F55 */ Mod1Mask, "\033[18;3~", 0, 0}, + { XK_F8, XK_NO_MOD, "\033[19~", 0, 0}, + { XK_F8, /* F20 */ ShiftMask, "\033[19;2~", 0, 0}, + { XK_F8, /* F32 */ ControlMask, "\033[19;5~", 0, 0}, + { XK_F8, /* F44 */ Mod4Mask, "\033[19;6~", 0, 0}, + { XK_F8, /* F56 */ Mod1Mask, "\033[19;3~", 0, 0}, + { XK_F9, XK_NO_MOD, "\033[20~", 0, 0}, + { XK_F9, /* F21 */ ShiftMask, "\033[20;2~", 0, 0}, + { XK_F9, /* F33 */ ControlMask, "\033[20;5~", 0, 0}, + { XK_F9, /* F45 */ Mod4Mask, "\033[20;6~", 0, 0}, + { XK_F9, /* F57 */ Mod1Mask, "\033[20;3~", 0, 0}, + { XK_F10, XK_NO_MOD, "\033[21~", 0, 0}, + { XK_F10, /* F22 */ ShiftMask, "\033[21;2~", 0, 0}, + { XK_F10, /* F34 */ ControlMask, "\033[21;5~", 0, 0}, + { XK_F10, /* F46 */ Mod4Mask, "\033[21;6~", 0, 0}, + { XK_F10, /* F58 */ Mod1Mask, "\033[21;3~", 0, 0}, + { XK_F11, XK_NO_MOD, "\033[23~", 0, 0}, + { XK_F11, /* F23 */ ShiftMask, "\033[23;2~", 0, 0}, + { XK_F11, /* F35 */ ControlMask, "\033[23;5~", 0, 0}, + { XK_F11, /* F47 */ Mod4Mask, "\033[23;6~", 0, 0}, + { XK_F11, /* F59 */ Mod1Mask, "\033[23;3~", 0, 0}, + { XK_F12, XK_NO_MOD, "\033[24~", 0, 0}, + { XK_F12, /* F24 */ ShiftMask, "\033[24;2~", 0, 0}, + { XK_F12, /* F36 */ ControlMask, "\033[24;5~", 0, 0}, + { XK_F12, /* F48 */ Mod4Mask, "\033[24;6~", 0, 0}, + { XK_F12, /* F60 */ Mod1Mask, "\033[24;3~", 0, 0}, + { XK_F13, XK_NO_MOD, "\033[1;2P", 0, 0}, + { XK_F14, XK_NO_MOD, "\033[1;2Q", 0, 0}, + { XK_F15, XK_NO_MOD, "\033[1;2R", 0, 0}, + { XK_F16, XK_NO_MOD, "\033[1;2S", 0, 0}, + { XK_F17, XK_NO_MOD, "\033[15;2~", 0, 0}, + { XK_F18, XK_NO_MOD, "\033[17;2~", 0, 0}, + { XK_F19, XK_NO_MOD, "\033[18;2~", 0, 0}, + { XK_F20, XK_NO_MOD, "\033[19;2~", 0, 0}, + { XK_F21, XK_NO_MOD, "\033[20;2~", 0, 0}, + { XK_F22, XK_NO_MOD, "\033[21;2~", 0, 0}, + { XK_F23, XK_NO_MOD, "\033[23;2~", 0, 0}, + { XK_F24, XK_NO_MOD, "\033[24;2~", 0, 0}, + { XK_F25, XK_NO_MOD, "\033[1;5P", 0, 0}, + { XK_F26, XK_NO_MOD, "\033[1;5Q", 0, 0}, + { XK_F27, XK_NO_MOD, "\033[1;5R", 0, 0}, + { XK_F28, XK_NO_MOD, "\033[1;5S", 0, 0}, + { XK_F29, XK_NO_MOD, "\033[15;5~", 0, 0}, + { XK_F30, XK_NO_MOD, "\033[17;5~", 0, 0}, + { XK_F31, XK_NO_MOD, "\033[18;5~", 0, 0}, + { XK_F32, XK_NO_MOD, "\033[19;5~", 0, 0}, + { XK_F33, XK_NO_MOD, "\033[20;5~", 0, 0}, + { XK_F34, XK_NO_MOD, "\033[21;5~", 0, 0}, + { XK_F35, XK_NO_MOD, "\033[23;5~", 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{|}~"; diff --git a/.suckless/st/config.mk b/suckless/st/config.mk similarity index 80% rename from .suckless/st/config.mk rename to suckless/st/config.mk index cb2875c..b6458af 100644 --- a/.suckless/st/config.mk +++ b/suckless/st/config.mk @@ -14,14 +14,13 @@ PKG_CONFIG = pkg-config # includes and libs INCS = -I$(X11INC) \ - `$(PKG_CONFIG) --cflags imlib2` \ `$(PKG_CONFIG) --cflags fontconfig` \ - `$(PKG_CONFIG) --cflags freetype2` + `$(PKG_CONFIG) --cflags freetype2` \ + `$(PKG_CONFIG) --cflags harfbuzz` LIBS = -L$(X11LIB) -lm -lrt -lX11 -lutil -lXft -lXrender \ - `$(PKG_CONFIG) --libs imlib2` \ - `$(PKG_CONFIG) --libs zlib` \ `$(PKG_CONFIG) --libs fontconfig` \ - `$(PKG_CONFIG) --libs freetype2` + `$(PKG_CONFIG) --libs freetype2` \ + `$(PKG_CONFIG) --libs harfbuzz` # flags STCPPFLAGS = -DVERSION=\"$(VERSION)\" -D_XOPEN_SOURCE=600 diff --git a/.suckless/st/graphics.c b/suckless/st/graphics.c similarity index 100% rename from .suckless/st/graphics.c rename to suckless/st/graphics.c diff --git a/.suckless/st/graphics.h b/suckless/st/graphics.h similarity index 100% rename from .suckless/st/graphics.h rename to suckless/st/graphics.h diff --git a/suckless/st/hb.c b/suckless/st/hb.c new file mode 100644 index 0000000..2bb334c --- /dev/null +++ b/suckless/st/hb.c @@ -0,0 +1,125 @@ +#include +#include +#include +#include +#include +#include +#include + +#include "st.h" +#include "hb.h" + +#define FEATURE(c1,c2,c3,c4) { .tag = HB_TAG(c1,c2,c3,c4), .value = 1, .start = HB_FEATURE_GLOBAL_START, .end = HB_FEATURE_GLOBAL_END } +#define BUFFER_STEP 256 + +hb_font_t *hbfindfont(XftFont *match); + +typedef struct { + XftFont *match; + hb_font_t *font; +} HbFontMatch; + +typedef struct { + size_t capacity; + HbFontMatch *fonts; +} HbFontCache; + +static HbFontCache hbfontcache = { 0, NULL }; + +typedef struct { + size_t capacity; + Rune *runes; +} RuneBuffer; + +static RuneBuffer hbrunebuffer = { 0, NULL }; + +/* + * Poplulate the array with a list of font features, wrapped in FEATURE macro, + * e. g. + * FEATURE('c', 'a', 'l', 't'), FEATURE('d', 'l', 'i', 'g') + */ +hb_feature_t features[] = {0}; + +void +hbunloadfonts() +{ + for (int i = 0; i < hbfontcache.capacity; i++) { + hb_font_destroy(hbfontcache.fonts[i].font); + XftUnlockFace(hbfontcache.fonts[i].match); + } + + if (hbfontcache.fonts != NULL) { + free(hbfontcache.fonts); + hbfontcache.fonts = NULL; + } + hbfontcache.capacity = 0; +} + +hb_font_t * +hbfindfont(XftFont *match) +{ + for (int i = 0; i < hbfontcache.capacity; i++) { + if (hbfontcache.fonts[i].match == match) + return hbfontcache.fonts[i].font; + } + + /* Font not found in cache, caching it now. */ + hbfontcache.fonts = realloc(hbfontcache.fonts, sizeof(HbFontMatch) * (hbfontcache.capacity + 1)); + FT_Face face = XftLockFace(match); + hb_font_t *font = hb_ft_font_create(face, NULL); + if (font == NULL) + die("Failed to load Harfbuzz font."); + + hbfontcache.fonts[hbfontcache.capacity].match = match; + hbfontcache.fonts[hbfontcache.capacity].font = font; + hbfontcache.capacity += 1; + + return font; +} + +void hbtransform(HbTransformData *data, XftFont *xfont, const Glyph *glyphs, int start, int length) { + ushort mode = USHRT_MAX; + unsigned int glyph_count; + int rune_idx, glyph_idx, end = start + length; + + hb_font_t *font = hbfindfont(xfont); + if (font == NULL) + return; + + hb_buffer_t *buffer = hb_buffer_create(); + hb_buffer_set_direction(buffer, HB_DIRECTION_LTR); + hb_buffer_set_cluster_level(buffer, HB_BUFFER_CLUSTER_LEVEL_MONOTONE_CHARACTERS); + + /* Resize the buffer if required length is larger. */ + if (hbrunebuffer.capacity < length) { + hbrunebuffer.capacity = (length / BUFFER_STEP + 1) * BUFFER_STEP; + hbrunebuffer.runes = realloc(hbrunebuffer.runes, hbrunebuffer.capacity * sizeof(Rune)); + } + + /* Fill buffer with codepoints. */ + for (rune_idx = 0, glyph_idx = start; glyph_idx < end; glyph_idx++, rune_idx++) { + hbrunebuffer.runes[rune_idx] = glyphs[glyph_idx].u; + mode = glyphs[glyph_idx].mode; + if (mode & ATTR_WDUMMY) + hbrunebuffer.runes[rune_idx] = 0x0020; + } + hb_buffer_add_codepoints(buffer, hbrunebuffer.runes, length, 0, length); + + /* Shape the segment. */ + hb_shape(font, buffer, features, sizeof(features)/sizeof(hb_feature_t)); + + /* Get new glyph info. */ + hb_glyph_info_t *info = hb_buffer_get_glyph_infos(buffer, &glyph_count); + hb_glyph_position_t *pos = hb_buffer_get_glyph_positions(buffer, &glyph_count); + + /* Fill the output. */ + data->buffer = buffer; + data->glyphs = info; + data->positions = pos; + data->count = glyph_count; +} + +void hbcleanup(HbTransformData *data) { + hb_buffer_destroy(data->buffer); + memset(data, 0, sizeof(HbTransformData)); +} diff --git a/suckless/st/hb.h b/suckless/st/hb.h new file mode 100644 index 0000000..3b0ef44 --- /dev/null +++ b/suckless/st/hb.h @@ -0,0 +1,14 @@ +#include +#include +#include + +typedef struct { + hb_buffer_t *buffer; + hb_glyph_info_t *glyphs; + hb_glyph_position_t *positions; + unsigned int count; +} HbTransformData; + +void hbunloadfonts(); +void hbtransform(HbTransformData *, XftFont *, const Glyph *, int, int); +void hbcleanup(HbTransformData *); diff --git a/suckless/st/hb.o b/suckless/st/hb.o new file mode 100644 index 0000000..5efaf3e Binary files /dev/null and b/suckless/st/hb.o differ diff --git a/.suckless/st/icat-mini.sh b/suckless/st/icat-mini.sh similarity index 100% rename from .suckless/st/icat-mini.sh rename to suckless/st/icat-mini.sh diff --git a/.suckless/st/khash.h b/suckless/st/khash.h similarity index 100% rename from .suckless/st/khash.h rename to suckless/st/khash.h diff --git a/.suckless/st/kvec.h b/suckless/st/kvec.h similarity index 100% rename from .suckless/st/kvec.h rename to suckless/st/kvec.h diff --git a/.suckless/st/rowcolumn_diacritics_helpers.c b/suckless/st/rowcolumn_diacritics_helpers.c similarity index 100% rename from .suckless/st/rowcolumn_diacritics_helpers.c rename to suckless/st/rowcolumn_diacritics_helpers.c diff --git a/suckless/st/st b/suckless/st/st new file mode 100755 index 0000000..faa4fa6 Binary files /dev/null and b/suckless/st/st differ diff --git a/suckless/st/st-alpha-changealpha-20230519-b44f2ad.diff b/suckless/st/st-alpha-changealpha-20230519-b44f2ad.diff new file mode 100644 index 0000000..9d8bf6e --- /dev/null +++ b/suckless/st/st-alpha-changealpha-20230519-b44f2ad.diff @@ -0,0 +1,194 @@ +diff --git a/st/config.def.h b/st_patched/config.def.h +index 91ab8ca..59fc2a9 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -93,6 +93,10 @@ char *termname = "st-256color"; + */ + unsigned int tabspaces = 8; + ++/* bg opacity */ ++float alpha = 0.8; ++float alpha_def; ++ + /* Terminal colors (16 first used in escape sequence) */ + static const char *colorname[] = { + /* 8 normal colors */ +@@ -201,6 +205,9 @@ static Shortcut shortcuts[] = { + { TERMMOD, XK_Y, selpaste, {.i = 0} }, + { ShiftMask, XK_Insert, selpaste, {.i = 0} }, + { TERMMOD, XK_Num_Lock, numlock, {.i = 0} }, ++ { MODKEY, XK_bracketleft, chgalpha, {.f = -1} }, /* Decrease opacity */ ++ { MODKEY|ShiftMask, XK_braceright, chgalpha, {.f = +1} }, /* Increase opacity */ ++ { MODKEY, XK_bracketright,chgalpha, {.f = 0} }, /* Reset opacity */ + }; + + /* +diff --git a/st/st.h b/st_patched/st.h +index fd3b0d8..cda8c13 100644 +--- a/st.h ++++ b/st.h +@@ -124,3 +124,4 @@ extern unsigned int tabspaces; + extern unsigned int defaultfg; + extern unsigned int defaultbg; + extern unsigned int defaultcs; ++extern float alpha, alpha_def; +diff --git a/st/config.mk b/st_patched/config.mk +index 1e306f8..47c615e 100644 +--- a/config.mk ++++ b/config.mk +@@ -16,7 +16,7 @@ PKG_CONFIG = pkg-config + INCS = -I$(X11INC) \ + `$(PKG_CONFIG) --cflags fontconfig` \ + `$(PKG_CONFIG) --cflags freetype2` +-LIBS = -L$(X11LIB) -lm -lrt -lX11 -lutil -lXft \ ++LIBS = -L$(X11LIB) -lm -lrt -lX11 -lutil -lXft -lXrender\ + `$(PKG_CONFIG) --libs fontconfig` \ + `$(PKG_CONFIG) --libs freetype2` + +diff --git a/st/x.c b/st_patched/x.c +index aa09997..3b05a55 100644 +--- a/x.c ++++ b/x.c +@@ -59,6 +59,7 @@ static void zoom(const Arg *); + static void zoomabs(const Arg *); + static void zoomreset(const Arg *); + static void ttysend(const Arg *); ++static void chgalpha(const Arg *); + + /* config.h for applying patches and the configuration. */ + #include "config.h" +@@ -105,6 +106,7 @@ typedef struct { + XSetWindowAttributes attrs; + int scr; + int isfixed; /* is fixed geometry? */ ++ int depth; /* bit depth */ + int l, t; /* left and top offset */ + int gm; /* geometry mask */ + } XWindow; +@@ -243,6 +245,7 @@ static char *usedfont = NULL; + static double usedfontsize = 0; + static double defaultfontsize = 0; + ++static char *opt_alpha = NULL; + static char *opt_class = NULL; + static char **opt_cmd = NULL; + static char *opt_embed = NULL; +@@ -752,7 +755,7 @@ xresize(int col, int row) + + XFreePixmap(xw.dpy, xw.buf); + xw.buf = XCreatePixmap(xw.dpy, xw.win, win.w, win.h, +- DefaultDepth(xw.dpy, xw.scr)); ++ xw.depth); + XftDrawChange(xw.draw, xw.buf); + xclear(0, 0, win.w, win.h); + +@@ -812,6 +815,13 @@ xloadcols(void) + else + die("could not allocate color %d\n", i); + } ++ ++ /* set alpha value of bg color */ ++ if (opt_alpha) ++ alpha = strtof(opt_alpha, NULL); ++ dc.col[defaultbg].color.alpha = (unsigned short)(0xffff * alpha); ++ dc.col[defaultbg].pixel &= 0x00FFFFFF; ++ dc.col[defaultbg].pixel |= (unsigned char)(0xff * alpha) << 24; + loaded = 1; + } + +@@ -1134,11 +1144,23 @@ xinit(int cols, int rows) + Window parent; + pid_t thispid = getpid(); + XColor xmousefg, xmousebg; ++ XWindowAttributes attr; ++ XVisualInfo vis; + + if (!(xw.dpy = XOpenDisplay(NULL))) + die("can't open display\n"); + xw.scr = XDefaultScreen(xw.dpy); +- xw.vis = XDefaultVisual(xw.dpy, xw.scr); ++ ++ if (!(opt_embed && (parent = strtol(opt_embed, NULL, 0)))) { ++ parent = XRootWindow(xw.dpy, xw.scr); ++ xw.depth = 32; ++ } else { ++ XGetWindowAttributes(xw.dpy, parent, &attr); ++ xw.depth = attr.depth; ++ } ++ ++ XMatchVisualInfo(xw.dpy, xw.scr, xw.depth, TrueColor, &vis); ++ xw.vis = vis.visual; + + /* font */ + if (!FcInit()) +@@ -1147,8 +1169,11 @@ xinit(int cols, int rows) + usedfont = (opt_font == NULL)? font : opt_font; + xloadfonts(usedfont, 0); + ++ /* Backup default alpha value */ ++ alpha_def = alpha; ++ + /* colors */ +- xw.cmap = XDefaultColormap(xw.dpy, xw.scr); ++ xw.cmap = XCreateColormap(xw.dpy, parent, xw.vis, None); + xloadcols(); + + /* adjust fixed window geometry */ +@@ -1168,19 +1193,15 @@ xinit(int cols, int rows) + | ButtonMotionMask | ButtonPressMask | ButtonReleaseMask; + xw.attrs.colormap = xw.cmap; + +- 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, +- win.w, win.h, 0, XDefaultDepth(xw.dpy, xw.scr), InputOutput, ++ win.w, win.h, 0, xw.depth, InputOutput, + xw.vis, CWBackPixel | CWBorderPixel | CWBitGravity + | CWEventMask | CWColormap, &xw.attrs); + + memset(&gcvalues, 0, sizeof(gcvalues)); + gcvalues.graphics_exposures = False; +- dc.gc = XCreateGC(xw.dpy, parent, GCGraphicsExposures, +- &gcvalues); +- xw.buf = XCreatePixmap(xw.dpy, xw.win, win.w, win.h, +- DefaultDepth(xw.dpy, xw.scr)); ++ xw.buf = XCreatePixmap(xw.dpy, xw.win, win.w, win.h, xw.depth); ++ dc.gc = XCreateGC(xw.dpy, xw.buf, GCGraphicsExposures, &gcvalues); + XSetForeground(xw.dpy, dc.gc, dc.col[defaultbg].pixel); + XFillRectangle(xw.dpy, xw.buf, dc.gc, 0, 0, win.w, win.h); + +@@ -1371,6 +1392,24 @@ xmakeglyphfontspecs(XftGlyphFontSpec *specs, const Glyph *glyphs, int len, int x + return numspecs; + } + ++void ++chgalpha(const Arg *arg) ++{ ++ if (arg->f == -1.0f && alpha >= 0.1f) ++ alpha -= 0.1f; ++ else if (arg->f == 1.0f && alpha < 1.0f) ++ alpha += 0.1f; ++ else if (arg->f == 0.0f) ++ alpha = alpha_def; ++ else ++ return; ++ ++ dc.col[defaultbg].color.alpha = (unsigned short)(0xFFFF * alpha); ++ /* Required to remove artifacting from borderpx */ ++ cresize(0, 0); ++ redraw(); ++} ++ + void + xdrawglyphfontspecs(const XftGlyphFontSpec *specs, Glyph base, int len, int x, int y) + { +@@ -2038,6 +2077,9 @@ main(int argc, char *argv[]) + case 'a': + allowaltscreen = 0; + break; ++ case 'A': ++ opt_alpha = EARGF(usage()); ++ break; + case 'c': + opt_class = EARGF(usage()); + break; diff --git a/.suckless/st/st.1 b/suckless/st/st.1 similarity index 98% rename from .suckless/st/st.1 rename to suckless/st/st.1 index 39120b4..ef8c956 100644 --- a/.suckless/st/st.1 +++ b/suckless/st/st.1 @@ -1,6 +1,6 @@ .TH ST 1 st\-VERSION .SH NAME -st \- simple terminal +st \- simple terminal (bread's build) .SH SYNOPSIS .B st .RB [ \-aiv ] diff --git a/.suckless/st/st.c b/suckless/st/st.c similarity index 80% rename from .suckless/st/st.c rename to suckless/st/st.c index f0a70ff..367a3bb 100644 --- a/.suckless/st/st.c +++ b/suckless/st/st.c @@ -19,7 +19,6 @@ #include "st.h" #include "win.h" -#include "graphics.h" #if defined(__linux) #include @@ -36,11 +35,6 @@ #define ESC_ARG_SIZ 16 #define STR_BUF_SIZ ESC_BUF_SIZ #define STR_ARG_SIZ ESC_ARG_SIZ -#define HISTSIZE 2000 - -/* PUA character used as an image placeholder */ -#define IMAGE_PLACEHOLDER_CHAR 0x10EEEE -#define IMAGE_PLACEHOLDER_CHAR_OLD 0xEEEE /* macros */ #define IS_SET(flag) ((term.mode & (flag)) != 0) @@ -48,9 +42,10 @@ #define ISCONTROLC1(c) (BETWEEN(c, 0x80, 0x9f)) #define ISCONTROL(c) (ISCONTROLC0(c) || ISCONTROLC1(c)) #define ISDELIM(u) (u && wcschr(worddelimiters, u)) -#define TLINE(y) ((y) < term.scr ? term.hist[((y) + term.histi - \ - term.scr + HISTSIZE + 1) % HISTSIZE] : \ - term.line[(y) - term.scr]) + +#define TSCREEN term.screen[IS_SET(MODE_ALTSCREEN)] +#define TLINEOFFSET(y) (((y) + TSCREEN.cur - TSCREEN.off + TSCREEN.size) % TSCREEN.size) +#define TLINE(y) (TSCREEN.buffer[TLINEOFFSET(y)]) enum term_mode { MODE_WRAP = 1 << 0, @@ -118,17 +113,21 @@ typedef struct { int alt; } Selection; +/* Screen lines */ +typedef struct { + Line* buffer; /* ring buffer */ + int size; /* size of buffer */ + int cur; /* start of active screen */ + int off; /* scrollback line offset */ + TCursor sc; /* saved cursor */ +} LineBuffer; + /* Internal representation of the screen */ typedef struct { int row; /* nb row */ int col; /* nb col */ - int pixw; /* width of the text area in pixels */ - int pixh; /* height of the text area in pixels */ - Line *line; /* screen */ - Line *alt; /* alternate screen */ - Line hist[HISTSIZE]; /* history buffer */ - int histi; /* history index */ - int scr; /* scroll back */ + LineBuffer screen[2]; /* screen and alternate screen */ + int linelen; /* allocated line length */ int *dirty; /* dirtyness of lines */ TCursor c; /* cursor */ int ocx; /* old cursor col */ @@ -199,8 +198,8 @@ static void tnewline(int); static void tputtab(int); static void tputc(Rune); static void treset(void); -static void tscrollup(int, int, int); -static void tscrolldown(int, int, int); +static void tscrollup(int, int); +static void tscrolldown(int, int); static void tsetattr(const int *, int); static void tsetchar(Rune, const Glyph *, int, int); static void tsetdirt(int, int); @@ -217,6 +216,8 @@ static void tdeftran(char); static void tstrsequence(uchar); static void drawregion(int, int, int, int); +static void clearline(Line, Glyph, int, int); +static Line ensureline(Line); static void selnormalize(void); static void selscroll(int, int); @@ -227,6 +228,7 @@ static Rune utf8decodebyte(char, size_t *); static char utf8encodebyte(Rune, size_t); static size_t utf8validate(Rune *, size_t); +static char *base64dec(const char *); static char base64dec_getc(const char **); static ssize_t xwrite(int, const char *, size_t); @@ -245,10 +247,6 @@ static const uchar utfmask[UTF_SIZ + 1] = {0xC0, 0x80, 0xE0, 0xF0, 0xF8}; static const Rune utfmin[UTF_SIZ + 1] = { 0, 0, 0x80, 0x800, 0x10000}; static const Rune utfmax[UTF_SIZ + 1] = {0x10FFFF, 0x7F, 0x7FF, 0xFFFF, 0x10FFFF}; -/* Converts a diacritic to a row/column/etc number. The result is 1-base, 0 - * means "couldn't convert". Defined in rowcolumn_diacritics_helpers.c */ -uint16_t diacritic_to_num(uint32_t code); - ssize_t xwrite(int fd, const char *s, size_t len) { @@ -425,11 +423,12 @@ int tlinelen(int y) { int i = term.col; + Line line = TLINE(y); - if (TLINE(y)[i - 1].mode & ATTR_WRAP) + if (line[i - 1].mode & ATTR_WRAP) return i; - while (i > 0 && TLINE(y)[i - 1].u == ' ') + while (i > 0 && line[i - 1].u == ' ') --i; return i; @@ -633,12 +632,6 @@ getsel(void) if (gp->mode & ATTR_WDUMMY) continue; - if (gp->mode & ATTR_IMAGE) { - // TODO: Copy diacritics as well - ptr += utf8encode(IMAGE_PLACEHOLDER_CHAR, ptr); - continue; - } - ptr += utf8encode(gp->u, ptr); } @@ -842,11 +835,7 @@ ttyread(void) { static char buf[BUFSIZ]; static int buflen = 0; - static int already_processing = 0; - int ret, written = 0; - - if (buflen >= LEN(buf)) - return 0; + int ret, written; /* append read bytes to unprocessed bytes */ ret = read(cmdfd, buf+buflen, LEN(buf)-buflen); @@ -858,24 +847,7 @@ ttyread(void) die("couldn't read from shell: %s\n", strerror(errno)); default: buflen += ret; - if (already_processing) { - /* Avoid recursive call to twrite() */ - return ret; - } - already_processing = 1; - while (1) { - int buflen_before_processing = buflen; - written += twrite(buf + written, buflen - written, 0); - // If buflen changed during the call to twrite, there is - // new data, and we need to keep processing, otherwise - // we can exit. This will not loop forever because the - // buffer is limited, and we don't clean it in this - // loop, so at some point ttywrite will have to drop - // some data. - if (buflen_before_processing == buflen) - break; - } - already_processing = 0; + written = twrite(buf, buflen, 0); buflen -= written; /* keep any incomplete UTF-8 byte sequence for the next call */ if (buflen > 0) @@ -888,9 +860,6 @@ void ttywrite(const char *s, size_t n, int may_echo) { const char *next; - Arg arg = (Arg) { .i = term.scr }; - - kscrolldown(&arg); if (may_echo && IS_SET(MODE_ECHO)) twrite(s, n, 1); @@ -921,7 +890,6 @@ ttywriteraw(const char *s, size_t n) fd_set wfd, rfd; ssize_t r; size_t lim = 256; - int retries_left = 100; /* * Remember that we are using a pty, which might be a modem line. @@ -930,9 +898,6 @@ ttywriteraw(const char *s, size_t n) * FIXME: Migrate the world to Plan 9. */ while (n > 0) { - if (retries_left-- <= 0) - goto too_many_retries; - FD_ZERO(&wfd); FD_ZERO(&rfd); FD_SET(cmdfd, &wfd); @@ -974,16 +939,11 @@ ttywriteraw(const char *s, size_t n) write_error: die("write error on tty: %s\n", strerror(errno)); -too_many_retries: - fprintf(stderr, "Could not write %zu bytes to tty\n", n); } void ttyresize(int tw, int th) { - term.pixw = tw; - term.pixh = th; - struct winsize w; w.ws_row = term.row; @@ -1005,12 +965,15 @@ int tattrset(int attr) { int i, j; + int y = TLINEOFFSET(0); for (i = 0; i < term.row-1; i++) { + Line line = TSCREEN.buffer[y]; for (j = 0; j < term.col-1; j++) { - if (term.line[i][j].mode & attr) + if (line[j].mode & attr) return 1; } + y = (y+1) % TSCREEN.size; } return 0; @@ -1032,14 +995,17 @@ void tsetdirtattr(int attr) { int i, j; + int y = TLINEOFFSET(0); for (i = 0; i < term.row-1; i++) { + Line line = TSCREEN.buffer[y]; for (j = 0; j < term.col-1; j++) { - if (term.line[i][j].mode & attr) { + if (line[j].mode & attr) { tsetdirt(i, i); break; } } + y = (y+1) % TSCREEN.size; } } @@ -1052,28 +1018,19 @@ tfulldirt(void) void tcursor(int mode) { - static TCursor c[2]; - int alt = IS_SET(MODE_ALTSCREEN); - if (mode == CURSOR_SAVE) { - c[alt] = term.c; + TSCREEN.sc = term.c; } else if (mode == CURSOR_LOAD) { - term.c = c[alt]; - tmoveto(c[alt].x, c[alt].y); + term.c = TSCREEN.sc; + tmoveto(term.c.x, term.c.y); } } void treset(void) { - uint i; - - term.c = (TCursor){{ - .mode = ATTR_NULL, - .fg = defaultfg, - .bg = defaultbg, - .decor = DECOR_DEFAULT_COLOR - }, .x = 0, .y = 0, .state = CURSOR_DEFAULT}; + int i, j; + Glyph g = (Glyph){ .fg = defaultfg, .bg = defaultbg}; memset(term.tabs, 0, term.col * sizeof(*term.tabs)); for (i = tabspaces; i < term.col; i += tabspaces) @@ -1085,19 +1042,37 @@ treset(void) term.charset = 0; for (i = 0; i < 2; i++) { - tmoveto(0, 0); - tcursor(CURSOR_SAVE); - tclearregion(0, 0, term.col-1, term.row-1); - tswapscreen(); + term.screen[i].sc = (TCursor){{ + .fg = defaultfg, + .bg = defaultbg + }}; + term.screen[i].cur = 0; + term.screen[i].off = 0; + for (j = 0; j < term.row; ++j) { + if (term.col != term.linelen) + term.screen[i].buffer[j] = xrealloc(term.screen[i].buffer[j], term.col * sizeof(Glyph)); + clearline(term.screen[i].buffer[j], g, 0, term.col); + } + for (j = term.row; j < term.screen[i].size; ++j) { + free(term.screen[i].buffer[j]); + term.screen[i].buffer[j] = NULL; + } } + tcursor(CURSOR_LOAD); + term.linelen = term.col; + tfulldirt(); } void tnew(int col, int row) { - term = (Term){.c = {.attr = {.fg = defaultfg, - .bg = defaultbg, - .decor = DECOR_DEFAULT_COLOR}}}; + int i; + term = (Term){0}; + term.screen[0].buffer = xmalloc(HISTSIZE * sizeof(Line)); + term.screen[0].size = HISTSIZE; + term.screen[1].buffer = NULL; + for (i = 0; i < HISTSIZE; ++i) term.screen[0].buffer[i] = NULL; + tresize(col, row); treset(); } @@ -1105,104 +1080,108 @@ tnew(int col, int row) void tswapscreen(void) { - Line *tmp = term.line; - - term.line = term.alt; - term.alt = tmp; term.mode ^= MODE_ALTSCREEN; tfulldirt(); } void -kscrolldown(const Arg* a) +kscrollup(const Arg *a) { int n = a->i; - if (n < 0) - n = term.row + n; + if (IS_SET(MODE_ALTSCREEN)) + return; - if (n > term.scr) - n = term.scr; - - if (term.scr > 0) { - term.scr -= n; - selscroll(0, -n); - tfulldirt(); - } + if (n < 0) n = (-n) * term.row; + if (n > TSCREEN.size - term.row - TSCREEN.off) n = TSCREEN.size - term.row - TSCREEN.off; + while (!TLINE(-n)) --n; + TSCREEN.off += n; + selscroll(0, n); + tfulldirt(); } void -kscrollup(const Arg* a) +kscrolldown(const Arg *a) { + int n = a->i; - if (n < 0) - n = term.row + n; + if (IS_SET(MODE_ALTSCREEN)) + return; - if (term.scr <= HISTSIZE-n) { - term.scr += n; - selscroll(0, n); - tfulldirt(); - } + if (n < 0) n = (-n) * term.row; + if (n > TSCREEN.off) n = TSCREEN.off; + TSCREEN.off -= n; + selscroll(0, -n); + tfulldirt(); } void -tscrolldown(int orig, int n, int copyhist) +tscrolldown(int orig, int n) { int i; Line temp; LIMIT(n, 0, term.bot-orig+1); - if (copyhist) { - term.histi = (term.histi - 1 + HISTSIZE) % HISTSIZE; - temp = term.hist[term.histi]; - term.hist[term.histi] = term.line[term.bot]; - term.line[term.bot] = temp; + /* Ensure that lines are allocated */ + for (i = -n; i < 0; i++) { + TLINE(i) = ensureline(TLINE(i)); } - tsetdirt(orig, term.bot-n); - tclearregion(0, term.bot-n+1, term.col-1, term.bot); - - for (i = term.bot; i >= orig+n; i--) { - temp = term.line[i]; - term.line[i] = term.line[i-n]; - term.line[i-n] = temp; + /* Shift non-scrolling areas in ring buffer */ + for (i = term.bot+1; i < term.row; i++) { + temp = TLINE(i); + TLINE(i) = TLINE(i-n); + TLINE(i-n) = temp; + } + for (i = 0; i < orig; i++) { + temp = TLINE(i); + TLINE(i) = TLINE(i-n); + TLINE(i-n) = temp; } - if (term.scr == 0) - selscroll(orig, n); + /* Scroll buffer */ + TSCREEN.cur = (TSCREEN.cur + TSCREEN.size - n) % TSCREEN.size; + /* Clear lines that have entered the view */ + tclearregion(0, orig, term.linelen-1, orig+n-1); + /* Redraw portion of the screen that has scrolled */ + tsetdirt(orig+n-1, term.bot); + selscroll(orig, n); } void -tscrollup(int orig, int n, int copyhist) +tscrollup(int orig, int n) { int i; Line temp; LIMIT(n, 0, term.bot-orig+1); - if (copyhist) { - term.histi = (term.histi + 1) % HISTSIZE; - temp = term.hist[term.histi]; - term.hist[term.histi] = term.line[orig]; - term.line[orig] = temp; + /* Ensure that lines are allocated */ + for (i = term.row; i < term.row + n; i++) { + TLINE(i) = ensureline(TLINE(i)); } - if (term.scr > 0 && term.scr < HISTSIZE) - term.scr = MIN(term.scr + n, HISTSIZE-1); - - tclearregion(0, orig, term.col-1, orig+n-1); - tsetdirt(orig+n, term.bot); - - for (i = orig; i <= term.bot-n; i++) { - temp = term.line[i]; - term.line[i] = term.line[i+n]; - term.line[i+n] = temp; + /* Shift non-scrolling areas in ring buffer */ + for (i = orig-1; i >= 0; i--) { + temp = TLINE(i); + TLINE(i) = TLINE(i+n); + TLINE(i+n) = temp; + } + for (i = term.row-1; i >term.bot; i--) { + temp = TLINE(i); + TLINE(i) = TLINE(i+n); + TLINE(i+n) = temp; } - if (term.scr == 0) - selscroll(orig, -n); + /* Scroll buffer */ + TSCREEN.cur = (TSCREEN.cur + n) % TSCREEN.size; + /* Clear lines that have entered the view */ + tclearregion(0, term.bot-n+1, term.linelen-1, term.bot); + /* Redraw portion of the screen that has scrolled */ + tsetdirt(orig, term.bot-n+1); + selscroll(orig, -n); } void @@ -1231,7 +1210,7 @@ tnewline(int first_col) int y = term.c.y; if (y == term.bot) { - tscrollup(term.top, 1, 1); + tscrollup(term.top, 1); } else { y++; } @@ -1308,6 +1287,7 @@ tsetchar(Rune u, const Glyph *attr, int x, int y) "⎻", "─", "⎼", "⎽", "├", "┤", "┴", "┬", /* p - w */ "│", "≤", "≥", "π", "≠", "£", "·", /* x - ~ */ }; + Line line = TLINE(y); /* * The table is proudly stolen from rxvt. @@ -1316,44 +1296,25 @@ tsetchar(Rune u, const Glyph *attr, int x, int y) BETWEEN(u, 0x41, 0x7e) && vt100_0[u - 0x41]) utf8decode(vt100_0[u - 0x41], &u, UTF_SIZ); - if (term.line[y][x].mode & ATTR_WIDE) { + if (line[x].mode & ATTR_WIDE) { if (x+1 < term.col) { - term.line[y][x+1].u = ' '; - term.line[y][x+1].mode &= ~ATTR_WDUMMY; + line[x+1].u = ' '; + line[x+1].mode &= ~ATTR_WDUMMY; } - } else if (term.line[y][x].mode & ATTR_WDUMMY) { - term.line[y][x-1].u = ' '; - term.line[y][x-1].mode &= ~ATTR_WIDE; - } - - if (u == ' ' && term.line[y][x].mode & ATTR_IMAGE && - tgetisclassicplaceholder(&term.line[y][x])) { - // This is a workaround: don't overwrite classic placement - // placeholders with space symbols (unlike Unicode placeholders - // which must be overwritten by anything). - term.line[y][x].bg = attr->bg; - term.dirty[y] = 1; - return; + } else if (line[x].mode & ATTR_WDUMMY) { + line[x-1].u = ' '; + line[x-1].mode &= ~ATTR_WIDE; } term.dirty[y] = 1; - term.line[y][x] = *attr; - term.line[y][x].u = u; - - if (isboxdraw(u)) - term.line[y][x].mode |= ATTR_BOXDRAW; - - - if (u == IMAGE_PLACEHOLDER_CHAR || u == IMAGE_PLACEHOLDER_CHAR_OLD) { - term.line[y][x].u = 0; - term.line[y][x].mode |= ATTR_IMAGE; - } + line[x] = *attr; + line[x].u = u; } void tclearregion(int x1, int y1, int x2, int y2) { - int x, y, temp; + int x, y, L, S, temp; Glyph *gp; if (x1 > x2) @@ -1361,114 +1322,24 @@ tclearregion(int x1, int y1, int x2, int y2) if (y1 > y2) temp = y1, y1 = y2, y2 = temp; - LIMIT(x1, 0, term.col-1); - LIMIT(x2, 0, term.col-1); + LIMIT(x1, 0, term.linelen-1); + LIMIT(x2, 0, term.linelen-1); LIMIT(y1, 0, term.row-1); LIMIT(y2, 0, term.row-1); + L = TLINEOFFSET(y1); for (y = y1; y <= y2; y++) { term.dirty[y] = 1; for (x = x1; x <= x2; x++) { - gp = &term.line[y][x]; + gp = &TSCREEN.buffer[L][x]; if (selected(x, y)) selclear(); gp->fg = term.c.attr.fg; gp->bg = term.c.attr.bg; - gp->decor = term.c.attr.decor; gp->mode = 0; gp->u = ' '; } - } -} - -/// Fills a rectangle area with an image placeholder. The starting point is the -/// cursor. Adds empty lines if needed. The placeholder will be marked as -/// classic. -void -tcreateimgplaceholder(uint32_t image_id, uint32_t placement_id, - int cols, int rows, char do_not_move_cursor) -{ - for (int row = 0; row < rows; ++row) { - int y = term.c.y; - term.dirty[y] = 1; - for (int col = 0; col < cols; ++col) { - int x = term.c.x + col; - if (x >= term.col) - break; - Glyph *gp = &term.line[y][x]; - if (selected(x, y)) - selclear(); - gp->mode = ATTR_IMAGE; - gp->u = 0; - tsetimgrow(gp, row + 1); - tsetimgcol(gp, col + 1); - tsetimgid(gp, image_id); - tsetimgplacementid(gp, placement_id); - tsetimgdiacriticcount(gp, 3); - tsetisclassicplaceholder(gp, 1); - } - // If moving the cursor is not allowed and this is the last line - // of the terminal, we are done. - if (do_not_move_cursor && y == term.row - 1) - break; - // Move the cursor down, maybe creating a new line. The x is - // preserved (we never change term.c.x in the loop above). - if (row != rows - 1) - tnewline(/*first_col=*/0); - } - if (do_not_move_cursor) { - // Return the cursor to the original position. - tmoveto(term.c.x, term.c.y - rows + 1); - } else { - // Move the cursor beyond the last column, as required by the - // protocol. If the cursor goes beyond the screen edge, insert a - // newline to match the behavior of kitty. - if (term.c.x + cols >= term.col) - tnewline(/*first_col=*/1); - else - tmoveto(term.c.x + cols, term.c.y); - } -} - -void gr_for_each_image_cell(int (*callback)(void *data, uint32_t image_id, - uint32_t placement_id, int col, - int row, char is_classic), - void *data) { - for (int row = 0; row < term.row; ++row) { - for (int col = 0; col < term.col; ++col) { - Glyph *gp = &term.line[row][col]; - if (gp->mode & ATTR_IMAGE) { - uint32_t image_id = tgetimgid(gp); - uint32_t placement_id = tgetimgplacementid(gp); - int ret = - callback(data, tgetimgid(gp), - tgetimgplacementid(gp), - tgetimgcol(gp), tgetimgrow(gp), - tgetisclassicplaceholder(gp)); - if (ret == 1) { - term.dirty[row] = 1; - gp->mode = 0; - gp->u = ' '; - } - } - } - } -} - -void gr_schedule_image_redraw_by_id(uint32_t image_id) { - for (int row = 0; row < term.row; ++row) { - if (term.dirty[row]) - continue; - for (int col = 0; col < term.col; ++col) { - Glyph *gp = &term.line[row][col]; - if (gp->mode & ATTR_IMAGE) { - uint32_t cell_image_id = tgetimgid(gp); - if (cell_image_id == image_id) { - term.dirty[row] = 1; - break; - } - } - } + L = (L + 1) % TSCREEN.size; } } @@ -1483,7 +1354,7 @@ tdeletechar(int n) dst = term.c.x; src = term.c.x + n; size = term.col - src; - line = term.line[term.c.y]; + line = TLINE(term.c.y); memmove(&line[dst], &line[src], size * sizeof(Glyph)); tclearregion(term.col-n, term.c.y, term.col-1, term.c.y); @@ -1500,7 +1371,7 @@ tinsertblank(int n) dst = term.c.x + n; src = term.c.x; size = term.col - dst; - line = term.line[term.c.y]; + line = TLINE(term.c.y); memmove(&line[dst], &line[src], size * sizeof(Glyph)); tclearregion(src, term.c.y, dst - 1, term.c.y); @@ -1510,14 +1381,14 @@ void tinsertblankline(int n) { if (BETWEEN(term.c.y, term.top, term.bot)) - tscrolldown(term.c.y, n, 0); + tscrolldown(term.c.y, n); } void tdeleteline(int n) { if (BETWEEN(term.c.y, term.top, term.bot)) - tscrollup(term.c.y, n, 0); + tscrollup(term.c.y, n); } int32_t @@ -1590,7 +1461,6 @@ tsetattr(const int *attr, int l) ATTR_STRUCK ); term.c.attr.fg = defaultfg; term.c.attr.bg = defaultbg; - term.c.attr.decor = DECOR_DEFAULT_COLOR; break; case 1: term.c.attr.mode |= ATTR_BOLD; @@ -1603,20 +1473,6 @@ tsetattr(const int *attr, int l) break; case 4: term.c.attr.mode |= ATTR_UNDERLINE; - if (i + 1 < l) { - idx = attr[++i]; - if (BETWEEN(idx, 1, 5)) { - tsetdecorstyle(&term.c.attr, idx); - } else if (idx == 0) { - term.c.attr.mode &= ~ATTR_UNDERLINE; - tsetdecorstyle(&term.c.attr, 0); - } else { - fprintf(stderr, - "erresc: unknown underline " - "style %d\n", - idx); - } - } break; case 5: /* slow blink */ /* FALLTHROUGH */ @@ -1640,7 +1496,6 @@ tsetattr(const int *attr, int l) break; case 24: term.c.attr.mode &= ~ATTR_UNDERLINE; - tsetdecorstyle(&term.c.attr, 0); break; case 25: term.c.attr.mode &= ~ATTR_BLINK; @@ -1668,13 +1523,6 @@ tsetattr(const int *attr, int l) case 49: term.c.attr.bg = defaultbg; break; - case 58: - if ((idx = tdefcolor(attr, &i, l)) >= 0) - tsetdecorcolor(&term.c.attr, idx); - break; - case 59: - tsetdecorcolor(&term.c.attr, DECOR_DEFAULT_COLOR); - break; default: if (BETWEEN(attr[i], 30, 37)) { term.c.attr.fg = attr[i] - 30; @@ -1978,11 +1826,11 @@ csihandle(void) case 'S': /* SU -- Scroll line up */ if (csiescseq.priv) break; DEFAULT(csiescseq.arg[0], 1); - tscrollup(term.top, csiescseq.arg[0], 0); + tscrollup(term.top, csiescseq.arg[0]); break; case 'T': /* SD -- Scroll line down */ DEFAULT(csiescseq.arg[0], 1); - tscrolldown(term.top, csiescseq.arg[0], 0); + tscrolldown(term.top, csiescseq.arg[0]); break; case 'L': /* IL -- Insert blank lines */ DEFAULT(csiescseq.arg[0], 1); @@ -2058,39 +1906,6 @@ csihandle(void) goto unknown; } break; - case '>': - switch (csiescseq.mode[1]) { - case 'q': /* XTVERSION -- Print terminal name and version */ - len = snprintf(buf, sizeof(buf), - "\033P>|st-graphics(%s)\033\\", VERSION); - ttywrite(buf, len, 0); - break; - default: - goto unknown; - } - break; - case 't': /* XTWINOPS -- Window manipulation */ - switch (csiescseq.arg[0]) { - case 14: /* Report text area size in pixels. */ - len = snprintf(buf, sizeof(buf), "\033[4;%i;%it", - term.pixh, term.pixw); - ttywrite(buf, len, 0); - break; - case 16: /* Report character cell size in pixels. */ - len = snprintf(buf, sizeof(buf), "\033[6;%i;%it", - term.pixh / term.row, - term.pixw / term.col); - ttywrite(buf, len, 0); - break; - case 18: /* Report the size of the text area in characters. */ - len = snprintf(buf, sizeof(buf), "\033[8;%i;%it", - term.row, term.col); - ttywrite(buf, len, 0); - break; - default: - goto unknown; - } - break; } } @@ -2240,26 +2055,8 @@ strhandle(void) case 'k': /* old title set compatibility */ xsettitle(strescseq.args[0]); return; - case '_': /* APC -- Application Program Command */ - if (gr_parse_command(strescseq.buf, strescseq.len)) { - GraphicsCommandResult *res = &graphics_command_result; - if (res->create_placeholder) { - tcreateimgplaceholder( - res->placeholder.image_id, - res->placeholder.placement_id, - res->placeholder.columns, - res->placeholder.rows, - res->placeholder.do_not_move_cursor); - } - if (res->response[0]) - ttywrite(res->response, strlen(res->response), - 0); - if (res->redraw) - tfulldirt(); - return; - } - return; case 'P': /* DCS -- Device Control String */ + case '_': /* APC -- Application Program Command */ case '^': /* PM -- Privacy Message */ return; } @@ -2378,7 +2175,7 @@ tdumpline(int n) char buf[UTF_SIZ]; const Glyph *bp, *end; - bp = &term.line[n][0]; + bp = &TLINE(n)[0]; end = &bp[MIN(tlinelen(n), term.col) - 1]; if (bp != end || bp->u != ' ') { for ( ; bp <= end; ++bp) @@ -2605,7 +2402,7 @@ eschandle(uchar ascii) return 0; case 'D': /* IND -- Linefeed */ if (term.c.y == term.bot) { - tscrollup(term.top, 1, 1); + tscrollup(term.top, 1); } else { tmoveto(term.c.x, term.c.y+1); } @@ -2618,7 +2415,7 @@ eschandle(uchar ascii) break; case 'M': /* RI -- Reverse index */ if (term.c.y == term.top) { - tscrolldown(term.top, 1, 1); + tscrolldown(term.top, 1); } else { tmoveto(term.c.x, term.c.y-1); } @@ -2765,38 +2562,11 @@ check_control_code: if (selected(term.c.x, term.c.y)) selclear(); - if (width == 0) { - // It's probably a combining char. Combining characters are not - // supported, so we just ignore them, unless it denotes the row and - // column of an image character. - if (term.c.y <= 0 && term.c.x <= 0) - return; - else if (term.c.x == 0) - gp = &term.line[term.c.y-1][term.col-1]; - else if (term.c.state & CURSOR_WRAPNEXT) - gp = &term.line[term.c.y][term.c.x]; - else - gp = &term.line[term.c.y][term.c.x-1]; - uint16_t num = diacritic_to_num(u); - if (num && (gp->mode & ATTR_IMAGE)) { - unsigned diaccount = tgetimgdiacriticcount(gp); - if (diaccount == 0) - tsetimgrow(gp, num); - else if (diaccount == 1) - tsetimgcol(gp, num); - else if (diaccount == 2) - tsetimg4thbyteplus1(gp, num); - tsetimgdiacriticcount(gp, diaccount + 1); - } - term.lastc = u; - return; - } - - gp = &term.line[term.c.y][term.c.x]; + gp = &TLINE(term.c.y)[term.c.x]; if (IS_SET(MODE_WRAP) && (term.c.state & CURSOR_WRAPNEXT)) { gp->mode |= ATTR_WRAP; tnewline(1); - gp = &term.line[term.c.y][term.c.x]; + gp = &TLINE(term.c.y)[term.c.x]; } if (IS_SET(MODE_INSERT) && term.c.x+width < term.col) { @@ -2809,7 +2579,7 @@ check_control_code: tnewline(1); else tmoveto(term.col - width, term.c.y); - gp = &term.line[term.c.y][term.c.x]; + gp = &TLINE(term.c.y)[term.c.x]; } tsetchar(u, &term.c.attr, term.c.x, term.c.y); @@ -2840,6 +2610,11 @@ twrite(const char *buf, int buflen, int show_ctrl) Rune u; int n; + if (TSCREEN.off) { + TSCREEN.off = 0; + tfulldirt(); + } + for (n = 0; n < buflen; n += charsize) { if (IS_SET(MODE_UTF8)) { /* process a complete utf8 char */ @@ -2865,65 +2640,86 @@ twrite(const char *buf, int buflen, int show_ctrl) return n; } +void +clearline(Line line, Glyph g, int x, int xend) +{ + int i; + g.mode = 0; + g.u = ' '; + for (i = x; i < xend; ++i) { + line[i] = g; + } +} + +Line +ensureline(Line line) +{ + if (!line) { + line = xmalloc(term.linelen * sizeof(Glyph)); + } + return line; +} + void tresize(int col, int row) { int i, j; int minrow = MIN(row, term.row); int mincol = MIN(col, term.col); + int linelen = MAX(col, term.linelen); int *bp; - TCursor c; - if (col < 1 || row < 1) { + if (col < 1 || row < 1 || row > HISTSIZE) { fprintf(stderr, "tresize: error resizing to %dx%d\n", col, row); return; } - /* - * slide screen to keep cursor where we expect it - - * tscrollup would work here, but we can optimize to - * memmove because we're freeing the earlier lines - */ - for (i = 0; i <= term.c.y - row; i++) { - free(term.line[i]); - free(term.alt[i]); + /* Shift buffer to keep the cursor where we expect it */ + if (row <= term.c.y) { + term.screen[0].cur = (term.screen[0].cur - row + term.c.y + 1) % term.screen[0].size; } - /* ensure that both src and dst are not NULL */ - if (i > 0) { - memmove(term.line, term.line + i, row * sizeof(Line)); - memmove(term.alt, term.alt + i, row * sizeof(Line)); + + /* Resize and clear line buffers as needed */ + if (linelen > term.linelen) { + for (i = 0; i < term.screen[0].size; ++i) { + if (term.screen[0].buffer[i]) { + term.screen[0].buffer[i] = xrealloc(term.screen[0].buffer[i], linelen * sizeof(Glyph)); + clearline(term.screen[0].buffer[i], term.c.attr, term.linelen, linelen); + } + } + for (i = 0; i < minrow; ++i) { + term.screen[1].buffer[i] = xrealloc(term.screen[1].buffer[i], linelen * sizeof(Glyph)); + clearline(term.screen[1].buffer[i], term.c.attr, term.linelen, linelen); + } } - for (i += row; i < term.row; i++) { - free(term.line[i]); - free(term.alt[i]); + /* Allocate all visible lines for regular line buffer */ + for (j = term.screen[0].cur, i = 0; i < row; ++i, j = (j + 1) % term.screen[0].size) + { + if (!term.screen[0].buffer[j]) { + term.screen[0].buffer[j] = xmalloc(linelen * sizeof(Glyph)); + } + if (i >= term.row) { + clearline(term.screen[0].buffer[j], term.c.attr, 0, linelen); + } + } + /* Resize alt screen */ + term.screen[1].cur = 0; + term.screen[1].size = row; + for (i = row; i < term.row; ++i) { + free(term.screen[1].buffer[i]); + } + term.screen[1].buffer = xrealloc(term.screen[1].buffer, row * sizeof(Line)); + for (i = term.row; i < row; ++i) { + term.screen[1].buffer[i] = xmalloc(linelen * sizeof(Glyph)); + clearline(term.screen[1].buffer[i], term.c.attr, 0, linelen); } /* resize to new height */ - term.line = xrealloc(term.line, row * sizeof(Line)); - term.alt = xrealloc(term.alt, row * sizeof(Line)); term.dirty = xrealloc(term.dirty, row * sizeof(*term.dirty)); term.tabs = xrealloc(term.tabs, col * sizeof(*term.tabs)); - for (i = 0; i < HISTSIZE; i++) { - term.hist[i] = xrealloc(term.hist[i], col * sizeof(Glyph)); - for (j = mincol; j < col; j++) { - term.hist[i][j] = term.c.attr; - term.hist[i][j].u = ' '; - } - } - - /* resize each row to new width, zero-pad if needed */ - for (i = 0; i < minrow; i++) { - term.line[i] = xrealloc(term.line[i], col * sizeof(Glyph)); - term.alt[i] = xrealloc(term.alt[i], col * sizeof(Glyph)); - } - - /* allocate any new rows */ - for (/* i = minrow */; i < row; i++) { - term.line[i] = xmalloc(col * sizeof(Glyph)); - term.alt[i] = xmalloc(col * sizeof(Glyph)); - } + /* fix tabstops */ if (col > term.col) { bp = term.tabs + term.col; @@ -2933,26 +2729,16 @@ tresize(int col, int row) for (bp += tabspaces; bp < term.tabs + col; bp += tabspaces) *bp = 1; } + /* update terminal size */ term.col = col; term.row = row; + term.linelen = linelen; /* reset scrolling region */ tsetscroll(0, row-1); /* make use of the LIMIT in tmoveto */ tmoveto(term.c.x, term.c.y); - /* Clearing both screens (it makes dirty all lines) */ - c = term.c; - for (i = 0; i < 2; i++) { - if (mincol < col && 0 < minrow) { - tclearregion(mincol, 0, col - 1, minrow - 1); - } - if (0 < col && minrow < row) { - tclearregion(0, minrow, col - 1, row - 1); - } - tswapscreen(); - tcursor(CURSOR_LOAD); - } - term.c = c; + tfulldirt(); } void @@ -2964,19 +2750,16 @@ resettitle(void) void drawregion(int x1, int y1, int x2, int y2) { - int y; - - xstartimagedraw(term.dirty, term.row); + int y, L; + L = TLINEOFFSET(y1); for (y = y1; y < y2; y++) { - if (!term.dirty[y]) - continue; - - term.dirty[y] = 0; - xdrawline(TLINE(y), x1, y, x2); + if (term.dirty[y]) { + term.dirty[y] = 0; + xdrawline(TSCREEN.buffer[L], x1, y, x2); + } + L = (L + 1) % TSCREEN.size; } - - xfinishimagedraw(); } void @@ -2990,15 +2773,17 @@ draw(void) /* adjust cursor position */ LIMIT(term.ocx, 0, term.col-1); LIMIT(term.ocy, 0, term.row-1); - if (term.line[term.ocy][term.ocx].mode & ATTR_WDUMMY) + if (TLINE(term.ocy)[term.ocx].mode & ATTR_WDUMMY) term.ocx--; - if (term.line[term.c.y][cx].mode & ATTR_WDUMMY) + if (TLINE(term.c.y)[cx].mode & ATTR_WDUMMY) cx--; drawregion(0, 0, term.col, term.row); - if (term.scr == 0) - xdrawcursor(cx, term.c.y, term.line[term.c.y][cx], - term.ocx, term.ocy, term.line[term.ocy][term.ocx]); + if (TSCREEN.off == 0) + xdrawcursor(cx, term.c.y, TLINE(term.c.y)[cx], + term.ocx, term.ocy, TLINE(term.ocy)[term.ocx], + TLINE(term.ocy), term.col); + term.ocx = cx; term.ocy = term.c.y; xfinishdraw(); @@ -3012,9 +2797,3 @@ redraw(void) tfulldirt(); draw(); } - -Glyph -getglyphat(int col, int row) -{ - return term.line[row][col]; -} diff --git a/suckless/st/st.h b/suckless/st/st.h new file mode 100644 index 0000000..4649646 --- /dev/null +++ b/suckless/st/st.h @@ -0,0 +1,130 @@ +/* See LICENSE for license details. */ + +#include +#include + +/* macros */ +#define MIN(a, b) ((a) < (b) ? (a) : (b)) +#define MAX(a, b) ((a) < (b) ? (b) : (a)) +#define LEN(a) (sizeof(a) / sizeof(a)[0]) +#define BETWEEN(x, a, b) ((a) <= (x) && (x) <= (b)) +#define DIVCEIL(n, d) (((n) + ((d) - 1)) / (d)) +#define DEFAULT(a, b) (a) = (a) ? (a) : (b) +#define LIMIT(x, a, b) (x) = (x) < (a) ? (a) : (x) > (b) ? (b) : (x) +#define ATTRCMP(a, b) (((a).mode & (~ATTR_WRAP)) != ((b).mode & (~ATTR_WRAP)) || \ + (a).fg != (b).fg || \ + (a).bg != (b).bg) +#define TIMEDIFF(t1, t2) ((t1.tv_sec-t2.tv_sec)*1000 + \ + (t1.tv_nsec-t2.tv_nsec)/1E6) +#define MODBIT(x, set, bit) ((set) ? ((x) |= (bit)) : ((x) &= ~(bit))) + +#define TRUECOLOR(r,g,b) (1 << 24 | (r) << 16 | (g) << 8 | (b)) +#define IS_TRUECOL(x) (1 << 24 & (x)) +#define HISTSIZE 2000 + +enum glyph_attribute { + ATTR_NULL = 0, + ATTR_BOLD = 1 << 0, + ATTR_FAINT = 1 << 1, + ATTR_ITALIC = 1 << 2, + ATTR_UNDERLINE = 1 << 3, + ATTR_BLINK = 1 << 4, + ATTR_REVERSE = 1 << 5, + ATTR_INVISIBLE = 1 << 6, + ATTR_STRUCK = 1 << 7, + ATTR_WRAP = 1 << 8, + ATTR_WIDE = 1 << 9, + ATTR_WDUMMY = 1 << 10, + ATTR_BOLD_FAINT = ATTR_BOLD | ATTR_FAINT, +}; + +enum selection_mode { + SEL_IDLE = 0, + SEL_EMPTY = 1, + SEL_READY = 2 +}; + +enum selection_type { + SEL_REGULAR = 1, + SEL_RECTANGULAR = 2 +}; + +enum selection_snap { + SNAP_WORD = 1, + SNAP_LINE = 2 +}; + +typedef unsigned char uchar; +typedef unsigned int uint; +typedef unsigned long ulong; +typedef unsigned short ushort; + +typedef uint_least32_t Rune; + +#define Glyph Glyph_ +typedef struct { + Rune u; /* character code */ + ushort mode; /* attribute flags */ + uint32_t fg; /* foreground */ + uint32_t bg; /* background */ +} Glyph; + +typedef Glyph *Line; + +typedef union { + int i; + uint ui; + float f; + const void *v; + const char *s; +} Arg; + +void die(const char *, ...); +void redraw(void); +void draw(void); + +void printscreen(const Arg *); +void printsel(const Arg *); +void sendbreak(const Arg *); +void toggleprinter(const Arg *); + +int tattrset(int); +void tnew(int, int); +void tresize(int, int); +void tsetdirtattr(int); +void ttyhangup(void); +int ttynew(const char *, char *, const char *, char **); +size_t ttyread(void); +void ttyresize(int, int); +void ttywrite(const char *, size_t, int); + +void resettitle(void); + +void selclear(void); +void selinit(void); +void selstart(int, int, int); +void selextend(int, int, int, int); +int selected(int, int); +char *getsel(void); + +size_t utf8encode(Rune, char *); + +void *xmalloc(size_t); +void *xrealloc(void *, size_t); +char *xstrdup(const char *); + +/* config.h globals */ +extern char *utmp; +extern char *scroll; +extern char *stty_args; +extern char *vtiden; +extern wchar_t *worddelimiters; +extern int allowaltscreen; +extern int allowwindowops; +extern char *termname; +extern unsigned int tabspaces; +extern unsigned int defaultfg; +extern unsigned int defaultbg; +extern unsigned int defaultcs; +extern float alpha; +extern float alpha_def; diff --git a/.suckless/st/st.info b/suckless/st/st.info similarity index 96% rename from .suckless/st/st.info rename to suckless/st/st.info index ded76c1..efab2cf 100644 --- a/.suckless/st/st.info +++ b/suckless/st/st.info @@ -195,7 +195,6 @@ st-mono| simpleterm monocolor, Ms=\E]52;%p1%s;%p2%s\007, Se=\E[2 q, Ss=\E[%p1%d q, - Smulx=\E[4:%p1%dm, st| simpleterm, use=st-mono, @@ -216,11 +215,6 @@ st-256color| simpleterm with 256 colors, initc=\E]4;%p1%d;rgb\:%p2%{255}%*%{1000}%/%2.2X/%p3%{255}%*%{1000}%/%2.2X/%p4%{255}%*%{1000}%/%2.2X\E\\, setab=\E[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m, setaf=\E[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m, -# Underline colors - Su, - Setulc=\E[58:2:%p1%{65536}%/%d:%p1%{256}%/%{255}%&%d:%p1%{255}%&%d%;m, - Setulc1=\E[58:5:%p1%dm, - ol=\E[59m, st-meta| simpleterm with meta key, use=st, diff --git a/suckless/st/st.o b/suckless/st/st.o new file mode 100644 index 0000000..6f4b43b Binary files /dev/null and b/suckless/st/st.o differ diff --git a/.suckless/st/win.h b/suckless/st/win.h similarity index 90% rename from .suckless/st/win.h rename to suckless/st/win.h index 31b3fff..94679e4 100644 --- a/.suckless/st/win.h +++ b/suckless/st/win.h @@ -25,7 +25,7 @@ enum win_mode { void xbell(void); void xclipcopy(void); -void xdrawcursor(int, int, Glyph, int, int, Glyph); +void xdrawcursor(int, int, Glyph, int, int, Glyph, Line, int); void xdrawline(Line, int, int, int); void xfinishdraw(void); void xloadcols(void); @@ -39,6 +39,3 @@ void xsetpointermotion(int); void xsetsel(char *); int xstartdraw(void); void xximspot(int, int); - -void xstartimagedraw(int *dirty, int rows); -void xfinishimagedraw(); diff --git a/.suckless/st/x.c b/suckless/st/x.c similarity index 71% rename from .suckless/st/x.c rename to suckless/st/x.c index 0e1e731..0cb35e8 100644 --- a/.suckless/st/x.c +++ b/suckless/st/x.c @@ -4,8 +4,6 @@ #include #include #include -#include -#include #include #include #include @@ -16,12 +14,13 @@ #include #include #include +#include char *argv0; #include "arg.h" #include "st.h" #include "win.h" -#include "graphics.h" +#include "hb.h" /* types used in config.h */ typedef struct { @@ -62,12 +61,9 @@ static void zoom(const Arg *); static void zoomabs(const Arg *); static void zoomreset(const Arg *); static void ttysend(const Arg *); -static void previewimage(const Arg *); -static void showimageinfo(const Arg *); -static void togglegrdebug(const Arg *); -static void dumpgrstate(const Arg *); -static void unloadimages(const Arg *); -static void toggleimages(const Arg *); +static void chgalpha(const Arg *); +void kscrollup(const Arg *); +void kscrolldown(const Arg *); /* config.h for applying patches and the configuration. */ #include "config.h" @@ -90,7 +86,6 @@ typedef XftGlyphFontSpec GlyphFontSpec; typedef struct { int tw, th; /* tty width and height */ int w, h; /* window width and height */ - int hborderpx, vborderpx; int ch; /* char height */ int cw; /* char width */ int mode; /* window state/mode flags */ @@ -115,6 +110,7 @@ typedef struct { XSetWindowAttributes attrs; int scr; int isfixed; /* is fixed geometry? */ + int depth; /* bit depth */ int l, t; /* left and top offset */ int gm; /* geometry mask */ } XWindow; @@ -151,11 +147,10 @@ typedef struct { } DC; static inline ushort sixd_to_16bit(int); +static void xresetfontsettings(ushort mode, Font **font, int *frcflags); static int xmakeglyphfontspecs(XftGlyphFontSpec *, const Glyph *, int, int, int); -static void xdrawglyphfontspecs(const XftGlyphFontSpec *, Glyph, int, int, int); +static void xdrawglyphfontspecs(const XftGlyphFontSpec *, Glyph, int, int, int, int); static void xdrawglyph(Glyph, int, int); -static void xdrawimages(Glyph, Line, int x1, int y1, int x2); -static void xdrawoneimagecell(Glyph, int x, int y); static void xclear(int, int, int, int); static int xgeommasktogravity(int); static int ximopen(Display *); @@ -232,7 +227,6 @@ static DC dc; static XWindow xw; static XSelection xsel; static TermWindow win; -static unsigned int mouse_col = 0, mouse_row = 0; /* Font Ring Cache */ enum { @@ -256,6 +250,7 @@ static char *usedfont = NULL; static double usedfontsize = 0; static double defaultfontsize = 0; +static char *opt_alpha = NULL; static char *opt_class = NULL; static char **opt_cmd = NULL; static char *opt_embed = NULL; @@ -341,72 +336,10 @@ ttysend(const Arg *arg) ttywrite(arg->s, strlen(arg->s), 1); } -void -previewimage(const Arg *arg) -{ - Glyph g = getglyphat(mouse_col, mouse_row); - if (g.mode & ATTR_IMAGE) { - uint32_t image_id = tgetimgid(&g); - fprintf(stderr, "Clicked on placeholder %u/%u, x=%d, y=%d\n", - image_id, tgetimgplacementid(&g), tgetimgcol(&g), - tgetimgrow(&g)); - gr_preview_image(image_id, arg->s); - } -} - -void -showimageinfo(const Arg *arg) -{ - Glyph g = getglyphat(mouse_col, mouse_row); - if (g.mode & ATTR_IMAGE) { - uint32_t image_id = tgetimgid(&g); - fprintf(stderr, "Clicked on placeholder %u/%u, x=%d, y=%d\n", - image_id, tgetimgplacementid(&g), tgetimgcol(&g), - tgetimgrow(&g)); - char stcommand[256] = {0}; - size_t len = snprintf(stcommand, sizeof(stcommand), "%s -e less", argv0); - if (len > sizeof(stcommand) - 1) { - fprintf(stderr, "Executable name too long: %s\n", - argv0); - return; - } - gr_show_image_info(image_id, tgetimgplacementid(&g), - tgetimgcol(&g), tgetimgrow(&g), - tgetisclassicplaceholder(&g), - tgetimgdiacriticcount(&g), argv0); - } -} - -void -togglegrdebug(const Arg *arg) -{ - graphics_debug_mode = (graphics_debug_mode + 1) % 3; - redraw(); -} - -void -dumpgrstate(const Arg *arg) -{ - gr_dump_state(); -} - -void -unloadimages(const Arg *arg) -{ - gr_unload_images_to_reduce_ram(); -} - -void -toggleimages(const Arg *arg) -{ - graphics_display_images = !graphics_display_images; - redraw(); -} - int evcol(XEvent *e) { - int x = e->xbutton.x - win.hborderpx; + int x = e->xbutton.x - borderpx; LIMIT(x, 0, win.tw - 1); return x / win.cw; } @@ -414,7 +347,7 @@ evcol(XEvent *e) int evrow(XEvent *e) { - int y = e->xbutton.y - win.vborderpx; + int y = e->xbutton.y - borderpx; LIMIT(y, 0, win.th - 1); return y / win.ch; } @@ -527,9 +460,6 @@ mouseaction(XEvent *e, uint release) /* ignore Buttonmask for Button - it's set on release */ uint state = e->xbutton.state & ~buttonmask(e->xbutton.button); - mouse_col = evcol(e); - mouse_row = evrow(e); - for (ms = mshortcuts; ms < mshortcuts + LEN(mshortcuts); ms++) { if (ms->release == release && ms->button == e->xbutton.button && @@ -817,9 +747,6 @@ cresize(int width, int height) col = MAX(1, col); row = MAX(1, row); - win.hborderpx = (win.w - col * win.cw) * anysize_halign / 100; - win.vborderpx = (win.h - row * win.ch) * anysize_valign / 100; - tresize(col, row); xresize(col, row); ttyresize(win.tw, win.th); @@ -833,12 +760,12 @@ xresize(int col, int row) XFreePixmap(xw.dpy, xw.buf); xw.buf = XCreatePixmap(xw.dpy, xw.win, win.w, win.h, - DefaultDepth(xw.dpy, xw.scr)); + xw.depth); XftDrawChange(xw.draw, xw.buf); xclear(0, 0, win.w, win.h); /* resize to new width */ - xw.specbuf = xrealloc(xw.specbuf, col * sizeof(GlyphFontSpec)); + xw.specbuf = xrealloc(xw.specbuf, col * sizeof(GlyphFontSpec) * 4); } ushort @@ -893,6 +820,13 @@ xloadcols(void) else die("could not allocate color %d\n", i); } + + /* set alpha value of bg color */ + if (opt_alpha) + alpha = strtof(opt_alpha, NULL); + dc.col[defaultbg].color.alpha = (unsigned short)(0xffff * alpha); + dc.col[defaultbg].pixel &= 0x00FFFFFF; + dc.col[defaultbg].pixel |= (unsigned char)(0xff * alpha) << 24; loaded = 1; } @@ -950,8 +884,8 @@ xhints(void) sizeh->flags = PSize | PResizeInc | PBaseSize | PMinSize; sizeh->height = win.h; sizeh->width = win.w; - sizeh->height_inc = 1; - sizeh->width_inc = 1; + sizeh->height_inc = win.ch; + sizeh->width_inc = win.cw; sizeh->base_height = 2 * borderpx; sizeh->base_width = 2 * borderpx; sizeh->min_height = win.ch + 2 * borderpx; @@ -1095,8 +1029,7 @@ xloadfonts(const char *fontstr, double fontsize) FcPatternAddDouble(pattern, FC_PIXEL_SIZE, 12); usedfontsize = 12; } - if (defaultfontsize <= 0) - defaultfontsize = usedfontsize; + defaultfontsize = usedfontsize; } if (xloadfont(&dc.font, pattern)) @@ -1106,7 +1039,7 @@ xloadfonts(const char *fontstr, double fontsize) FcPatternGetDouble(dc.font.match->pattern, FC_PIXEL_SIZE, 0, &fontval); usedfontsize = fontval; - if (defaultfontsize <= 0 && fontsize == 0) + if (fontsize == 0) defaultfontsize = fontval; } @@ -1144,6 +1077,9 @@ xunloadfont(Font *f) void xunloadfonts(void) { + /* Clear Harfbuzz font cache. */ + hbunloadfonts(); + /* Free the loaded fonts in the font cache. */ while (frclen > 0) XftFontClose(xw.dpy, frc[--frclen].font); @@ -1216,11 +1152,23 @@ xinit(int cols, int rows) Window parent, root; pid_t thispid = getpid(); XColor xmousefg, xmousebg; + XWindowAttributes attr; + XVisualInfo vis; if (!(xw.dpy = XOpenDisplay(NULL))) die("can't open display\n"); xw.scr = XDefaultScreen(xw.dpy); - xw.vis = XDefaultVisual(xw.dpy, xw.scr); + + if (!(opt_embed && (parent = strtol(opt_embed, NULL, 0)))) { + parent = XRootWindow(xw.dpy, xw.scr); + xw.depth = 32; + } else { + XGetWindowAttributes(xw.dpy, parent, &attr); + xw.depth = attr.depth; + } + + XMatchVisualInfo(xw.dpy, xw.scr, xw.depth, TrueColor, &vis); + xw.vis = vis.visual; /* font */ if (!FcInit()) @@ -1229,13 +1177,16 @@ xinit(int cols, int rows) usedfont = (opt_font == NULL)? font : opt_font; xloadfonts(usedfont, 0); + /* Backup default alpha value */ + alpha_def = alpha; + /* colors */ - xw.cmap = XDefaultColormap(xw.dpy, xw.scr); + xw.cmap = XCreateColormap(xw.dpy, parent, xw.vis, None); xloadcols(); /* adjust fixed window geometry */ - win.w = 2 * win.hborderpx + 2 * borderpx + cols * win.cw; - win.h = 2 * win.vborderpx + 2 * borderpx + rows * win.ch; + win.w = 2 * borderpx + cols * win.cw; + win.h = 2 * borderpx + rows * win.ch; if (xw.gm & XNegative) xw.l += DisplayWidth(xw.dpy, xw.scr) - win.w - 2; if (xw.gm & YNegative) @@ -1251,10 +1202,8 @@ xinit(int cols, int rows) xw.attrs.colormap = xw.cmap; root = XRootWindow(xw.dpy, xw.scr); - if (!(opt_embed && (parent = strtol(opt_embed, NULL, 0)))) - parent = root; xw.win = XCreateWindow(xw.dpy, root, xw.l, xw.t, - win.w, win.h, 0, XDefaultDepth(xw.dpy, xw.scr), InputOutput, + win.w, win.h, 0, xw.depth, InputOutput, xw.vis, CWBackPixel | CWBorderPixel | CWBitGravity | CWEventMask | CWColormap, &xw.attrs); if (parent != root) @@ -1262,15 +1211,13 @@ xinit(int cols, int rows) memset(&gcvalues, 0, sizeof(gcvalues)); gcvalues.graphics_exposures = False; - 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)); + xw.buf = XCreatePixmap(xw.dpy, xw.win, win.w, win.h, xw.depth); + dc.gc = XCreateGC(xw.dpy, xw.buf, GCGraphicsExposures, &gcvalues); XSetForeground(xw.dpy, dc.gc, dc.col[defaultbg].pixel); XFillRectangle(xw.dpy, xw.buf, dc.gc, 0, 0, win.w, win.h); /* font spec buffer */ - xw.specbuf = xmalloc(cols * sizeof(GlyphFontSpec)); + xw.specbuf = xmalloc(cols * sizeof(GlyphFontSpec) * 4); /* Xft rendering context */ xw.draw = XftDrawCreate(xw.dpy, xw.buf, xw.vis, xw.cmap); @@ -1322,17 +1269,28 @@ xinit(int cols, int rows) xsel.xtarget = XInternAtom(xw.dpy, "UTF8_STRING", 0); if (xsel.xtarget == None) xsel.xtarget = XA_STRING; +} - boxdraw_xinit(xw.dpy, xw.cmap, xw.draw, xw.vis); - - // Initialize the graphics (image display) module. - gr_init(xw.dpy, xw.vis, xw.cmap); +void +xresetfontsettings(ushort mode, Font **font, int *frcflags) +{ + *font = &dc.font; + if ((mode & ATTR_ITALIC) && (mode & ATTR_BOLD)) { + *font = &dc.ibfont; + *frcflags = FRC_ITALICBOLD; + } else if (mode & ATTR_ITALIC) { + *font = &dc.ifont; + *frcflags = FRC_ITALIC; + } else if (mode & ATTR_BOLD) { + *font = &dc.bfont; + *frcflags = FRC_BOLD; + } } int xmakeglyphfontspecs(XftGlyphFontSpec *specs, const Glyph *glyphs, int len, int x, int y) { - float winx = win.hborderpx + x * win.cw, winy = win.vborderpx + y * win.ch, xp, yp; + float winx = borderpx + x * win.cw, winy = borderpx + y * win.ch, xp, yp; ushort mode, prevmode = USHRT_MAX; Font *font = &dc.font; int frcflags = FRC_NORMAL; @@ -1343,189 +1301,175 @@ xmakeglyphfontspecs(XftGlyphFontSpec *specs, const Glyph *glyphs, int len, int x FcPattern *fcpattern, *fontpattern; FcFontSet *fcsets[] = { NULL }; FcCharSet *fccharset; - int i, f, numspecs = 0; + int i, f, length = 0, start = 0, numspecs = 0; + float cluster_xp = xp, cluster_yp = yp; + HbTransformData shaped = { 0 }; + + /* Initial values. */ + mode = prevmode = glyphs[0].mode & ~ATTR_WRAP; + xresetfontsettings(mode, &font, &frcflags); for (i = 0, xp = winx, yp = winy + font->ascent; i < len; ++i) { - /* Fetch rune and mode for current glyph. */ - rune = glyphs[i].u; - mode = glyphs[i].mode; + mode = glyphs[i].mode & ~ATTR_WRAP; /* Skip dummy wide-character spacing. */ - if (mode == ATTR_WDUMMY) + if (mode & ATTR_WDUMMY && i < (len - 1)) continue; - /* Draw spaces for image placeholders (images will be drawn - * separately). */ - if (mode & ATTR_IMAGE) - rune = ' '; - - /* Determine font for glyph if different from previous glyph. */ - if (prevmode != mode) { - prevmode = mode; - font = &dc.font; - frcflags = FRC_NORMAL; - runewidth = win.cw * ((mode & ATTR_WIDE) ? 2.0f : 1.0f); - if ((mode & ATTR_ITALIC) && (mode & ATTR_BOLD)) { - font = &dc.ibfont; - frcflags = FRC_ITALICBOLD; - } else if (mode & ATTR_ITALIC) { - font = &dc.ifont; - frcflags = FRC_ITALIC; - } else if (mode & ATTR_BOLD) { - font = &dc.bfont; - frcflags = FRC_BOLD; - } - yp = winy + font->ascent; - } - - if (mode & ATTR_BOXDRAW) { - /* minor shoehorning: boxdraw uses only this ushort */ - glyphidx = boxdrawindex(&glyphs[i]); - } else { - /* Lookup character index with default font. */ - glyphidx = XftCharIndex(xw.dpy, font->match, rune); - } - if (glyphidx) { - specs[numspecs].font = font->match; - specs[numspecs].glyph = glyphidx; - specs[numspecs].x = (short)xp; - specs[numspecs].y = (short)yp; - xp += runewidth; - numspecs++; - continue; - } - - /* Fallback on font cache, search the font cache for match. */ - for (f = 0; f < frclen; f++) { - glyphidx = XftCharIndex(xw.dpy, frc[f].font, rune); - /* Everything correct. */ - if (glyphidx && frc[f].flags == frcflags) - break; - /* We got a default font for a not found glyph. */ - if (!glyphidx && frc[f].flags == frcflags - && frc[f].unicodep == rune) { - break; - } - } - - /* Nothing was found. Use fontconfig to find matching font. */ - if (f >= frclen) { - if (!font->set) - font->set = FcFontSort(0, font->pattern, - 1, 0, &fcres); - fcsets[0] = font->set; - - /* - * Nothing was found in the cache. Now use - * some dozen of Fontconfig calls to get the - * font for one single character. - * - * Xft and fontconfig are design failures. - */ - fcpattern = FcPatternDuplicate(font->pattern); - fccharset = FcCharSetCreate(); - - FcCharSetAddChar(fccharset, rune); - FcPatternAddCharSet(fcpattern, FC_CHARSET, - fccharset); - FcPatternAddBool(fcpattern, FC_SCALABLE, 1); - - FcConfigSubstitute(0, fcpattern, - FcMatchPattern); - FcDefaultSubstitute(fcpattern); - - fontpattern = FcFontSetMatch(0, fcsets, 1, - fcpattern, &fcres); - - /* Allocate memory for the new cache entry. */ - if (frclen >= frccap) { - frccap += 16; - frc = xrealloc(frc, frccap * sizeof(Fontcache)); + if ( + prevmode != mode + || ATTRCMP(glyphs[start], glyphs[i]) + || selected(x + i, y) != selected(x + start, y) + || i == (len - 1) + ) { + /* Handle 1-character wide segments and end of line */ + length = i - start; + if (i == start) { + length = 1; + } else if (i == (len - 1)) { + length = (i - start + 1); } - frc[frclen].font = XftFontOpenPattern(xw.dpy, - fontpattern); - if (!frc[frclen].font) - die("XftFontOpenPattern failed seeking fallback font: %s\n", - strerror(errno)); - frc[frclen].flags = frcflags; - frc[frclen].unicodep = rune; + /* Shape the segment. */ + hbtransform(&shaped, font->match, glyphs, start, length); + runewidth = win.cw * ((glyphs[start].mode & ATTR_WIDE) ? 2.0f : 1.0f); + cluster_xp = xp; cluster_yp = yp; + for (int code_idx = 0; code_idx < shaped.count; code_idx++) { + int idx = shaped.glyphs[code_idx].cluster; - glyphidx = XftCharIndex(xw.dpy, frc[frclen].font, rune); + if (glyphs[start + idx].mode & ATTR_WDUMMY) + continue; - f = frclen; - frclen++; + /* Advance the drawing cursor if we've moved to a new cluster */ + if (code_idx > 0 && idx != shaped.glyphs[code_idx - 1].cluster) { + xp += runewidth; + cluster_xp = xp; + cluster_yp = yp; + runewidth = win.cw * ((glyphs[start + idx].mode & ATTR_WIDE) ? 2.0f : 1.0f); + } - FcPatternDestroy(fcpattern); - FcCharSetDestroy(fccharset); + if (shaped.glyphs[code_idx].codepoint != 0) { + /* If symbol is found, put it into the specs. */ + specs[numspecs].font = font->match; + specs[numspecs].glyph = shaped.glyphs[code_idx].codepoint; + specs[numspecs].x = cluster_xp + (short)(shaped.positions[code_idx].x_offset / 64.); + specs[numspecs].y = cluster_yp - (short)(shaped.positions[code_idx].y_offset / 64.); + cluster_xp += shaped.positions[code_idx].x_advance / 64.; + cluster_yp += shaped.positions[code_idx].y_advance / 64.; + numspecs++; + } else { + /* If it's not found, try to fetch it through the font cache. */ + rune = glyphs[start + idx].u; + for (f = 0; f < frclen; f++) { + glyphidx = XftCharIndex(xw.dpy, frc[f].font, rune); + /* Everything correct. */ + if (glyphidx && frc[f].flags == frcflags) + break; + /* We got a default font for a not found glyph. */ + if (!glyphidx && frc[f].flags == frcflags + && frc[f].unicodep == rune) { + break; + } + } + + /* Nothing was found. Use fontconfig to find matching font. */ + if (f >= frclen) { + if (!font->set) + font->set = FcFontSort(0, font->pattern, + 1, 0, &fcres); + fcsets[0] = font->set; + + /* + * Nothing was found in the cache. Now use + * some dozen of Fontconfig calls to get the + * font for one single character. + * + * Xft and fontconfig are design failures. + */ + fcpattern = FcPatternDuplicate(font->pattern); + fccharset = FcCharSetCreate(); + + FcCharSetAddChar(fccharset, rune); + FcPatternAddCharSet(fcpattern, FC_CHARSET, + fccharset); + FcPatternAddBool(fcpattern, FC_SCALABLE, 1); + + FcConfigSubstitute(0, fcpattern, + FcMatchPattern); + FcDefaultSubstitute(fcpattern); + + fontpattern = FcFontSetMatch(0, fcsets, 1, + fcpattern, &fcres); + + /* Allocate memory for the new cache entry. */ + if (frclen >= frccap) { + frccap += 16; + frc = xrealloc(frc, frccap * sizeof(Fontcache)); + } + + frc[frclen].font = XftFontOpenPattern(xw.dpy, + fontpattern); + if (!frc[frclen].font) + die("XftFontOpenPattern failed seeking fallback font: %s\n", + strerror(errno)); + frc[frclen].flags = frcflags; + frc[frclen].unicodep = rune; + + glyphidx = XftCharIndex(xw.dpy, frc[frclen].font, rune); + + f = frclen; + frclen++; + + FcPatternDestroy(fcpattern); + FcCharSetDestroy(fccharset); + } + + specs[numspecs].font = frc[f].font; + specs[numspecs].glyph = glyphidx; + specs[numspecs].x = (short)xp; + specs[numspecs].y = (short)yp; + numspecs++; + } + } + + /* Cleanup and get ready for next segment. */ + hbcleanup(&shaped); + start = i; + + /* Determine font for glyph if different from previous glyph. */ + if (prevmode != mode) { + prevmode = mode; + xresetfontsettings(mode, &font, &frcflags); + yp = winy + font->ascent; + } } - - specs[numspecs].font = frc[f].font; - specs[numspecs].glyph = glyphidx; - specs[numspecs].x = (short)xp; - specs[numspecs].y = (short)yp; - xp += runewidth; - numspecs++; } return numspecs; } -/* Draws a horizontal dashed line of length `w` starting at `(x, y)`. `wavelen` - * is the length of the dash plus the length of the gap. `fraction` is the - * fraction of the dash length compared to `wavelen`. */ -static void -xdrawunderdashed(Draw draw, Color *color, int x, int y, int w, - int wavelen, float fraction, int thick) +void +chgalpha(const Arg *arg) { - int dashw = MAX(1, fraction * wavelen); - for (int i = x - x % wavelen; i < x + w; i += wavelen) { - int startx = MAX(i, x); - int endx = MIN(i + dashw, x + w); - if (startx < endx) - XftDrawRect(xw.draw, color, startx, y, endx - startx, - thick); - } -} + if (arg->f == -1.0f && alpha >= 0.1f) + alpha -= 0.1f; + else if (arg->f == 1.0f && alpha < 1.0f) + alpha += 0.1f; + else if (arg->f == 0.0f) + alpha = alpha_def; + else + return; -/* Draws an undercurl. `h` is the total height, including line thickness. */ -static void -xdrawundercurl(Draw draw, Color *color, int x, int y, int w, int h, int thick) -{ - XGCValues gcvals = {.foreground = color->pixel, - .line_width = thick, - .line_style = LineSolid, - .cap_style = CapRound}; - GC gc = XCreateGC(xw.dpy, XftDrawDrawable(xw.draw), - GCForeground | GCLineWidth | GCLineStyle | GCCapStyle, - &gcvals); - - XRectangle clip = {.x = x, .y = y, .width = w, .height = h}; - XSetClipRectangles(xw.dpy, gc, 0, 0, &clip, 1, Unsorted); - - int yoffset = thick / 2; - int segh = MAX(1, h - thick); - /* Make sure every segment is at a 45 degree angle, otherwise it doesn't - * look good without antialiasing. */ - int segw = segh; - int wavelen = MAX(1, segw * 2); - - for (int i = x - (x % wavelen); i < x + w; i += wavelen) { - XPoint points[3] = {{.x = i, .y = y + yoffset}, - {.x = i + segw, .y = y + yoffset + segh}, - {.x = i + wavelen, .y = y + yoffset}}; - XDrawLines(xw.dpy, XftDrawDrawable(xw.draw), gc, points, 3, - CoordModeOrigin); - } - - XFreeGC(xw.dpy, gc); + dc.col[defaultbg].color.alpha = (unsigned short)(0xFFFF * alpha); + /* Required to remove artifacting from borderpx */ + cresize(0, 0); + redraw(); } void -xdrawglyphfontspecs(const XftGlyphFontSpec *specs, Glyph base, int len, int x, int y) +xdrawglyphfontspecs(const XftGlyphFontSpec *specs, Glyph base, int len, int x, int y, int charlen) { - int charlen = len * ((base.mode & ATTR_WIDE) ? 2 : 1); - int winx = win.hborderpx + x * win.cw, winy = win.vborderpx + y * win.ch, + int winx = borderpx + x * win.cw, winy = borderpx + y * win.ch, width = charlen * win.cw; Color *fg, *bg, *temp, revfg, revbg, truefg, truebg; XRenderColor colfg, colbg; @@ -1615,17 +1559,17 @@ xdrawglyphfontspecs(const XftGlyphFontSpec *specs, Glyph base, int len, int x, i /* Intelligent cleaning up of the borders. */ if (x == 0) { - xclear(0, (y == 0)? 0 : winy, win.hborderpx, + xclear(0, (y == 0)? 0 : winy, borderpx, winy + win.ch + - ((winy + win.ch >= win.vborderpx + win.th)? win.h : 0)); + ((winy + win.ch >= borderpx + win.th)? win.h : 0)); } - if (winx + width >= win.hborderpx + win.tw) { + if (winx + width >= borderpx + win.tw) { xclear(winx + width, (y == 0)? 0 : winy, win.w, - ((winy + win.ch >= win.vborderpx + win.th)? win.h : (winy + win.ch))); + ((winy + win.ch >= borderpx + win.th)? win.h : (winy + win.ch))); } if (y == 0) - xclear(winx, 0, winx + width, win.vborderpx); - if (winy + win.ch >= win.vborderpx + win.th) + xclear(winx, 0, winx + width, borderpx); + if (winy + win.ch >= borderpx + win.th) xclear(winx, winy + win.ch, winx + width, win.h); /* Clean up the region we want to draw to. */ @@ -1638,72 +1582,18 @@ xdrawglyphfontspecs(const XftGlyphFontSpec *specs, Glyph base, int len, int x, i r.width = width; XftDrawSetClipRectangles(xw.draw, winx, winy, &r, 1); - /* Decoration color. */ - Color decor; - uint32_t decorcolor = tgetdecorcolor(&base); - if (decorcolor == DECOR_DEFAULT_COLOR) { - decor = *fg; - } else if (IS_TRUECOL(decorcolor)) { - colfg.alpha = 0xffff; - colfg.red = TRUERED(decorcolor); - colfg.green = TRUEGREEN(decorcolor); - colfg.blue = TRUEBLUE(decorcolor); - XftColorAllocValue(xw.dpy, xw.vis, xw.cmap, &colfg, &decor); - } else { - decor = dc.col[decorcolor]; - } - decor.color.alpha = 0xffff; - decor.pixel |= 0xff << 24; + /* Render the glyphs. */ + XftDrawGlyphFontSpec(xw.draw, fg, specs, len); - /* Float thickness, used as a base to compute other values. */ - float fthick = dc.font.height / 18.0; - /* Integer thickness in pixels. Must not be 0. */ - int thick = MAX(1, roundf(fthick)); - /* The default gap between the baseline and a single underline. */ - int gap = roundf(fthick * 2); - /* The total thickness of a double underline. */ - int doubleh = thick * 2 + ceilf(fthick * 0.5); - /* The total thickness of an undercurl. */ - int curlh = thick * 2 + roundf(fthick * 0.75); - - /* Render the underline before the glyphs. */ + /* Render underline and strikethrough. */ if (base.mode & ATTR_UNDERLINE) { - uint32_t style = tgetdecorstyle(&base); - int liney = winy + dc.font.ascent + gap; - /* Adjust liney to guarantee that a single underline fits. */ - liney -= MAX(0, liney + thick - (winy + win.ch)); - if (style == UNDERLINE_DOUBLE) { - liney -= MAX(0, liney + doubleh - (winy + win.ch)); - XftDrawRect(xw.draw, &decor, winx, liney, width, thick); - XftDrawRect(xw.draw, &decor, winx, - liney + doubleh - thick, width, thick); - } else if (style == UNDERLINE_DOTTED) { - xdrawunderdashed(xw.draw, &decor, winx, liney, width, - thick * 2, 0.5, thick); - } else if (style == UNDERLINE_DASHED) { - int wavelen = MAX(2, win.cw * 0.9); - xdrawunderdashed(xw.draw, &decor, winx, liney, width, - wavelen, 0.65, thick); - } else if (style == UNDERLINE_CURLY) { - liney -= MAX(0, liney + curlh - (winy + win.ch)); - xdrawundercurl(xw.draw, &decor, winx, liney, width, - curlh, thick); - } else { - XftDrawRect(xw.draw, &decor, winx, liney, width, thick); - } + XftDrawRect(xw.draw, fg, winx, winy + dc.font.ascent * chscale + 1, + width, 1); } - if (base.mode & ATTR_BOXDRAW) { - drawboxes(winx, winy, width / len, win.ch, fg, bg, specs, len); - } else { - /* Render the glyphs. */ - XftDrawGlyphFontSpec(xw.draw, fg, specs, len); - } - - /* Render strikethrough. Alway use the fg color. */ if (base.mode & ATTR_STRUCK) { - XftDrawRect(xw.draw, fg, winx, winy + 2 * dc.font.ascent / 3, - width, thick); + XftDrawRect(xw.draw, fg, winx, winy + 2 * dc.font.ascent * chscale / 3, + width, 1); } /* Reset clip to none. */ @@ -1714,38 +1604,32 @@ void xdrawglyph(Glyph g, int x, int y) { int numspecs; - XftGlyphFontSpec spec; + XftGlyphFontSpec *specs = xw.specbuf; - numspecs = xmakeglyphfontspecs(&spec, &g, 1, x, y); - xdrawglyphfontspecs(&spec, g, numspecs, x, y); - if (g.mode & ATTR_IMAGE) { - gr_start_drawing(xw.buf, win.cw, win.ch); - xdrawoneimagecell(g, x, y); - gr_finish_drawing(xw.buf); - } + numspecs = xmakeglyphfontspecs(specs, &g, 1, x, y); + xdrawglyphfontspecs(specs, g, numspecs, x, y, (g.mode & ATTR_WIDE) ? 2 : 1); } void -xdrawcursor(int cx, int cy, Glyph g, int ox, int oy, Glyph og) +xdrawcursor(int cx, int cy, Glyph g, int ox, int oy, Glyph og, Line line, int len) { Color drawcol; /* remove the old cursor */ if (selected(ox, oy)) og.mode ^= ATTR_REVERSE; - xdrawglyph(og, ox, oy); + + /* Redraw the line where cursor was previously. + * It will restore the ligatures broken by the cursor. */ + xdrawline(line, 0, oy, len); if (IS_SET(MODE_HIDE)) return; - // If it's an image, just draw a ballot box for simplicity. - if (g.mode & ATTR_IMAGE) - g.u = 0x2610; - /* * Select the right color for the right mode. */ - g.mode &= ATTR_BOLD|ATTR_ITALIC|ATTR_UNDERLINE|ATTR_STRUCK|ATTR_WIDE|ATTR_BOXDRAW; + g.mode &= ATTR_BOLD|ATTR_ITALIC|ATTR_UNDERLINE|ATTR_STRUCK|ATTR_WIDE; if (IS_SET(MODE_REVERSE)) { g.mode |= ATTR_REVERSE; @@ -1782,167 +1666,39 @@ xdrawcursor(int cx, int cy, Glyph g, int ox, int oy, Glyph og) case 3: /* Blinking Underline */ case 4: /* Steady Underline */ XftDrawRect(xw.draw, &drawcol, - win.hborderpx + cx * win.cw, - win.vborderpx + (cy + 1) * win.ch - \ + borderpx + cx * win.cw, + borderpx + (cy + 1) * win.ch - \ cursorthickness, win.cw, cursorthickness); break; case 5: /* Blinking bar */ case 6: /* Steady bar */ XftDrawRect(xw.draw, &drawcol, - win.hborderpx + cx * win.cw, - win.vborderpx + cy * win.ch, + borderpx + cx * win.cw, + borderpx + cy * win.ch, cursorthickness, win.ch); break; } } else { XftDrawRect(xw.draw, &drawcol, - win.hborderpx + cx * win.cw, - win.vborderpx + cy * win.ch, + borderpx + cx * win.cw, + borderpx + cy * win.ch, win.cw - 1, 1); XftDrawRect(xw.draw, &drawcol, - win.hborderpx + cx * win.cw, - win.vborderpx + cy * win.ch, + borderpx + cx * win.cw, + borderpx + cy * win.ch, 1, win.ch - 1); XftDrawRect(xw.draw, &drawcol, - win.hborderpx + (cx + 1) * win.cw - 1, - win.vborderpx + cy * win.ch, + borderpx + (cx + 1) * win.cw - 1, + borderpx + cy * win.ch, 1, win.ch - 1); XftDrawRect(xw.draw, &drawcol, - win.hborderpx + cx * win.cw, - win.vborderpx + (cy + 1) * win.ch - 1, + borderpx + cx * win.cw, + borderpx + (cy + 1) * win.ch - 1, win.cw, 1); } } -/* Draw (or queue for drawing) image cells between columns x1 and x2 assuming - * that they have the same attributes (and thus the same lower 24 bits of the - * image ID and the same placement ID). */ -void -xdrawimages(Glyph base, Line line, int x1, int y1, int x2) { - int y_pix = win.vborderpx + y1 * win.ch; - uint32_t image_id_24bits = base.fg & 0xFFFFFF; - uint32_t placement_id = tgetimgplacementid(&base); - // Columns and rows are 1-based, 0 means unspecified. - int last_col = 0; - int last_row = 0; - int last_start_col = 0; - int last_start_x = x1; - // The most significant byte is also 1-base, subtract 1 before use. - uint32_t last_id_4thbyteplus1 = 0; - // We may need to inherit row/column/4th byte from the previous cell. - Glyph *prev = &line[x1 - 1]; - if (x1 > 0 && (prev->mode & ATTR_IMAGE) && - (prev->fg & 0xFFFFFF) == image_id_24bits && - prev->decor == base.decor) { - last_row = tgetimgrow(prev); - last_col = tgetimgcol(prev); - last_id_4thbyteplus1 = tgetimgid4thbyteplus1(prev); - last_start_col = last_col + 1; - } - for (int x = x1; x < x2; ++x) { - Glyph *g = &line[x]; - uint32_t cur_row = tgetimgrow(g); - uint32_t cur_col = tgetimgcol(g); - uint32_t cur_id_4thbyteplus1 = tgetimgid4thbyteplus1(g); - uint32_t num_diacritics = tgetimgdiacriticcount(g); - // If the row is not specified, assume it's the same as the row - // of the previous cell. Note that `cur_row` may contain a - // value imputed earlier, which will be preserved if `last_row` - // is zero (i.e. we don't know the row of the previous cell). - if (last_row && (num_diacritics == 0 || !cur_row)) - cur_row = last_row; - // If the column is not specified and the row is the same as the - // row of the previous cell, then assume that the column is the - // next one. - if (last_col && (num_diacritics <= 1 || !cur_col) && - cur_row == last_row) - cur_col = last_col + 1; - // If the additional id byte is not specified and the - // coordinates are consecutive, assume the byte is also the - // same. - if (last_id_4thbyteplus1 && - (num_diacritics <= 2 || !cur_id_4thbyteplus1) && - cur_row == last_row && cur_col == last_col + 1) - cur_id_4thbyteplus1 = last_id_4thbyteplus1; - // If we couldn't infer row and column, start from the top left - // corner. - if (cur_row == 0) - cur_row = 1; - if (cur_col == 0) - cur_col = 1; - // If this cell breaks a contiguous stripe of image cells, draw - // that line and start a new one. - if (cur_col != last_col + 1 || cur_row != last_row || - cur_id_4thbyteplus1 != last_id_4thbyteplus1) { - uint32_t image_id = image_id_24bits; - if (last_id_4thbyteplus1) - image_id |= (last_id_4thbyteplus1 - 1) << 24; - if (last_row != 0) { - int x_pix = - win.hborderpx + last_start_x * win.cw; - gr_append_imagerect( - xw.buf, image_id, placement_id, - last_start_col - 1, last_col, - last_row - 1, last_row, last_start_x, - y1, x_pix, y_pix, win.cw, win.ch, - base.mode & ATTR_REVERSE); - } - last_start_col = cur_col; - last_start_x = x; - } - last_row = cur_row; - last_col = cur_col; - last_id_4thbyteplus1 = cur_id_4thbyteplus1; - // Populate the missing glyph data to enable inheritance between - // runs and support the naive implementation of tgetimgid. - if (!tgetimgrow(g)) - tsetimgrow(g, cur_row); - // We cannot save this information if there are > 511 cols. - if (!tgetimgcol(g) && (cur_col & ~0x1ff) == 0) - tsetimgcol(g, cur_col); - if (!tgetimgid4thbyteplus1(g)) - tsetimg4thbyteplus1(g, cur_id_4thbyteplus1); - } - uint32_t image_id = image_id_24bits; - if (last_id_4thbyteplus1) - image_id |= (last_id_4thbyteplus1 - 1) << 24; - // Draw the last contiguous stripe. - if (last_row != 0) { - int x_pix = win.hborderpx + last_start_x * win.cw; - gr_append_imagerect(xw.buf, image_id, placement_id, - last_start_col - 1, last_col, last_row - 1, - last_row, last_start_x, y1, x_pix, y_pix, - win.cw, win.ch, base.mode & ATTR_REVERSE); - } -} - -/* Draw just one image cell without inheriting attributes from the left. */ -void xdrawoneimagecell(Glyph g, int x, int y) { - if (!(g.mode & ATTR_IMAGE)) - return; - int x_pix = win.hborderpx + x * win.cw; - int y_pix = win.vborderpx + y * win.ch; - uint32_t row = tgetimgrow(&g) - 1; - uint32_t col = tgetimgcol(&g) - 1; - uint32_t placement_id = tgetimgplacementid(&g); - uint32_t image_id = tgetimgid(&g); - gr_append_imagerect(xw.buf, image_id, placement_id, col, col + 1, row, - row + 1, x, y, x_pix, y_pix, win.cw, win.ch, - g.mode & ATTR_REVERSE); -} - -/* Prepare for image drawing. */ -void xstartimagedraw(int *dirty, int rows) { - gr_start_drawing(xw.buf, win.cw, win.ch); - gr_mark_dirty_animations(dirty, rows); -} - -/* Draw all queued image cells. */ -void xfinishimagedraw() { - gr_finish_drawing(xw.buf); -} - void xsetenv(void) { @@ -1989,8 +1745,6 @@ xsettitle(char *p) int xstartdraw(void) { - if (IS_SET(MODE_VISIBLE)) - XCopyArea(xw.dpy, xw.win, xw.buf, dc.gc, 0, 0, win.w, win.h, 0, 0); return IS_SET(MODE_VISIBLE); } @@ -2001,20 +1755,16 @@ xdrawline(Line line, int x1, int y1, int x2) Glyph base, new; XftGlyphFontSpec *specs = xw.specbuf; - numspecs = xmakeglyphfontspecs(specs, &line[x1], x2 - x1, x1, y1); i = ox = 0; - for (x = x1; x < x2 && i < numspecs; x++) { + for (x = x1; x < x2; x++) { new = line[x]; if (new.mode == ATTR_WDUMMY) continue; if (selected(x, y1)) new.mode ^= ATTR_REVERSE; - if (i > 0 && ATTRCMP(base, new)) { - xdrawglyphfontspecs(specs, base, i, ox, y1); - if (base.mode & ATTR_IMAGE) - xdrawimages(base, line, ox, y1, x); - specs += i; - numspecs -= i; + if ((i > 0) && ATTRCMP(base, new)) { + numspecs = xmakeglyphfontspecs(specs, &line[ox], x - ox, ox, y1); + xdrawglyphfontspecs(specs, base, numspecs, ox, y1, x - ox); i = 0; } if (i == 0) { @@ -2023,10 +1773,10 @@ xdrawline(Line line, int x1, int y1, int x2) } i++; } - if (i > 0) - xdrawglyphfontspecs(specs, base, i, ox, y1); - if (i > 0 && base.mode & ATTR_IMAGE) - xdrawimages(base, line, ox, y1, x); + if (i > 0) { + numspecs = xmakeglyphfontspecs(specs, &line[ox], x2 - ox, ox, y1); + xdrawglyphfontspecs(specs, base, numspecs, ox, y1, x2 - ox); + } } void @@ -2251,7 +2001,6 @@ cmessage(XEvent *e) } } else if (e->xclient.data.l[0] == xw.wmdeletewin) { ttyhangup(); - gr_deinit(); exit(0); } } @@ -2302,13 +2051,6 @@ run(void) if (XPending(xw.dpy)) timeout = 0; /* existing events might not set xfd */ - /* Decrease the timeout if there are active animations. */ - if (graphics_next_redraw_delay != INT_MAX && - IS_SET(MODE_VISIBLE)) - timeout = timeout < 0 ? graphics_next_redraw_delay - : MIN(timeout, - graphics_next_redraw_delay); - seltv.tv_sec = timeout / 1E3; seltv.tv_nsec = 1E6 * (timeout - 1E3 * seltv.tv_sec); tv = timeout >= 0 ? &seltv : NULL; @@ -2375,6 +2117,118 @@ run(void) } } + +#define XRESOURCE_LOAD_META(NAME) \ + if(!XrmGetResource(xrdb, "st." NAME, "st." NAME, &type, &ret)) \ + XrmGetResource(xrdb, "*." NAME, "*." NAME, &type, &ret); \ + if (ret.addr != NULL && !strncmp("String", type, 64)) + +#define XRESOURCE_LOAD_STRING(NAME, DST) \ + XRESOURCE_LOAD_META(NAME) \ + DST = ret.addr; + +#define XRESOURCE_LOAD_CHAR(NAME, DST) \ + XRESOURCE_LOAD_META(NAME) \ + DST = ret.addr[0]; + +#define XRESOURCE_LOAD_INTEGER(NAME, DST) \ + XRESOURCE_LOAD_META(NAME) \ + DST = strtoul(ret.addr, NULL, 10); + +#define XRESOURCE_LOAD_FLOAT(NAME, DST) \ + XRESOURCE_LOAD_META(NAME) \ + DST = strtof(ret.addr, NULL); + +void +xrdb_load(void) +{ + /* XXX */ + char *xrm; + char *type; + XrmDatabase xrdb; + XrmValue ret; + Display *dpy; + + if(!(dpy = XOpenDisplay(NULL))) + die("Can't open display\n"); + + XrmInitialize(); + xrm = XResourceManagerString(dpy); + + if (xrm != NULL) { + xrdb = XrmGetStringDatabase(xrm); + + /* handling colors here without macros to do via loop. */ + int i = 0; + char loadValue[12] = ""; + for (i = 0; i < 256; i++) + { + sprintf(loadValue, "%s%d", "st.color", i); + + if(!XrmGetResource(xrdb, loadValue, loadValue, &type, &ret)) + { + sprintf(loadValue, "%s%d", "*.color", i); + if (!XrmGetResource(xrdb, loadValue, loadValue, &type, &ret)) + /* reset if not found (unless in range for defaults). */ + if (i > 15) + colorname[i] = NULL; + } + + if (ret.addr != NULL && !strncmp("String", type, 64)) + colorname[i] = ret.addr; + } + + XRESOURCE_LOAD_STRING("foreground", colorname[defaultfg]); + XRESOURCE_LOAD_STRING("background", colorname[defaultbg]); + XRESOURCE_LOAD_STRING("cursorColor", colorname[defaultcs]) + else { + // this looks confusing because we are chaining off of the if + // in the macro. probably we should be wrapping everything blocks + // so this isn't possible... + defaultcs = defaultfg; + } + XRESOURCE_LOAD_STRING("reverse-cursor", colorname[defaultrcs]) + else { + // see above. + defaultrcs = defaultbg; + } + + XRESOURCE_LOAD_STRING("font", font); + XRESOURCE_LOAD_STRING("termname", termname); + + XRESOURCE_LOAD_INTEGER("blinktimeout", blinktimeout); + XRESOURCE_LOAD_INTEGER("bellvolume", bellvolume); + XRESOURCE_LOAD_INTEGER("borderpx", borderpx); + XRESOURCE_LOAD_INTEGER("cursorshape", cursorshape); + + XRESOURCE_LOAD_FLOAT("cwscale", cwscale); + XRESOURCE_LOAD_FLOAT("chscale", chscale); + } + XFlush(dpy); +} + +void +reload(int sig) +{ + xrdb_load(); + + /* colors, fonts */ + xloadcols(); + xunloadfonts(); + xloadfonts(font, 0); + + /* pretend the window just got resized */ + cresize(win.w, win.h); + + redraw(); + + /* triggers re-render if we're visible. */ + ttywrite("\033[O", 3, 1); + + signal(SIGUSR1, reload); +} + + void usage(void) { @@ -2399,6 +2253,9 @@ main(int argc, char *argv[]) case 'a': allowaltscreen = 0; break; + case 'A': + opt_alpha = EARGF(usage()); + break; case 'c': opt_class = EARGF(usage()); break; @@ -2448,6 +2305,8 @@ run: setlocale(LC_CTYPE, ""); XSetLocaleModifiers(""); + xrdb_load(); + signal(SIGUSR1, reload); cols = MAX(cols, 1); rows = MAX(rows, 1); tnew(cols, rows); diff --git a/suckless/st/x.o b/suckless/st/x.o new file mode 100644 index 0000000..9c23ee6 Binary files /dev/null and b/suckless/st/x.o differ