set some default options and clean up config.def.h

This commit is contained in:
Jakub 2023-01-11 10:12:31 -05:00
parent 9a71b0161e
commit 9d63797049

View File

@ -1,12 +1,8 @@
/* See LICENSE file for copyright and license details. */ /* See LICENSE file for copyright and license details. */
/* /* appearance */
* appearance static char *font = "Hack Nerd Font:pixelsize=14:antialias=true";
* static int borderpx = 0;
* font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html
*/
static char *font = "Liberation Mono:pixelsize=12:antialias=true:autohint=true";
static int borderpx = 2;
/* /*
* What program is execed by st depends of these precedence rules: * What program is execed by st depends of these precedence rules:
@ -16,8 +12,9 @@ static int borderpx = 2;
* 4: value of shell in /etc/passwd * 4: value of shell in /etc/passwd
* 5: value of shell in config.h * 5: value of shell in config.h
*/ */
static char *shell = "/bin/sh"; static char *shell = "/bin/zsh";
char *utmp = NULL; char *utmp = NULL;
/* scroll program: to enable use a string like "scroll" */ /* scroll program: to enable use a string like "scroll" */
char *scroll = NULL; char *scroll = NULL;
char *stty_args = "stty raw pass8 nl -echo -iexten -cstopb 38400"; char *stty_args = "stty raw pass8 nl -echo -iexten -cstopb 38400";
@ -29,11 +26,8 @@ char *vtiden = "\033[?6c";
static float cwscale = 1.0; static float cwscale = 1.0;
static float chscale = 1.0; static float chscale = 1.0;
/* /* word delimiter string
* word delimiter string * More advanced example: L" `'\"()[]{}" */
*
* More advanced example: L" `'\"()[]{}"
*/
wchar_t *worddelimiters = L" "; wchar_t *worddelimiters = L" ";
/* selection timeouts (in milliseconds) */ /* selection timeouts (in milliseconds) */
@ -47,30 +41,22 @@ int allowaltscreen = 1;
setting the clipboard text */ setting the clipboard text */
int allowwindowops = 0; int allowwindowops = 0;
/* /* draw latency range in ms - from new content/keypress/etc until drawing.
* 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 * 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. * 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. * low minlatency will tear/flicker more, as it can "detect" idle too early. */
*/
static double minlatency = 8; static double minlatency = 8;
static double maxlatency = 33; static double maxlatency = 33;
/* /* blinking timeout (set to 0 to disable blinking) for the terminal blinking
* blinking timeout (set to 0 to disable blinking) for the terminal blinking * attribute. */
* attribute.
*/
static unsigned int blinktimeout = 800; static unsigned int blinktimeout = 800;
/* /* thickness of underline and bar cursors */
* thickness of underline and bar cursors
*/
static unsigned int cursorthickness = 2; static unsigned int cursorthickness = 2;
/* /* bell volume. It must be a value between -100 and 100. Use 0 for disabling
* bell volume. It must be a value between -100 and 100. Use 0 for disabling it */
* it
*/
static int bellvolume = 0; static int bellvolume = 0;
/* default TERM value */ /* default TERM value */
@ -98,44 +84,46 @@ float alpha = 0.9;
/* Terminal colors (16 first used in escape sequence) */ /* Terminal colors (16 first used in escape sequence) */
static const char *colorname[] = { static const char *colorname[] = {
/* 8 normal colors */ /* 8 normal colors */
"black", "#282828",
"red3", "#cc241d",
"green3", "#98971a",
"yellow3", "#d79921",
"blue2", "#458588",
"magenta3", "#b16286",
"cyan3", "#689d6a",
"gray90", "#a89984",
/* 8 bright colors */ /* 8 bright colors */
"gray50", "#928374",
"red", "#fb4934",
"green", "#b8bb26",
"yellow", "#fabd2f",
"#5c5cff", "#83a598",
"magenta", "#d3869b",
"cyan", "#ebdbb2",
"white", "#8ec07c",
[255] = 0, [255] = 0,
/* more colors can be added after 255 to use with DefaultXX */ /* more colors can be added after 255 to use with DefaultXX */
"#cccccc", "#ebdbb2", /* default cursor color */
"#555555", "#555555", /* default rcs color */
"gray90", /* default foreground colour */ "#ebdbb2", /* default foreground color */
"black", /* default background colour */ "#1d2021", /* default background color */
}; };
/* /* Default colors (colorname index)
* Default colors (colorname index) foreground, background, cursor, reverse cursor */
* foreground, background, cursor, reverse cursor
*/
unsigned int defaultfg = 258;
unsigned int defaultbg = 259;
unsigned int defaultcs = 256; unsigned int defaultcs = 256;
static unsigned int defaultrcs = 257; static unsigned int defaultrcs = 257;
unsigned int defaultfg = 258;
unsigned int defaultbg = 259;
/* /*
* https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h4-Functions-using-CSI-_-ordered-by-the-final-character-lparen-s-rparen:CSI-Ps-SP-q.1D81 * https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h4-Functions-using-CSI-_-ordered-by-the-final-character-lparen-s-rparen:CSI-Ps-SP-q.1D81
@ -153,84 +141,66 @@ static unsigned int defaultrcs = 257;
static unsigned int cursorstyle = 1; static unsigned int cursorstyle = 1;
static Rune stcursor = 0x2603; /* snowman ("☃") */ static Rune stcursor = 0x2603; /* snowman ("☃") */
/* /* Default columns and rows numbers */
* Default columns and rows numbers
*/
static unsigned int cols = 80; static unsigned int cols = 80;
static unsigned int rows = 24; static unsigned int rows = 24;
/* /* Default colour and shape of the mouse cursor */
* Default colour and shape of the mouse cursor
*/
static unsigned int mouseshape = XC_xterm; static unsigned int mouseshape = XC_xterm;
static unsigned int mousefg = 7; static unsigned int mousefg = 7;
static unsigned int mousebg = 0; static unsigned int mousebg = 0;
/* /* Color used to display font attributes when fontconfig selected a font which
* Color used to display font attributes when fontconfig selected a font which doesn't match the ones requested. */
* doesn't match the ones requested.
*/
static unsigned int defaultattr = 11; static unsigned int defaultattr = 11;
/* /* Force mouse select/shortcuts while mask is active (when MODE_MOUSE is set).
* 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
* Note that if you want to use ShiftMask with selmasks, set this to an other modifier, set to 0 to not use it. */
* modifier, set to 0 to not use it.
*/
static uint forcemousemod = ShiftMask; static uint forcemousemod = ShiftMask;
/* /* Xresources preferences to load at startup */
* Xresources preferences to load at startup
*/
ResourcePref resources[] = { ResourcePref resources[] = {
{ "font", STRING, &font }, { "font", STRING, &font },
{ "color0", STRING, &colorname[0] }, { "color0", STRING, &colorname[0] },
{ "color1", STRING, &colorname[1] }, { "color1", STRING, &colorname[1] },
{ "color2", STRING, &colorname[2] }, { "color2", STRING, &colorname[2] },
{ "color3", STRING, &colorname[3] }, { "color3", STRING, &colorname[3] },
{ "color4", STRING, &colorname[4] }, { "color4", STRING, &colorname[4] },
{ "color5", STRING, &colorname[5] }, { "color5", STRING, &colorname[5] },
{ "color6", STRING, &colorname[6] }, { "color6", STRING, &colorname[6] },
{ "color7", STRING, &colorname[7] }, { "color7", STRING, &colorname[7] },
{ "color8", STRING, &colorname[8] }, { "color8", STRING, &colorname[8] },
{ "color9", STRING, &colorname[9] }, { "color9", STRING, &colorname[9] },
{ "color10", STRING, &colorname[10] }, { "color10", STRING, &colorname[10] },
{ "color11", STRING, &colorname[11] }, { "color11", STRING, &colorname[11] },
{ "color12", STRING, &colorname[12] }, { "color12", STRING, &colorname[12] },
{ "color13", STRING, &colorname[13] }, { "color13", STRING, &colorname[13] },
{ "color14", STRING, &colorname[14] }, { "color14", STRING, &colorname[14] },
{ "color15", STRING, &colorname[15] }, { "color15", STRING, &colorname[15] },
{ "cursorcolor", STRING, &colorname[256] }, { "cursorcolor", STRING, &colorname[256] },
{ "foreground", STRING, &colorname[258] }, { "foreground", STRING, &colorname[258] },
{ "background", STRING, &colorname[259] }, { "background", STRING, &colorname[259] },
{ "termname", STRING, &termname }, { "termname", STRING, &termname },
{ "shell", STRING, &shell }, { "shell", STRING, &shell },
{ "minlatency", INTEGER, &minlatency }, { "minlatency", INTEGER, &minlatency },
{ "maxlatency", INTEGER, &maxlatency }, { "maxlatency", INTEGER, &maxlatency },
{ "blinktimeout", INTEGER, &blinktimeout }, { "blinktimeout", INTEGER, &blinktimeout },
{ "bellvolume", INTEGER, &bellvolume }, { "bellvolume", INTEGER, &bellvolume },
{ "tabspaces", INTEGER, &tabspaces }, { "tabspaces", INTEGER, &tabspaces },
{ "borderpx", INTEGER, &borderpx }, { "borderpx", INTEGER, &borderpx },
{ "cwscale", FLOAT, &cwscale }, { "cwscale", FLOAT, &cwscale },
{ "chscale", FLOAT, &chscale }, { "chscale", FLOAT, &chscale },
{ "opacity", FLOAT, &alpha }, { "opacity", FLOAT, &alpha },
}; };
/* /* Internal mouse shortcuts.
* Internal mouse shortcuts. Beware that overloading Button1 will disable the se */
* Beware that overloading Button1 will disable the selection.
*/
const unsigned int mousescrollincrement = 1; const unsigned int mousescrollincrement = 1;
static MouseShortcut mshortcuts[] = { static MouseShortcut mshortcuts[] = {
/* mask button function argument release */ /* mask button function argument release */
{ ShiftMask, Button4, kscrollup, {.i = mousescrollincrement} }, { ShiftMask, Button4, kscrollup, {.i = mousescrollincrement} },
{ ShiftMask, Button5, kscrolldown, {.i = mousescrollincrement} }, { ShiftMask, Button5, kscrolldown, {.i = mousescrollincrement} },
{ 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. */ /* Internal keyboard shortcuts. */
@ -243,22 +213,22 @@ static char *copyoutput[] = { "/bin/sh", "-xc", "st-copyout", "externalpipe", NU
static Shortcut shortcuts[] = { static Shortcut shortcuts[] = {
/* mask keysym function argument */ /* mask keysym function argument */
{ XK_ANY_MOD, XK_Break, sendbreak, {.i = 0} }, { XK_ANY_MOD, XK_Break, sendbreak, {.i = 0} },
{ ControlMask, XK_Print, toggleprinter, {.i = 0} }, { ControlMask, XK_Print, toggleprinter, {.i = 0} },
{ ShiftMask, XK_Print, printscreen, {.i = 0} }, { ShiftMask, XK_Print, printscreen, {.i = 0} },
{ XK_ANY_MOD, XK_Print, printsel, {.i = 0} }, { XK_ANY_MOD, XK_Print, printsel, {.i = 0} },
{ TERMMOD, XK_Prior, zoom, {.f = +1} }, { TERMMOD, XK_Prior, zoom, {.f = +1} },
{ TERMMOD, XK_Next, zoom, {.f = -1} }, { TERMMOD, XK_Next, zoom, {.f = -1} },
{ TERMMOD, XK_Home, zoomreset, {.f = 0} }, { TERMMOD, XK_Home, zoomreset, {.f = 0} },
{ TERMMOD, XK_C, clipcopy, {.i = 0} }, { TERMMOD, XK_C, clipcopy, {.i = 0} },
{ TERMMOD, XK_V, clippaste, {.i = 0} }, { TERMMOD, XK_V, clippaste, {.i = 0} },
{ TERMMOD, XK_Y, selpaste, {.i = 0} }, { TERMMOD, XK_Y, selpaste, {.i = 0} },
{ ShiftMask, XK_Insert, selpaste, {.i = 0} }, { ShiftMask, XK_Insert, selpaste, {.i = 0} },
{ TERMMOD, XK_Num_Lock, numlock, {.i = 0} }, { TERMMOD, XK_Num_Lock, numlock, {.i = 0} },
{ MODKEY, XK_l, externalpipe, {.v = openurlcmd } }, { MODKEY, XK_l, externalpipe, {.v = openurlcmd } },
{ MODKEY, XK_y, externalpipe, {.v = copyurlcmd } }, { MODKEY, XK_y, externalpipe, {.v = copyurlcmd } },
{ MODKEY, XK_o, externalpipe, {.v = copyoutput } }, { MODKEY, XK_o, externalpipe, {.v = copyoutput } },
{ ShiftMask, XK_Page_Up, kscrollup, {.i = -1} }, { ShiftMask, XK_Page_Up, kscrollup, {.i = -1} },
{ ShiftMask, XK_Page_Down, kscrolldown, {.i = -1} }, { ShiftMask, XK_Page_Down, kscrolldown, {.i = -1} },
}; };
@ -283,22 +253,16 @@ static Shortcut shortcuts[] = {
* position for a key. * position for a key.
*/ */
/* /* If you want keys other than the X11 function keys (0xFD00 - 0xFFFF)
* If you want keys other than the X11 function keys (0xFD00 - 0xFFFF) * to be mapped below, add them to this array. */
* 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,
* State bits to ignore when matching key or button events. By default, * numlock (Mod2Mask) and keyboard layout (XK_SWITCH_MOD) are ignored. */
* numlock (Mod2Mask) and keyboard layout (XK_SWITCH_MOD) are ignored.
*/
static uint ignoremod = Mod2Mask|XK_SWITCH_MOD; static uint ignoremod = Mod2Mask|XK_SWITCH_MOD;
/* /* This is the huge key array which defines all compatibility to the Linux
* This is the huge key array which defines all compatibility to the Linux * world. Please decide about changes wisely. */
* world. Please decide about changes wisely.
*/
static Key key[] = { static Key key[] = {
/* keysym mask string appkey appcursor */ /* keysym mask string appkey appcursor */
{ XK_KP_Home, ShiftMask, "\033[2J", 0, -1}, { XK_KP_Home, ShiftMask, "\033[2J", 0, -1},
@ -512,21 +476,17 @@ static Key key[] = {
{ XK_F35, XK_NO_MOD, "\033[23;5~", 0, 0}, { XK_F35, XK_NO_MOD, "\033[23;5~", 0, 0},
}; };
/* /* Selection types' masks.
* Selection types' masks. Use the same masks as usual.
* Use the same masks as usual. Button1Mask is always unset, to make masks match between ButtonPress.
* Button1Mask is always unset, to make masks match between ButtonPress. ButtonRelease and MotionNotify.
* ButtonRelease and MotionNotify. If no match is found, regular selection is used. */
* If no match is found, regular selection is used.
*/
static uint selmasks[] = { static uint selmasks[] = {
[SEL_RECTANGULAR] = Mod1Mask, [SEL_RECTANGULAR] = Mod1Mask,
}; };
/* /* Printable characters in ASCII, used to estimate the advance width
* Printable characters in ASCII, used to estimate the advance width of single wide characters. */
* of single wide characters.
*/
static char ascii_printable[] = static char ascii_printable[] =
" !\"#$%&'()*+,-./0123456789:;<=>?" " !\"#$%&'()*+,-./0123456789:;<=>?"
"@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_" "@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_"