diff --git a/packages/st/config.def.h b/packages/st/config.def.h index 4b3bf15..e490ac1 100644 --- a/packages/st/config.def.h +++ b/packages/st/config.def.h @@ -5,8 +5,8 @@ * * 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; +static char *font = "-UNKN-Ttyp0-normal-normal-normal-*-17-*-*-*-m-*-iso10646-1"; +static int borderpx = 8; /* * What program is execed by st depends of these precedence rules: @@ -63,7 +63,7 @@ static unsigned int cursorthickness = 2; static int bellvolume = 0; /* default TERM value */ -char *termname = "st-256color"; +char *termname = "xterm-256color"; /* * spaces per tab @@ -84,42 +84,47 @@ unsigned int tabspaces = 8; /* Terminal colors (16 first used in escape sequence) */ static const char *colorname[] = { - /* 8 normal colors */ - "black", - "red3", - "green3", - "yellow3", - "blue2", - "magenta3", - "cyan3", - "gray90", - - /* 8 bright colors */ - "gray50", - "red", - "green", - "yellow", - "#5c5cff", - "magenta", - "cyan", - "white", - - [255] = 0, - - /* more colors can be added after 255 to use with DefaultXX */ - "#cccccc", - "#555555", + /* 8 normal colors */ + [0] = "#1d1f21", /* black */ + [1] = "#cc6666", /* red */ + [2] = "#b5bd68", /* green */ + [3] = "#f0c674", /* yellow */ + [4] = "#81a2be", /* blue */ + [5] = "#b294bb", /* magenta */ + [6] = "#8abeb7", /* cyan */ + [7] = "#c5c8c6", /* white */ + + /* 8 bright colors */ + [8] = "#969896", /* black */ + [9] = "#cc6666", /* red */ + [10] = "#b5bd68", /* green */ + [11] = "#f0c674", /* yellow */ + [12] = "#81a2be", /* blue */ + [13] = "#b294bb", /* magenta */ + [14] = "#8abeb7", /* cyan */ + [15] = "#ffffff", /* white */ + + /* special colors */ + [256] = "#1d1f21", /* background */ + [257] = "#c5c8c6", /* foreground */ }; - /* * Default colors (colorname index) - * foreground, background, cursor, reverse cursor + * foreground, background, cursor + */ +unsigned int defaultfg = 257; +unsigned int defaultbg = 256; +static unsigned int defaultcs = 257; +static unsigned int defaultrcs = 256; + +/* + * Colors used, when the specific fg == defaultfg. So in reverse mode this + * will reverse too. Another logic would only make the simple feature too + * complex. */ -unsigned int defaultfg = 7; -unsigned int defaultbg = 0; -static unsigned int defaultcs = 256; -static unsigned int defaultrcs = 257; +static unsigned int defaultitalic = 7; +static unsigned int defaultunderline = 7; /* * Default shape of cursor @@ -157,14 +162,51 @@ static unsigned int defaultattr = 11; */ static uint forcemousemod = ShiftMask; +/* + * Xresources preferences to load at startup + */ +ResourcePref resources[] = { + { "font", STRING, &font }, + { "black", STRING, &colorname[0] }, + { "red", STRING, &colorname[1] }, + { "green", STRING, &colorname[2] }, + { "yellow", STRING, &colorname[3] }, + { "blue", STRING, &colorname[4] }, + { "magenta", STRING, &colorname[5] }, + { "cyan", STRING, &colorname[6] }, + { "white", STRING, &colorname[7] }, + { "b_black", STRING, &colorname[8] }, + { "b_red", STRING, &colorname[9] }, + { "b_green", STRING, &colorname[10] }, + { "b_yellow", STRING, &colorname[11] }, + { "b_blue", STRING, &colorname[12] }, + { "b_magenta", STRING, &colorname[13] }, + { "b_cyan", STRING, &colorname[14] }, + { "b_white", STRING, &colorname[15] }, + { "background", STRING, &colorname[256] }, + { "foreground", STRING, &colorname[257] }, + { "cursorColor", STRING, &colorname[258] }, + { "termname", STRING, &termname }, + { "shell", STRING, &shell }, + { "xfps", INTEGER, &xfps }, + { "actionfps", INTEGER, &actionfps }, + { "blinktimeout", INTEGER, &blinktimeout }, + { "bellvolume", INTEGER, &bellvolume }, + { "tabspaces", INTEGER, &tabspaces }, + { "borderpx", INTEGER, &borderpx }, + { "cwscale", FLOAT, &cwscale }, + { "chscale", FLOAT, &chscale }, +}; + /* * Internal mouse shortcuts. * Beware that overloading Button1 will disable the selection. */ +const unsigned int mousescrollincrement = 3; static MouseShortcut mshortcuts[] = { /* mask button function argument release */ - { ShiftMask, Button4, kscrollup, {.i = 1} }, - { ShiftMask, Button5, kscrolldown, {.i = 1} }, + { XK_ANY_MOD, Button4, kscrollup, {.i = mousescrollincrement}, 0, /* !alt */ -1 }, + { XK_ANY_MOD, Button5, kscrolldown, {.i = mousescrollincrement}, 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/packages/st/config.h b/packages/st/config.h index ea25a09..e490ac1 100644 --- a/packages/st/config.h +++ b/packages/st/config.h @@ -202,10 +202,11 @@ ResourcePref resources[] = { * Internal mouse shortcuts. * Beware that overloading Button1 will disable the selection. */ +const unsigned int mousescrollincrement = 3; static MouseShortcut mshortcuts[] = { /* mask button function argument release */ - { Mod1Mask, Button4, kscrollup, {.i = 1} }, - { Mod1Mask, Button5, kscrolldown, {.i = 1} }, + { XK_ANY_MOD, Button4, kscrollup, {.i = mousescrollincrement}, 0, /* !alt */ -1 }, + { XK_ANY_MOD, Button5, kscrolldown, {.i = mousescrollincrement}, 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/packages/st/st.c b/packages/st/st.c index f8b6f67..dd4cb31 100644 --- a/packages/st/st.c +++ b/packages/st/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/packages/st/st.h b/packages/st/st.h index 1332cf1..f9ad815 100644 --- a/packages/st/st.h +++ b/packages/st/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/packages/st/x.c b/packages/st/x.c index 376f44f..3dd9bb2 100644 --- a/packages/st/x.c +++ b/packages/st/x.c @@ -35,6 +35,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 { @@ -460,6 +461,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));