1
0
mirror of https://github.com/alrayyes/st synced 2023-11-14 15:56:30 +00:00

Compare commits

..

2 Commits

Author SHA1 Message Date
Ryan Kes
372e01a0f3 feat: added ligature suport 2020-11-28 12:29:25 +01:00
Ryan Kes
c414fa19e0 feat: upgraded to 0.8.4 2020-11-28 12:17:22 +01:00
13 changed files with 1072 additions and 800 deletions

View File

@ -1,7 +1,7 @@
# Maintainer: Ryan Kes <alrayyes gmail com>
pkgname=higherlearning-st
pkgver=0.8.2
pkgver=0.8.4
pkgrel=1
pkgdesc='A simple virtual terminal emulator for X.'
arch=('i686' 'x86_64')
@ -11,25 +11,28 @@ makedepends=('ncurses')
conflicts=('st')
url="http://st.suckless.org"
_patches=("st-clipboard-0.8.2.diff"
"st-scrollback-20190122-3be4cf1.diff"
"st-scrollback-mouse-0.8.diff"
_patches=("st-clipboard-0.8.3.diff"
"st-scrollback-20200419-72e3f6c.diff"
"st-scrollback-mouse-20191024-a2c479c.diff"
"st-scrollback-mouse-altscreen-20200416-5703aa0.diff"
"st-vertcenter-20180320-6ac8c8a.diff"
"local-st-alpha-0.8.2.diff"
"local-disable-bold-italic-fonts.diff")
"st-alpha-0.8.2.diff"
"st-ligatures-alpha-scrollback-20200430-0.8.3.diff"
)
source=("http://dl.suckless.org/st/st-$pkgver.tar.gz"
"config.h"
"${_patches[@]}")
sha256sums=('aeb74e10aa11ed364e1bcc635a81a523119093e63befd2f231f8b0705b15bf35'
'2842d6e1030ff0afad7420c4a93062e6da4e498295222005eae2581a38c45913'
'7be1a09831f13361f5659aaad55110bde99b25c8ba826c11d1d7fcec21f32945'
'30c9bcec5801614dd5cc8b96f470d7431e83d5d2af87bb2305df60082e5ab4ed'
'3fb38940cc3bad3f9cd1e2a0796ebd0e48950a07860ecf8523a5afd0cd1b5a44'
sha256sums=('d42d3ceceb4d6a65e32e90a5336e3d446db612c3fbd9ebc1780bc6c9a03346a6'
'7dad11c04d2c869bc14f70ee23dd27cbb1b88934f12ae59a39b59ecbbf1b2291'
'0f5ce33953abce74a9da3088ea35bf067a9a4cfeb9fe6ea9800268ce69e436c0'
'1e41fe17a5ef5a8194eea07422b49d815e2c2bb4d58d84771f793be423005310'
'319458d980195d18fa0f81a6898d58f8d046c5ff982ab872d741f54bb60e267d'
'cb87eb654985da46ff63663407184402393ad3d3013c8795570552fe56a15b9d'
'04e6a4696293f668260b2f54a7240e379dbfabbc209de07bd5d4d57e9f513360'
'67b1bdc717e3f7914d04f0c72bc8a3f6efe91790248611c0a2c2dc905bf206bd'
'59d5719a68e2f0e25c44b6ad9fab0d62ee8a6c5bcbcffb38176e9950cda16b15')
'9c5b4b4f23de80de78ca5ec3739dc6ce5e7f72666186cf4a9c6b614ac90fb285'
'a7b3681d849fd8cca75cd38022a14fef2e26dc085bed1ebd8dcf0a65baa14898')
prepare() {
cd $srcdir/st-$pkgver

View File

@ -1,55 +1,33 @@
* My Suckless Terminal Build
:PROPERTIES:
:CUSTOM_ID: my-suckless-terminal-build
:END:
[[https://st.suckless.org][Suckless Terminal]]
[[https://www.archlinux.org/][Arch]] package with a few patches
installed to keep things nice:
** Description
[[https://st.suckless.org][Suckless Terminal]] Arch package with a few patches installed to keep things nice:
- [[https://st.suckless.org/patches/alpha/][alpha]]
- [[https://st.suckless.org/patches/clipboard/][clipboard]]
- [[https://st.suckless.org/patches/solarized/][solarized]]
- [[https://st.suckless.org/patches/vertcenter/][vertcenter]]
- [[https://st.suckless.org/patches/ligatures/][ligatures]]
- [[https://st.suckless.org/patches/scrollback/][scrollback]]
- [[https://st.suckless.org/patches/scrollback/][scrollback-mouse]]
- [[https://st.suckless.org/patches/disable_bold_italic_fonts/][disable_bold_italic_fonts]]
- [[https://st.suckless.org/patches/scrollback/][scrollback-mouse-altscreen]]
- [[https://st.suckless.org/patches/vertcenter/][vertcenter]]
** Terminal-specific mappings
:PROPERTIES:
:CUSTOM_ID: terminal-specific-mappings
:END:
- Scroll through history -- Shift+PageUp/PageDown or Shift+Mouse wheel
- Alt-k and Alt-j scroll back/foward in history one line at a time
- Alt-u and Alt-d scroll back/foward in history a page at a time
- Increase/decrease font size -- Shift+Alt+PageUp/PageDown
- Return to default font size -- Shift+Alt+Home
- Increase/decrease font size -- Ctrl+Shift+PageUp/PageDown
- Return to default font size -- Ctrl+Alt+Home
- Paste -- Shift+Insert
** Installation
:PROPERTIES:
:CUSTOM_ID: installation
:END:
#+BEGIN_SRC shell
makepkg -si
#+END_SRC
** Further Notes
:PROPERTIES:
:CUSTOM_ID: further-notes
:END:
- Change the transparency value by modifying the =alpha= variable in [[https://github.com/alrayyes/st/blob/master/config.h][config.h]].
- Default font is [[https://github.com/ryanoasis/nerd-fonts/blob/master/patched-fonts/FiraCode][Fira Code Nerd Font Mono]]
- When modifying [[https://github.com/alrayyes/st/blob/master/config.h][config.h]] be sure to run =updpkgsums= to update checksums before
running =makepkg -si=
** License
:PROPERTIES:
:CUSTOM_ID: license
:END:
This theme is released under the MIT License. For more information read
the [[file:LICENSE.org][license]].

587
config.h
View File

@ -5,25 +5,23 @@
*
* font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html
*/
static char *font = "FuraCode Nerd Font Mono:style=Regular:pixelsize=18:antialias=true:autohint=true";
/* disable bold, italic and roman fonts globally */
int disablebold = 0;
int disableitalic = 0;
int disableroman = 0;
static char *font =
"FuraCode Nerd Font "
"Mono:style=Regular:pixelsize=18: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: utmp option
* 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 */
@ -36,9 +34,9 @@ static float chscale = 1.0;
/*
* word delimiter string
*
* More advanced example: " `'\"()[]{}"
* More advanced example: L" `'\"()[]{}"
*/
char *worddelimiters = " ";
wchar_t *worddelimiters = L" ";
/* selection timeouts (in milliseconds) */
static unsigned int doubleclicktimeout = 300;
@ -47,9 +45,18 @@ static unsigned int tripleclicktimeout = 600;
/* alt screens */
int allowaltscreen = 1;
/* frames per second st should at maximum draw to the screen */
static unsigned int xfps = 120;
static unsigned int actionfps = 30;
/* 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 = 8;
static double maxlatency = 33;
/*
* blinking timeout (set to 0 to disable blinking) for the terminal blinking
@ -69,7 +76,7 @@ static unsigned int cursorthickness = 2;
static int bellvolume = 0;
/* default TERM value */
char *termname = "xterm-256color";
char *termname = "st-256color";
/*
* spaces per tab
@ -93,32 +100,42 @@ float alpha = 0.8;
/* Terminal colors (16 first used in escape sequence) */
static const char *colorname[] = {
"#282828", /* hard contrast: #1d2021 / soft contrast: #32302f */
"#cc241d",
"#98971a",
"#d79921",
"#458588",
"#b16286",
"#689d6a",
"#a89984",
"#928374",
"#fb4934",
"#b8bb26",
"#fabd2f",
"#83a598",
"#d3869b",
"#8ec07c",
"#ebdbb2",
/* 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",
"black",
};
/*
* Default colors (colorname index)
* foreground, background, cursor, reverse cursor
*/
unsigned int defaultfg = 12;
unsigned int defaultfg = 7;
unsigned int defaultbg = 258;
static unsigned int defaultcs = 14;
static unsigned int defaultrcs = 15;
static unsigned int defaultcs = 256;
static unsigned int defaultrcs = 257;
/*
* Default shape of cursor
@ -149,46 +166,48 @@ static unsigned int mousebg = 0;
*/
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[] = {
/* button mask string */
{ Button4, XK_NO_MOD, "\031" },
{ Button5, XK_NO_MOD, "\005" },
};
MouseKey mkeys[] = {
/* button mask function argument */
{ Button4, ShiftMask, kscrollup, {.i = 1} },
{ Button5, ShiftMask, kscrolldown, {.i = 1} },
/* mask button function argument release */
{XK_ANY_MOD, Button4, kscrollup, {.i = 1}, 0, /* !alt */ -1},
{XK_ANY_MOD, Button5, kscrolldown, {.i = 1}, 0, /* !alt */ -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 (ControlMask | ShiftMask)
static Shortcut shortcuts[] = {
/* mask keysym function argument */
{ XK_ANY_MOD, XK_Break, sendbreak, {.i = 0} },
{ ControlMask, XK_Print, toggleprinter, {.i = 0} },
{ ShiftMask, XK_Print, printscreen, {.i = 0} },
{ XK_ANY_MOD, XK_Print, printsel, {.i = 0} },
{ MODKEY|ShiftMask, XK_Prior, zoom, {.f = +1} },
{ MODKEY|ShiftMask, XK_Next, zoom, {.f = -1} },
{ MODKEY|ShiftMask, XK_Home, zoomreset, {.f = 0} },
{ ShiftMask, XK_Insert, selpaste, {.i = 0} },
{ MODKEY|ShiftMask, XK_Insert, clippaste, {.i = 0} },
{ MODKEY|ShiftMask, XK_C, clipcopy, {.i = 0} },
{ MODKEY|ShiftMask, XK_V, clippaste, {.i = 0} },
{ MODKEY, XK_Num_Lock, numlock, {.i = 0} },
// { MODKEY, XK_Control_L, iso14755, {.i = 0} },
{ ShiftMask, XK_Page_Up, kscrollup, {.i = -1} },
{ ShiftMask, XK_Page_Down, kscrolldown, {.i = -1} },
{ MODKEY, XK_k, kscrollup, {.i = 1} },
{ MODKEY, XK_j, kscrolldown, {.i = 1} },
{ MODKEY, XK_u, kscrollup, {.i = -1} },
{ MODKEY, XK_d, kscrolldown, {.i = -1} },
/* mask keysym function argument */
{XK_ANY_MOD, XK_Break, sendbreak, {.i = 0}},
{ControlMask, XK_Print, toggleprinter, {.i = 0}},
{ShiftMask, XK_Print, printscreen, {.i = 0}},
{XK_ANY_MOD, XK_Print, printsel, {.i = 0}},
{TERMMOD, XK_Prior, zoom, {.f = +1}},
{TERMMOD, XK_Next, zoom, {.f = -1}},
{TERMMOD, XK_Home, zoomreset, {.f = 0}},
{TERMMOD, XK_C, clipcopy, {.i = 0}},
{TERMMOD, XK_V, clippaste, {.i = 0}},
{TERMMOD, XK_Y, selpaste, {.i = 0}},
{ShiftMask, XK_Insert, selpaste, {.i = 0}},
{TERMMOD, XK_Num_Lock, numlock, {.i = 0}},
{ShiftMask, XK_Page_Up, kscrollup, {.i = -1}},
{ShiftMask, XK_Page_Down, kscrolldown, {.i = -1}},
};
/*
@ -206,10 +225,6 @@ static Shortcut shortcuts[] = {
* * 0: no value
* * > 0: cursor application mode enabled
* * < 0: cursor application mode disabled
* crlf value
* * 0: no value
* * > 0: crlf mode is enabled
* * < 0: crlf mode is 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
@ -220,236 +235,229 @@ static Shortcut shortcuts[] = {
* 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 };
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;
/*
* Override mouse-select 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 forceselmod = ShiftMask;
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},
/* 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},
};
/*
@ -460,14 +468,13 @@ static Key key[] = {
* If no match is found, regular selection is used.
*/
static uint selmasks[] = {
[SEL_RECTANGULAR] = Mod1Mask,
[SEL_RECTANGULAR] = Mod1Mask,
};
/*
* Printable characters in ASCII, used to estimate the advance width
* of single wide characters.
*/
static char ascii_printable[] =
" !\"#$%&'()*+,-./0123456789:;<=>?"
"@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_"
"`abcdefghijklmnopqrstuvwxyz{|}~";
static char ascii_printable[] = " !\"#$%&'()*+,-./0123456789:;<=>?"
"@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_"
"`abcdefghijklmnopqrstuvwxyz{|}~";

View File

@ -5,25 +5,23 @@
*
* font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html
*/
static char *font = "FuraCode Nerd Font Mono:style=Regular:pixelsize=12:antialias=true:autohint=true";
/* disable bold, italic and roman fonts globally */
int disablebold = 0;
int disableitalic = 0;
int disableroman = 0;
static char *font =
"FuraCode Nerd Font "
"Mono:style=Regular:pixelsize=12: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: utmp option
* 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 */
@ -36,9 +34,9 @@ static float chscale = 1.0;
/*
* word delimiter string
*
* More advanced example: " `'\"()[]{}"
* More advanced example: L" `'\"()[]{}"
*/
char *worddelimiters = " ";
wchar_t *worddelimiters = L" ";
/* selection timeouts (in milliseconds) */
static unsigned int doubleclicktimeout = 300;
@ -47,9 +45,18 @@ static unsigned int tripleclicktimeout = 600;
/* alt screens */
int allowaltscreen = 1;
/* frames per second st should at maximum draw to the screen */
static unsigned int xfps = 120;
static unsigned int actionfps = 30;
/* 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 = 8;
static double maxlatency = 33;
/*
* blinking timeout (set to 0 to disable blinking) for the terminal blinking
@ -69,7 +76,7 @@ static unsigned int cursorthickness = 2;
static int bellvolume = 0;
/* default TERM value */
char *termname = "xterm-256color";
char *termname = "st-256color";
/*
* spaces per tab
@ -93,32 +100,42 @@ float alpha = 0.8;
/* Terminal colors (16 first used in escape sequence) */
static const char *colorname[] = {
"#282828", /* hard contrast: #1d2021 / soft contrast: #32302f */
"#cc241d",
"#98971a",
"#d79921",
"#458588",
"#b16286",
"#689d6a",
"#a89984",
"#928374",
"#fb4934",
"#b8bb26",
"#fabd2f",
"#83a598",
"#d3869b",
"#8ec07c",
"#ebdbb2",
/* 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",
"black",
};
/*
* Default colors (colorname index)
* foreground, background, cursor, reverse cursor
*/
unsigned int defaultfg = 12;
unsigned int defaultfg = 7;
unsigned int defaultbg = 258;
static unsigned int defaultcs = 14;
static unsigned int defaultrcs = 15;
static unsigned int defaultcs = 256;
static unsigned int defaultrcs = 257;
/*
* Default shape of cursor
@ -149,46 +166,48 @@ static unsigned int mousebg = 0;
*/
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[] = {
/* button mask string */
{ Button4, XK_NO_MOD, "\031" },
{ Button5, XK_NO_MOD, "\005" },
};
MouseKey mkeys[] = {
/* button mask function argument */
{ Button4, ShiftMask, kscrollup, {.i = 1} },
{ Button5, ShiftMask, kscrolldown, {.i = 1} },
/* mask button function argument release */
{XK_ANY_MOD, Button4, kscrollup, {.i = 1}, 0, /* !alt */ -1},
{XK_ANY_MOD, Button5, kscrolldown, {.i = 1}, 0, /* !alt */ -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 (ControlMask | ShiftMask)
static Shortcut shortcuts[] = {
/* mask keysym function argument */
{ XK_ANY_MOD, XK_Break, sendbreak, {.i = 0} },
{ ControlMask, XK_Print, toggleprinter, {.i = 0} },
{ ShiftMask, XK_Print, printscreen, {.i = 0} },
{ XK_ANY_MOD, XK_Print, printsel, {.i = 0} },
{ MODKEY|ShiftMask, XK_Prior, zoom, {.f = +1} },
{ MODKEY|ShiftMask, XK_Next, zoom, {.f = -1} },
{ MODKEY|ShiftMask, XK_Home, zoomreset, {.f = 0} },
{ ShiftMask, XK_Insert, selpaste, {.i = 0} },
{ MODKEY|ShiftMask, XK_Insert, clippaste, {.i = 0} },
{ MODKEY|ShiftMask, XK_C, clipcopy, {.i = 0} },
{ MODKEY|ShiftMask, XK_V, clippaste, {.i = 0} },
{ MODKEY, XK_Num_Lock, numlock, {.i = 0} },
// { MODKEY, XK_Control_L, iso14755, {.i = 0} },
{ ShiftMask, XK_Page_Up, kscrollup, {.i = -1} },
{ ShiftMask, XK_Page_Down, kscrolldown, {.i = -1} },
{ MODKEY, XK_k, kscrollup, {.i = 1} },
{ MODKEY, XK_j, kscrolldown, {.i = 1} },
{ MODKEY, XK_u, kscrollup, {.i = -1} },
{ MODKEY, XK_d, kscrolldown, {.i = -1} },
/* mask keysym function argument */
{XK_ANY_MOD, XK_Break, sendbreak, {.i = 0}},
{ControlMask, XK_Print, toggleprinter, {.i = 0}},
{ShiftMask, XK_Print, printscreen, {.i = 0}},
{XK_ANY_MOD, XK_Print, printsel, {.i = 0}},
{TERMMOD, XK_Prior, zoom, {.f = +1}},
{TERMMOD, XK_Next, zoom, {.f = -1}},
{TERMMOD, XK_Home, zoomreset, {.f = 0}},
{TERMMOD, XK_C, clipcopy, {.i = 0}},
{TERMMOD, XK_V, clippaste, {.i = 0}},
{TERMMOD, XK_Y, selpaste, {.i = 0}},
{ShiftMask, XK_Insert, selpaste, {.i = 0}},
{TERMMOD, XK_Num_Lock, numlock, {.i = 0}},
{ShiftMask, XK_Page_Up, kscrollup, {.i = -1}},
{ShiftMask, XK_Page_Down, kscrolldown, {.i = -1}},
};
/*
@ -206,10 +225,6 @@ static Shortcut shortcuts[] = {
* * 0: no value
* * > 0: cursor application mode enabled
* * < 0: cursor application mode disabled
* crlf value
* * 0: no value
* * > 0: crlf mode is enabled
* * < 0: crlf mode is 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
@ -220,236 +235,229 @@ static Shortcut shortcuts[] = {
* 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 };
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;
/*
* Override mouse-select 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 forceselmod = ShiftMask;
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},
/* 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},
};
/*
@ -460,14 +468,13 @@ static Key key[] = {
* If no match is found, regular selection is used.
*/
static uint selmasks[] = {
[SEL_RECTANGULAR] = Mod1Mask,
[SEL_RECTANGULAR] = Mod1Mask,
};
/*
* Printable characters in ASCII, used to estimate the advance width
* of single wide characters.
*/
static char ascii_printable[] =
" !\"#$%&'()*+,-./0123456789:;<=>?"
"@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_"
"`abcdefghijklmnopqrstuvwxyz{|}~";
static char ascii_printable[] = " !\"#$%&'()*+,-./0123456789:;<=>?"
"@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_"
"`abcdefghijklmnopqrstuvwxyz{|}~";

View File

@ -1,43 +0,0 @@
diff -up a/config.def.h b/config.def.h
--- a/config.def.h
+++ b/config.def.h
@@ -6,6 +6,12 @@
* font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html
*/
static char *font = "Liberation Mono:pixelsize=12:antialias=true:autohint=true";
+
+/* disable bold, italic and roman fonts globally */
+int disablebold = 0;
+int disableitalic = 0;
+int disableroman = 0;
+
static int borderpx = 2;
/*
diff -up a/x.c b/x.c
--- a/x.c
+++ b/x.c
@@ -231,6 +231,11 @@ static char *usedfont = NULL;
static double usedfontsize = 0;
static double defaultfontsize = 0;
+/* declared in config.h */
+extern int disablebold;
+extern int disableitalic;
+extern int disableroman;
+
static char *opt_alpha = NULL;
static char *opt_class = NULL;
static char **opt_cmd = NULL;
@@ -979,7 +984,10 @@ xloadfonts(char *fontstr, double fontsiz
win.cyo = ceilf(dc.font.height * (chscale - 1) / 2);
FcPatternDel(pattern, FC_SLANT);
- FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ITALIC);
+ if (!disableitalic)
+ FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ITALIC);
+ if (!disableroman)
+ FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ROMAN);
if (xloadfont(&dc.ifont, pattern))
die("can't open font %s\n", fontstr);

View File

@ -1,4 +1,5 @@
diff -up a/config.def.h b/config.def.h
diff --git a/config.def.h b/config.def.h
index 0e01717..e116631 100644
--- a/config.def.h
+++ b/config.def.h
@@ -82,6 +82,9 @@ char *termname = "st-256color";
@ -28,7 +29,8 @@ diff -up a/config.def.h b/config.def.h
static unsigned int defaultcs = 256;
static unsigned int defaultrcs = 257;
diff -up a/config.mk b/config.mk
diff --git a/config.mk b/config.mk
index 0cbb002..1d2f0e2 100644
--- a/config.mk
+++ b/config.mk
@@ -16,7 +16,7 @@ PKG_CONFIG = pkg-config
@ -40,19 +42,20 @@ diff -up a/config.mk b/config.mk
`$(PKG_CONFIG) --libs fontconfig` \
`$(PKG_CONFIG) --libs freetype2`
diff -up a/st.h b/st.h
diff --git a/st.h b/st.h
index 38c61c4..b7634ab 100644
--- a/st.h
+++ b/st.h
@@ -129,4 +129,5 @@ extern char *termname;
@@ -120,3 +120,4 @@ extern char *termname;
extern unsigned int tabspaces;
extern unsigned int defaultfg;
extern unsigned int defaultbg;
+extern float alpha;
extern MouseKey mkeys[];
diff -up a/x.c b/x.c
diff --git a/x.c b/x.c
index 0422421..588dec3 100644
--- a/x.c
+++ b/x.c
@@ -99,6 +99,7 @@ typedef struct {
@@ -98,6 +98,7 @@ typedef struct {
XSetWindowAttributes attrs;
int scr;
int isfixed; /* is fixed geometry? */
@ -60,7 +63,7 @@ diff -up a/x.c b/x.c
int l, t; /* left and top offset */
int gm; /* geometry mask */
} XWindow;
@@ -230,6 +231,7 @@ static char *usedfont = NULL;
@@ -229,6 +230,7 @@ static char *usedfont = NULL;
static double usedfontsize = 0;
static double defaultfontsize = 0;
@ -68,7 +71,7 @@ diff -up a/x.c b/x.c
static char *opt_class = NULL;
static char **opt_cmd = NULL;
static char *opt_embed = NULL;
@@ -700,7 +702,7 @@ xresize(int col, int row)
@@ -688,7 +690,7 @@ xresize(int col, int row)
XFreePixmap(xw.dpy, xw.buf);
xw.buf = XCreatePixmap(xw.dpy, xw.win, win.w, win.h,
@ -77,7 +80,7 @@ diff -up a/x.c b/x.c
XftDrawChange(xw.draw, xw.buf);
xclear(0, 0, win.w, win.h);
@@ -760,6 +762,13 @@ xloadcols(void)
@@ -748,6 +750,13 @@ xloadcols(void)
else
die("could not allocate color %d\n", i);
}
@ -91,7 +94,7 @@ diff -up a/x.c b/x.c
loaded = 1;
}
@@ -1017,12 +1026,25 @@ xinit(int cols, int rows)
@@ -1004,11 +1013,23 @@ xinit(int cols, int rows)
Window parent;
pid_t thispid = getpid();
XColor xmousefg, xmousebg;
@ -101,8 +104,8 @@ diff -up a/x.c b/x.c
if (!(xw.dpy = XOpenDisplay(NULL)))
die("can't open display\n");
xw.scr = XDefaultScreen(xw.dpy);
xw.vis = XDefaultVisual(xw.dpy, xw.scr);
- 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;
@ -113,11 +116,10 @@ diff -up a/x.c b/x.c
+
+ XMatchVisualInfo(xw.dpy, xw.scr, xw.depth, TrueColor, &vis);
+ xw.vis = vis.visual;
+
/* font */
if (!FcInit())
die("could not init fontconfig.\n");
@@ -1031,7 +1053,7 @@ xinit(int cols, int rows)
@@ -1018,7 +1039,7 @@ xinit(int cols, int rows)
xloadfonts(usedfont, 0);
/* colors */
@ -126,7 +128,7 @@ diff -up a/x.c b/x.c
xloadcols();
/* adjust fixed window geometry */
@@ -1051,19 +1073,15 @@ xinit(int cols, int rows)
@@ -1038,19 +1059,15 @@ xinit(int cols, int rows)
| ButtonMotionMask | ButtonPressMask | ButtonReleaseMask;
xw.attrs.colormap = xw.cmap;
@ -149,7 +151,7 @@ diff -up a/x.c b/x.c
XSetForeground(xw.dpy, dc.gc, dc.col[defaultbg].pixel);
XFillRectangle(xw.dpy, xw.buf, dc.gc, 0, 0, win.w, win.h);
@@ -1907,6 +1925,9 @@ main(int argc, char *argv[])
@@ -1894,6 +1911,9 @@ main(int argc, char *argv[])
case 'a':
allowaltscreen = 0;
break;

View File

@ -1,22 +0,0 @@
diff --git a/x.c b/x.c
index 0422421..e00d930 100644
--- a/x.c
+++ b/x.c
@@ -627,6 +627,8 @@ setsel(char *str, Time t)
XSetSelectionOwner(xw.dpy, XA_PRIMARY, xw.win, t);
if (XGetSelectionOwner(xw.dpy, XA_PRIMARY) != xw.win)
selclear();
+
+ clipcopy(NULL);
}
void
@@ -644,7 +646,7 @@ brelease(XEvent *e)
}
if (e->xbutton.button == Button2)
- selpaste(NULL);
+ clippaste(NULL);
else if (e->xbutton.button == Button1)
mousesel(e, 1);
}

12
st-clipboard-0.8.3.diff Normal file
View File

@ -0,0 +1,12 @@
diff --git a/x.c b/x.c
index e5f1737..5cabd60 100644
--- a/x.c
+++ b/x.c
@@ -673,6 +673,7 @@ setsel(char *str, Time t)
XSetSelectionOwner(xw.dpy, XA_PRIMARY, xw.win, t);
if (XGetSelectionOwner(xw.dpy, XA_PRIMARY) != xw.win)
selclear();
+ clipcopy(NULL);
}
void

View File

@ -0,0 +1,307 @@
diff --git a/Makefile b/Makefile
index 470ac86..38240da 100644
--- a/Makefile
+++ b/Makefile
@@ -4,7 +4,7 @@
include config.mk
-SRC = st.c x.c
+SRC = st.c x.c hb.c
OBJ = $(SRC:.c=.o)
all: options st
@@ -22,7 +22,8 @@ config.h:
$(CC) $(STCFLAGS) -c $<
st.o: config.h st.h win.h
-x.o: arg.h config.h st.h win.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/config.mk b/config.mk
index ddc65ae..07a3d14 100644
--- a/config.mk
+++ b/config.mk
@@ -15,10 +15,12 @@ PKG_CONFIG = pkg-config
# includes and libs
INCS = -I$(X11INC) \
`$(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 fontconfig` \
- `$(PKG_CONFIG) --libs freetype2`
+ `$(PKG_CONFIG) --libs freetype2` \
+ `$(PKG_CONFIG) --libs harfbuzz`
# flags
STCPPFLAGS = -DVERSION=\"$(VERSION)\" -D_XOPEN_SOURCE=600
diff --git a/hb.c b/hb.c
new file mode 100644
index 0000000..7df2828
--- /dev/null
+++ b/hb.c
@@ -0,0 +1,136 @@
+#include <stdlib.h>
+#include <stdio.h>
+#include <math.h>
+#include <X11/Xft/Xft.h>
+#include <hb.h>
+#include <hb-ft.h>
+
+#include "st.h"
+
+void hbtransformsegment(XftFont *xfont, const Glyph *string, hb_codepoint_t *codepoints, int start, int length);
+hb_font_t *hbfindfont(XftFont *match);
+
+typedef struct {
+ XftFont *match;
+ hb_font_t *font;
+} HbFontMatch;
+
+static int hbfontslen = 0;
+static HbFontMatch *hbfontcache = NULL;
+
+void
+hbunloadfonts()
+{
+ for (int i = 0; i < hbfontslen; i++) {
+ hb_font_destroy(hbfontcache[i].font);
+ XftUnlockFace(hbfontcache[i].match);
+ }
+
+ if (hbfontcache != NULL) {
+ free(hbfontcache);
+ hbfontcache = NULL;
+ }
+ hbfontslen = 0;
+}
+
+hb_font_t *
+hbfindfont(XftFont *match)
+{
+ for (int i = 0; i < hbfontslen; i++) {
+ if (hbfontcache[i].match == match)
+ return hbfontcache[i].font;
+ }
+
+ /* Font not found in cache, caching it now. */
+ hbfontcache = realloc(hbfontcache, sizeof(HbFontMatch) * (hbfontslen + 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[hbfontslen].match = match;
+ hbfontcache[hbfontslen].font = font;
+ hbfontslen += 1;
+
+ return font;
+}
+
+void
+hbtransform(XftGlyphFontSpec *specs, const Glyph *glyphs, size_t len, int x, int y)
+{
+ int start = 0, length = 1, gstart = 0;
+ hb_codepoint_t *codepoints = calloc(len, sizeof(hb_codepoint_t));
+
+ for (int idx = 1, specidx = 1; idx < len; idx++) {
+ if (glyphs[idx].mode & ATTR_WDUMMY) {
+ length += 1;
+ continue;
+ }
+
+ if (specs[specidx].font != specs[start].font || ATTRCMP(glyphs[gstart], glyphs[idx]) || selected(x + idx, y) != selected(x + gstart, y)) {
+ hbtransformsegment(specs[start].font, glyphs, codepoints, gstart, length);
+
+ /* Reset the sequence. */
+ length = 1;
+ start = specidx;
+ gstart = idx;
+ } else {
+ length += 1;
+ }
+
+ specidx++;
+ }
+
+ /* EOL. */
+ hbtransformsegment(specs[start].font, glyphs, codepoints, gstart, length);
+
+ /* Apply the transformation to glyph specs. */
+ for (int i = 0, specidx = 0; i < len; i++) {
+ if (glyphs[i].mode & ATTR_WDUMMY)
+ continue;
+
+ if (codepoints[i] != specs[specidx].glyph)
+ ((Glyph *)glyphs)[i].mode |= ATTR_LIGA;
+
+ specs[specidx++].glyph = codepoints[i];
+ }
+
+ free(codepoints);
+}
+
+void
+hbtransformsegment(XftFont *xfont, const Glyph *string, hb_codepoint_t *codepoints, int start, int length)
+{
+ hb_font_t *font = hbfindfont(xfont);
+ if (font == NULL)
+ return;
+
+ Rune rune;
+ ushort mode = USHRT_MAX;
+ hb_buffer_t *buffer = hb_buffer_create();
+ hb_buffer_set_direction(buffer, HB_DIRECTION_LTR);
+
+ /* Fill buffer with codepoints. */
+ for (int i = start; i < (start+length); i++) {
+ rune = string[i].u;
+ mode = string[i].mode;
+ if (mode & ATTR_WDUMMY)
+ rune = 0x0020;
+ hb_buffer_add_codepoints(buffer, &rune, 1, 0, 1);
+ }
+
+ /* Shape the segment. */
+ hb_shape(font, buffer, NULL, 0);
+
+ /* Get new glyph info. */
+ hb_glyph_info_t *info = hb_buffer_get_glyph_infos(buffer, NULL);
+
+ /* Write new codepoints. */
+ for (int i = 0; i < length; i++) {
+ hb_codepoint_t gid = info[i].codepoint;
+ codepoints[start+i] = gid;
+ }
+
+ /* Cleanup. */
+ hb_buffer_destroy(buffer);
+}
diff --git a/hb.h b/hb.h
new file mode 100644
index 0000000..b3e02d0
--- /dev/null
+++ b/hb.h
@@ -0,0 +1,7 @@
+#include <X11/Xft/Xft.h>
+#include <hb.h>
+#include <hb-ft.h>
+
+void hbunloadfonts();
+void hbtransform(XftGlyphFontSpec *, const Glyph *, size_t, int, int);
+
diff --git a/st.c b/st.c
index 641edc0..14a0b66 100644
--- a/st.c
+++ b/st.c
@@ -2670,7 +2670,8 @@ draw(void)
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]);
+ term.ocx, term.ocy, term.line[term.ocy][term.ocx],
+ term.line[term.ocy], term.col);
term.ocx = cx;
term.ocy = term.c.y;
xfinishdraw();
diff --git a/st.h b/st.h
index 2b2ba94..01bfb05 100644
--- a/st.h
+++ b/st.h
@@ -11,7 +11,8 @@
#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 || \
+#define ATTRCMP(a, b) (((a).mode & (~ATTR_WRAP) & (~ATTR_LIGA)) != ((b).mode & (~ATTR_WRAP) & (~ATTR_LIGA)) || \
+ (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)
@@ -33,6 +34,7 @@ enum glyph_attribute {
ATTR_WRAP = 1 << 8,
ATTR_WIDE = 1 << 9,
ATTR_WDUMMY = 1 << 10,
+ ATTR_LIGA = 1 << 11,
ATTR_BOLD_FAINT = ATTR_BOLD | ATTR_FAINT,
};
diff --git a/win.h b/win.h
index a6ef1b9..bc0d180 100644
--- a/win.h
+++ b/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);
diff --git a/x.c b/x.c
index 50da23c..bec3e76 100644
--- a/x.c
+++ b/x.c
@@ -19,6 +19,7 @@ char *argv0;
#include "arg.h"
#include "st.h"
#include "win.h"
+#include "hb.h"
/* types used in config.h */
typedef struct {
@@ -1040,6 +1041,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);
@@ -1246,7 +1250,7 @@ xmakeglyphfontspecs(XftGlyphFontSpec *specs, const Glyph *glyphs, int len, int x
mode = glyphs[i].mode;
/* Skip dummy wide-character spacing. */
- if (mode == ATTR_WDUMMY)
+ if (mode & ATTR_WDUMMY)
continue;
/* Determine font for glyph if different from previous glyph. */
@@ -1353,6 +1357,9 @@ xmakeglyphfontspecs(XftGlyphFontSpec *specs, const Glyph *glyphs, int len, int x
numspecs++;
}
+ /* Harfbuzz transformation for ligatures. */
+ hbtransform(specs, glyphs, len, x, y);
+
return numspecs;
}
@@ -1502,14 +1509,17 @@ xdrawglyph(Glyph g, int x, int y)
}
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;

View File

@ -1,8 +1,8 @@
diff --git a/config.def.h b/config.def.h
index 823e79f..f6278a3 100644
index 0895a1f..eef24df 100644
--- a/config.def.h
+++ b/config.def.h
@@ -178,6 +178,8 @@ static Shortcut shortcuts[] = {
@@ -188,6 +188,8 @@ static Shortcut shortcuts[] = {
{ TERMMOD, XK_Y, selpaste, {.i = 0} },
{ ShiftMask, XK_Insert, selpaste, {.i = 0} },
{ TERMMOD, XK_Num_Lock, numlock, {.i = 0} },
@ -12,7 +12,7 @@ index 823e79f..f6278a3 100644
/*
diff --git a/st.c b/st.c
index b8e6077..218ae73 100644
index 0ce6ac2..641edc0 100644
--- a/st.c
+++ b/st.c
@@ -35,6 +35,7 @@
@ -26,7 +26,7 @@ index b8e6077..218ae73 100644
@@ -42,6 +43,9 @@
#define ISCONTROLC1(c) (BETWEEN(c, 0x80, 0x9f))
#define ISCONTROL(c) (ISCONTROLC0(c) || ISCONTROLC1(c))
#define ISDELIM(u) (utf8strchr(worddelimiters, u) != NULL)
#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])
@ -43,7 +43,7 @@ index b8e6077..218ae73 100644
int *dirty; /* dirtyness of lines */
TCursor c; /* cursor */
int ocx; /* old cursor col */
@@ -184,8 +191,8 @@ static void tnewline(int);
@@ -185,8 +192,8 @@ static void tnewline(int);
static void tputtab(int);
static void tputc(Rune);
static void treset(void);
@ -54,7 +54,7 @@ index b8e6077..218ae73 100644
static void tsetattr(int *, int);
static void tsetchar(Rune, Glyph *, int, int);
static void tsetdirt(int, int);
@@ -427,10 +434,10 @@ tlinelen(int y)
@@ -415,10 +422,10 @@ tlinelen(int y)
{
int i = term.col;
@ -67,7 +67,7 @@ index b8e6077..218ae73 100644
--i;
return i;
@@ -539,7 +546,7 @@ selsnap(int *x, int *y, int direction)
@@ -527,7 +534,7 @@ selsnap(int *x, int *y, int direction)
* Snap around if the word wraps around at the end or
* beginning of a line.
*/
@ -76,7 +76,7 @@ index b8e6077..218ae73 100644
prevdelim = ISDELIM(prevgp->u);
for (;;) {
newx = *x + direction;
@@ -554,14 +561,14 @@ selsnap(int *x, int *y, int direction)
@@ -542,14 +549,14 @@ selsnap(int *x, int *y, int direction)
yt = *y, xt = *x;
else
yt = newy, xt = newx;
@ -93,7 +93,7 @@ index b8e6077..218ae73 100644
delim = ISDELIM(gp->u);
if (!(gp->mode & ATTR_WDUMMY) && (delim != prevdelim
|| (delim && gp->u != prevgp->u)))
@@ -582,14 +589,14 @@ selsnap(int *x, int *y, int direction)
@@ -570,14 +577,14 @@ selsnap(int *x, int *y, int direction)
*x = (direction < 0) ? 0 : term.col - 1;
if (direction < 0) {
for (; *y > 0; *y += direction) {
@ -110,7 +110,7 @@ index b8e6077..218ae73 100644
& ATTR_WRAP)) {
break;
}
@@ -620,13 +627,13 @@ getsel(void)
@@ -608,13 +615,13 @@ getsel(void)
}
if (sel.type == SEL_RECTANGULAR) {
@ -192,7 +192,13 @@ index b8e6077..218ae73 100644
tsetdirt(orig, term.bot-n);
tclearregion(0, term.bot-n+1, term.col-1, term.bot);
@@ -1080,13 +1130,23 @@ tscrolldown(int orig, int n)
@@ -1076,17 +1126,28 @@ tscrolldown(int orig, int n)
term.line[i-n] = temp;
}
- selscroll(orig, n);
+ if (term.scr == 0)
+ selscroll(orig, n);
}
void
@ -217,7 +223,17 @@ index b8e6077..218ae73 100644
tclearregion(0, orig, term.col-1, orig+n-1);
tsetdirt(orig+n, term.bot);
@@ -1135,7 +1195,7 @@ tnewline(int first_col)
@@ -1096,7 +1157,8 @@ tscrollup(int orig, int n)
term.line[i+n] = temp;
}
- selscroll(orig, -n);
+ if (term.scr == 0)
+ selscroll(orig, -n);
}
void
@@ -1135,7 +1197,7 @@ tnewline(int first_col)
int y = term.c.y;
if (y == term.bot) {
@ -226,7 +242,7 @@ index b8e6077..218ae73 100644
} else {
y++;
}
@@ -1300,14 +1360,14 @@ void
@@ -1300,14 +1362,14 @@ void
tinsertblankline(int n)
{
if (BETWEEN(term.c.y, term.top, term.bot))
@ -243,7 +259,7 @@ index b8e6077..218ae73 100644
}
int32_t
@@ -1737,11 +1797,11 @@ csihandle(void)
@@ -1738,11 +1800,11 @@ csihandle(void)
break;
case 'S': /* SU -- Scroll <n> line up */
DEFAULT(csiescseq.arg[0], 1);
@ -257,7 +273,7 @@ index b8e6077..218ae73 100644
break;
case 'L': /* IL -- Insert <n> blank lines */
DEFAULT(csiescseq.arg[0], 1);
@@ -2243,7 +2303,7 @@ eschandle(uchar ascii)
@@ -2248,7 +2310,7 @@ eschandle(uchar ascii)
return 0;
case 'D': /* IND -- Linefeed */
if (term.c.y == term.bot) {
@ -266,7 +282,7 @@ index b8e6077..218ae73 100644
} else {
tmoveto(term.c.x, term.c.y+1);
}
@@ -2256,7 +2316,7 @@ eschandle(uchar ascii)
@@ -2261,7 +2323,7 @@ eschandle(uchar ascii)
break;
case 'M': /* RI -- Reverse index */
if (term.c.y == term.top) {
@ -275,7 +291,7 @@ index b8e6077..218ae73 100644
} else {
tmoveto(term.c.x, term.c.y-1);
}
@@ -2475,7 +2535,7 @@ twrite(const char *buf, int buflen, int show_ctrl)
@@ -2482,7 +2544,7 @@ twrite(const char *buf, int buflen, int show_ctrl)
void
tresize(int col, int row)
{
@ -284,7 +300,7 @@ index b8e6077..218ae73 100644
int minrow = MIN(row, term.row);
int mincol = MIN(col, term.col);
int *bp;
@@ -2512,6 +2572,14 @@ tresize(int col, int row)
@@ -2519,6 +2581,14 @@ tresize(int col, int row)
term.dirty = xrealloc(term.dirty, row * sizeof(*term.dirty));
term.tabs = xrealloc(term.tabs, col * sizeof(*term.tabs));
@ -299,7 +315,7 @@ index b8e6077..218ae73 100644
/* 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));
@@ -2569,7 +2637,7 @@ drawregion(int x1, int y1, int x2, int y2)
@@ -2577,7 +2647,7 @@ drawregion(int x1, int y1, int x2, int y2)
continue;
term.dirty[y] = 0;
@ -308,7 +324,7 @@ index b8e6077..218ae73 100644
}
}
@@ -2590,8 +2658,9 @@ draw(void)
@@ -2598,8 +2668,9 @@ draw(void)
cx--;
drawregion(0, 0, term.col, term.row);
@ -317,14 +333,14 @@ index b8e6077..218ae73 100644
+ 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]);
term.ocx = cx, term.ocy = term.c.y;
term.ocx = cx;
term.ocy = term.c.y;
xfinishdraw();
}
diff --git a/st.h b/st.h
index 38c61c4..17a79e0 100644
index d978458..b9a4eeb 100644
--- a/st.h
+++ b/st.h
@@ -80,6 +80,8 @@ void die(const char *, ...);
@@ -81,6 +81,8 @@ void die(const char *, ...);
void redraw(void);
void draw(void);

View File

@ -1,71 +0,0 @@
diff --git a/config.def.h b/config.def.h
index 27d42ca..feec7e2 100644
--- a/config.def.h
+++ b/config.def.h
@@ -156,8 +156,14 @@ static unsigned int defaultattr = 11;
*/
static MouseShortcut mshortcuts[] = {
/* button mask string */
- { Button4, XK_ANY_MOD, "\031" },
- { Button5, XK_ANY_MOD, "\005" },
+ { Button4, XK_NO_MOD, "\031" },
+ { Button5, XK_NO_MOD, "\005" },
+};
+
+MouseKey mkeys[] = {
+ /* button mask function argument */
+ { Button4, ShiftMask, kscrollup, {.i = 1} },
+ { Button5, ShiftMask, kscrolldown, {.i = 1} },
};
/* Internal keyboard shortcuts. */
diff --git a/st.h b/st.h
index 628e876..cdd25ae 100644
--- a/st.h
+++ b/st.h
@@ -81,6 +81,13 @@ typedef union {
const void *v;
} Arg;
+typedef struct {
+ uint b;
+ uint mask;
+ void (*func)(const Arg *);
+ const Arg arg;
+} MouseKey;
+
void die(const char *, ...);
void redraw(void);
void draw(void);
@@ -129,3 +136,4 @@ extern char *termname;
extern unsigned int tabspaces;
extern unsigned int defaultfg;
extern unsigned int defaultbg;
+extern MouseKey mkeys[];
diff --git a/x.c b/x.c
index d43a529..754d859 100644
--- a/x.c
+++ b/x.c
@@ -409,6 +409,7 @@ bpress(XEvent *e)
{
struct timespec now;
MouseShortcut *ms;
+ MouseKey *mk;
int snap;
if (IS_SET(MODE_MOUSE) && !(e->xbutton.state & forceselmod)) {
@@ -424,6 +425,14 @@ bpress(XEvent *e)
}
}
+ for (mk = mkeys; mk < mkeys + LEN(mkeys); mk++) {
+ if (e->xbutton.button == mk->b
+ && match(mk->mask, e->xbutton.state)) {
+ mk->func(&mk->arg);
+ return;
+ }
+ }
+
if (e->xbutton.button == Button1) {
/*
* If the user clicks below predefined timeouts specific

View File

@ -0,0 +1,13 @@
diff --git a/config.def.h b/config.def.h
index ec1b576..4b3bf15 100644
--- a/config.def.h
+++ b/config.def.h
@@ -163,6 +163,8 @@ static uint forcemousemod = ShiftMask;
*/
static MouseShortcut mshortcuts[] = {
/* mask button function argument release */
+ { ShiftMask, Button4, kscrollup, {.i = 1} },
+ { ShiftMask, Button5, kscrolldown, {.i = 1} },
{ XK_ANY_MOD, Button2, selpaste, {.i = 0}, 1 },
{ XK_ANY_MOD, Button4, ttysend, {.s = "\031"} },
{ XK_ANY_MOD, Button5, ttysend, {.s = "\005"} },

View File

@ -0,0 +1,63 @@
diff --git a/config.def.h b/config.def.h
index 4b3bf15..1986316 100644
--- a/config.def.h
+++ b/config.def.h
@@ -163,8 +163,8 @@ static uint forcemousemod = ShiftMask;
*/
static MouseShortcut mshortcuts[] = {
/* mask button function argument release */
- { ShiftMask, Button4, kscrollup, {.i = 1} },
- { ShiftMask, Button5, kscrolldown, {.i = 1} },
+ { XK_ANY_MOD, Button4, kscrollup, {.i = 1}, 0, /* !alt */ -1 },
+ { XK_ANY_MOD, Button5, kscrolldown, {.i = 1}, 0, /* !alt */ -1 },
{ XK_ANY_MOD, Button2, selpaste, {.i = 0}, 1 },
{ XK_ANY_MOD, Button4, ttysend, {.s = "\031"} },
{ XK_ANY_MOD, Button5, ttysend, {.s = "\005"} },
diff --git a/st.c b/st.c
index f8b6f67..dd4cb31 100644
--- st.c
+++ st.c
@@ -1045,6 +1045,11 @@ tnew(int col, int row)
treset();
}
+int tisaltscr(void)
+{
+ return IS_SET(MODE_ALTSCREEN);
+}
+
void
tswapscreen(void)
{
diff --git a/st.h b/st.h
index 1332cf1..f9ad815 100644
--- st.h
+++ st.h
@@ -89,6 +89,7 @@ void sendbreak(const Arg *);
void toggleprinter(const Arg *);
int tattrset(int);
+int tisaltscr(void);
void tnew(int, int);
void tresize(int, int);
void tsetdirtattr(int);
diff --git a/x.c b/x.c
index e5f1737..b8fbd7b 100644
--- x.c
+++ x.c
@@ -34,6 +34,7 @@ typedef struct {
void (*func)(const Arg *);
const Arg arg;
uint release;
+ int altscrn; /* 0: don't care, -1: not alt screen, 1: alt screen */
} MouseShortcut;
typedef struct {
@@ -446,6 +447,7 @@ mouseaction(XEvent *e, uint release)
for (ms = mshortcuts; ms < mshortcuts + LEN(mshortcuts); ms++) {
if (ms->release == release &&
ms->button == e->xbutton.button &&
+ (!ms->altscrn || (ms->altscrn == (tisaltscr() ? 1 : -1))) &&
(match(ms->mod, state) || /* exact or forced */
match(ms->mod, state & ~forcemousemod))) {
ms->func(&(ms->arg));