feat: upgraded to 0.8.4

This commit is contained in:
Ryan Kes 2020-11-28 12:17:22 +01:00
parent 5b53d50751
commit c414fa19e0
12 changed files with 760 additions and 798 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,26 @@ 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"
)
source=("http://dl.suckless.org/st/st-$pkgver.tar.gz"
"config.h"
"${_patches[@]}")
sha256sums=('aeb74e10aa11ed364e1bcc635a81a523119093e63befd2f231f8b0705b15bf35'
sha256sums=('d42d3ceceb4d6a65e32e90a5336e3d446db612c3fbd9ebc1780bc6c9a03346a6'
'2842d6e1030ff0afad7420c4a93062e6da4e498295222005eae2581a38c45913'
'7be1a09831f13361f5659aaad55110bde99b25c8ba826c11d1d7fcec21f32945'
'30c9bcec5801614dd5cc8b96f470d7431e83d5d2af87bb2305df60082e5ab4ed'
'3fb38940cc3bad3f9cd1e2a0796ebd0e48950a07860ecf8523a5afd0cd1b5a44'
'0f5ce33953abce74a9da3088ea35bf067a9a4cfeb9fe6ea9800268ce69e436c0'
'1e41fe17a5ef5a8194eea07422b49d815e2c2bb4d58d84771f793be423005310'
'319458d980195d18fa0f81a6898d58f8d046c5ff982ab872d741f54bb60e267d'
'cb87eb654985da46ff63663407184402393ad3d3013c8795570552fe56a15b9d'
'04e6a4696293f668260b2f54a7240e379dbfabbc209de07bd5d4d57e9f513360'
'67b1bdc717e3f7914d04f0c72bc8a3f6efe91790248611c0a2c2dc905bf206bd'
'59d5719a68e2f0e25c44b6ad9fab0d62ee8a6c5bcbcffb38176e9950cda16b15')
'9c5b4b4f23de80de78ca5ec3739dc6ce5e7f72666186cf4a9c6b614ac90fb285')
prepare() {
cd $srcdir/st-$pkgver

View file

@ -1,55 +1,32 @@
* 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/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]]
** 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]].

141
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,24 +166,31 @@ 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 */
@ -174,21 +198,16 @@ static Shortcut shortcuts[] = {
{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} },
{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}},
{ 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} },
{TERMMOD, XK_Num_Lock, numlock, {.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} },
};
/*
@ -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
@ -228,13 +243,6 @@ static KeySym mappedkeys[] = { -1 };
*/
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;
/*
* This is the huge key array which defines all compatibility to the Linux
* world. Please decide about changes wisely.
@ -467,7 +475,6 @@ static uint selmasks[] = {
* Printable characters in ASCII, used to estimate the advance width
* of single wide characters.
*/
static char ascii_printable[] =
" !\"#$%&'()*+,-./0123456789:;<=>?"
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,24 +166,31 @@ 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 */
@ -174,21 +198,16 @@ static Shortcut shortcuts[] = {
{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} },
{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}},
{ 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} },
{TERMMOD, XK_Num_Lock, numlock, {.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} },
};
/*
@ -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
@ -228,13 +243,6 @@ static KeySym mappedkeys[] = { -1 };
*/
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;
/*
* This is the huge key array which defines all compatibility to the Linux
* world. Please decide about changes wisely.
@ -467,7 +475,6 @@ static uint selmasks[] = {
* Printable characters in ASCII, used to estimate the advance width
* of single wide characters.
*/
static char ascii_printable[] =
" !\"#$%&'()*+,-./0123456789:;<=>?"
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

@ -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));