Add gruvbox both themes
This commit is contained in:
parent
92e27fef1c
commit
956ac898e2
5 changed files with 149 additions and 62 deletions
|
@ -1,6 +1,6 @@
|
|||
# st - simple terminal emulator for X
|
||||
|
||||
This is the terminal that I use every day, and maybe it will work for you too.
|
||||
This is a terminal that I use everyday, and maybe it will work for you too.
|
||||
|
||||
+ Based on [st-0.9](https://st.suckless.org/) with patches from 0.8.5
|
||||
+ Default theme: [gruvbox](https://github.com/morhetz/gruvbox)
|
||||
|
@ -9,6 +9,7 @@ This is the terminal that I use every day, and maybe it will work for you too.
|
|||
|
||||
## Bindings
|
||||
|
||||
+ **Swap theme (dark|light)** : with `F11`
|
||||
+ **Scrollback**: with `shift-↑/↓`
|
||||
+ **Scrollback mouse**: `shift` while scrolling the mouse
|
||||
+ **Change font size**:`ctrl+shift-↑/↓`
|
||||
|
|
116
config.def.h
116
config.def.h
|
@ -5,7 +5,13 @@
|
|||
*
|
||||
* font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html
|
||||
*/
|
||||
static char *font = "Liberation Mono:pixelsize=12:antialias=true:autohint=true";
|
||||
static char *font = "FantasqueSansMono:pixelsize=18:antialias=true:autohint=true";
|
||||
|
||||
/* Spare fonts */
|
||||
static char *font2[] = {
|
||||
"Source Code Pro:pixelsize=16:antialias=true:autohint=true",
|
||||
};
|
||||
|
||||
static int borderpx = 2;
|
||||
|
||||
/*
|
||||
|
@ -16,7 +22,7 @@ static int borderpx = 2;
|
|||
* 4: value of shell in /etc/passwd
|
||||
* 5: value of shell in config.h
|
||||
*/
|
||||
static char *shell = "/bin/sh";
|
||||
static char *shell = "/bin/zsh";
|
||||
char *utmp = NULL;
|
||||
/* scroll program: to enable use a string like "scroll" */
|
||||
char *scroll = NULL;
|
||||
|
@ -93,29 +99,51 @@ char *termname = "st-256color";
|
|||
*/
|
||||
unsigned int tabspaces = 8;
|
||||
|
||||
/* bg opacity */
|
||||
float alpha = 0.8;
|
||||
|
||||
/* Apprentice colorscheme */
|
||||
/* Terminal colors (16 first used in escape sequence) */
|
||||
static const char *colorname[] = {
|
||||
/* 8 normal colors */
|
||||
[0] = "#fbf1c7", /* hard contrast: #f9f5d7 / soft contrast: #f2e5bc */
|
||||
[1] = "#cc241d", /* red */
|
||||
[2] = "#98971a", /* green */
|
||||
[3] = "#d79921", /* yellow */
|
||||
[4] = "#458588", /* blue */
|
||||
[5] = "#b16286", /* magenta */
|
||||
[6] = "#689d6a", /* cyan */
|
||||
[7] = "#7c6f64", /* white */
|
||||
|
||||
/* 8 bright colors */
|
||||
[8] = "#928374", /* black */
|
||||
[9] = "#9d0006", /* red */
|
||||
[10] = "#79740e", /* green */
|
||||
[11] = "#b57614", /* yellow */
|
||||
[12] = "#076678", /* blue */
|
||||
[13] = "#8f3f71", /* magenta */
|
||||
[14] = "#427b58", /* cyan */
|
||||
[15] = "#3c3836", /* white */
|
||||
/* gruvbox dark */
|
||||
"#32302f", /* hard contrast: #1d2021 / soft contrast: #32302f */
|
||||
"#cc241d", /* red */
|
||||
"#98971a", /* green */
|
||||
"#d79921", /* yellow */
|
||||
"#458588", /* blue */
|
||||
"#b16286", /* magenta */
|
||||
"#689d6a", /* cyan */
|
||||
"#a89984", /* white */
|
||||
"#928374", /* black */
|
||||
"#fb4934", /* red */
|
||||
"#b8bb26", /* green */
|
||||
"#fabd2f", /* yellow */
|
||||
"#83a598", /* blue */
|
||||
"#d3869b", /* magenta */
|
||||
"#8ec07c", /* cyan */
|
||||
"#ebdbb2", /* white */
|
||||
};
|
||||
|
||||
/* Terminal colors for alternate (light) palette */
|
||||
static const char *altcolorname[] = {
|
||||
/* gruvbox light */
|
||||
"#fbf1c7", /* hard contrast: #f9f5d7 / soft contrast: #f2e5bc */
|
||||
"#cc241d", /* red */
|
||||
"#98971a", /* green */
|
||||
"#d79921", /* yellow */
|
||||
"#458588", /* blue */
|
||||
"#b16286", /* magenta */
|
||||
"#689d6a", /* cyan */
|
||||
"#7c6f64", /* white */
|
||||
"#928374", /* black */
|
||||
"#9d0006", /* red */
|
||||
"#79740e", /* green */
|
||||
"#b57614", /* yellow */
|
||||
"#076678", /* blue */
|
||||
"#8f3f71", /* magenta */
|
||||
"#427b58", /* cyan */
|
||||
"#3c3836", /* white */
|
||||
};
|
||||
|
||||
/*
|
||||
* Default colors (colorname index)
|
||||
|
@ -126,6 +154,14 @@ unsigned int defaultbg = 0;
|
|||
unsigned int defaultcs = 15;
|
||||
static unsigned int defaultrcs = 257;
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
static unsigned int defaultitalic = 7;
|
||||
static unsigned int defaultunderline = 7;
|
||||
|
||||
/*
|
||||
* Default shape of cursor
|
||||
* 2: Block ("█")
|
||||
|
@ -138,9 +174,8 @@ static unsigned int cursorshape = 2;
|
|||
/*
|
||||
* Default columns and rows numbers
|
||||
*/
|
||||
|
||||
static unsigned int cols = 80;
|
||||
static unsigned int rows = 24;
|
||||
static unsigned int cols = 110;
|
||||
static unsigned int rows = 30;
|
||||
|
||||
/*
|
||||
* Default colour and shape of the mouse cursor
|
||||
|
@ -162,37 +197,52 @@ static unsigned int defaultattr = 11;
|
|||
*/
|
||||
static uint forcemousemod = ShiftMask;
|
||||
|
||||
static char *openurlcmd[] = { "/bin/sh", "-c",
|
||||
"xurls | rofi -dmenu -l 10 -columns 1 | xargs -r xdg-open",
|
||||
"externalpipe", NULL };
|
||||
|
||||
/*
|
||||
* Internal mouse shortcuts.
|
||||
* Beware that overloading Button1 will disable the selection.
|
||||
*/
|
||||
static MouseShortcut mshortcuts[] = {
|
||||
/* mask button function argument release */
|
||||
{ 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"} },
|
||||
/* button mask function release */
|
||||
{ Button4, XK_NO_MOD, ttysend, {.s = "\031"} },
|
||||
{ Button5, XK_NO_MOD, ttysend, {.s = "\005"} },
|
||||
{ Button4, ShiftMask, ttysend, {.s = "\033[5;2~"} },
|
||||
{ Button5, ShiftMask, ttysend, {.s = "\033[6;2~"} },
|
||||
};
|
||||
|
||||
/* Internal keyboard shortcuts. */
|
||||
#define MODKEY Mod1Mask
|
||||
#define TERMMOD (ControlMask|ShiftMask)
|
||||
|
||||
MouseKey mkeys[] = {
|
||||
/* button mask function argument */
|
||||
{ Button4, ShiftMask, kscrollup, {.i = 1} },
|
||||
{ Button5, ShiftMask, kscrolldown, {.i = 1} },
|
||||
{ Button4, TERMMOD, zoom, {.f = +1} },
|
||||
{ Button5, TERMMOD, zoom, {.f = -1} },
|
||||
};
|
||||
|
||||
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} },
|
||||
{ TERMMOD, XK_Prior, zoom, {.f = +1} },
|
||||
{ TERMMOD, XK_Next, zoom, {.f = -1} },
|
||||
{ TERMMOD, XK_Up, zoom, {.f = +1} },
|
||||
{ TERMMOD, XK_Down, 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_Insert, selpaste, {.i = 0} },
|
||||
{ TERMMOD, XK_Num_Lock, numlock, {.i = 0} },
|
||||
{ TERMMOD, XK_U, externalpipe, { .v = openurlcmd } },
|
||||
{ ShiftMask, XK_Up, kscrollup, {.i = -1} },
|
||||
{ ShiftMask, XK_Down, kscrolldown, {.i = -1} },
|
||||
{ XK_ANY_MOD, XK_F11, swapcolors, {.i = 0} },
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
59
config.h
59
config.h
|
@ -97,7 +97,7 @@ char *termname = "st-256color";
|
|||
*
|
||||
* stty tabs
|
||||
*/
|
||||
unsigned int tabspaces = 4;
|
||||
unsigned int tabspaces = 8;
|
||||
|
||||
/* bg opacity */
|
||||
float alpha = 0.8;
|
||||
|
@ -105,26 +105,44 @@ float alpha = 0.8;
|
|||
/* Apprentice colorscheme */
|
||||
/* Terminal colors (16 first used in escape sequence) */
|
||||
static const char *colorname[] = {
|
||||
/* gruvbox dark */
|
||||
"#32302f", /* hard contrast: #1d2021 / soft contrast: #32302f */
|
||||
"#cc241d", /* red */
|
||||
"#98971a", /* green */
|
||||
"#d79921", /* yellow */
|
||||
"#458588", /* blue */
|
||||
"#b16286", /* magenta */
|
||||
"#689d6a", /* cyan */
|
||||
"#a89984", /* white */
|
||||
"#928374", /* black */
|
||||
"#fb4934", /* red */
|
||||
"#b8bb26", /* green */
|
||||
"#fabd2f", /* yellow */
|
||||
"#83a598", /* blue */
|
||||
"#d3869b", /* magenta */
|
||||
"#8ec07c", /* cyan */
|
||||
"#ebdbb2", /* white */
|
||||
};
|
||||
|
||||
/* 8 normal colors */
|
||||
[0] = "#32302f", /* hard contrast: #1d2021 / soft contrast: #32302f */
|
||||
[1] = "#cc241d", /* red */
|
||||
[2] = "#98971a", /* green */
|
||||
[3] = "#d79921", /* yellow */
|
||||
[4] = "#458588", /* blue */
|
||||
[5] = "#b16286", /* magenta */
|
||||
[6] = "#689d6a", /* cyan */
|
||||
[7] = "#a89984", /* white */
|
||||
|
||||
/* 8 bright colors */
|
||||
[8] = "#928374", /* black */
|
||||
[9] = "#fb4934", /* red */
|
||||
[10] = "#b8bb26", /* green */
|
||||
[11] = "#fabd2f", /* yellow */
|
||||
[12] = "#83a598", /* blue */
|
||||
[13] = "#d3869b", /* magenta */
|
||||
[14] = "#8ec07c", /* cyan */
|
||||
[15] = "#ebdbb2", /* white */
|
||||
/* Terminal colors for alternate (light) palette */
|
||||
static const char *altcolorname[] = {
|
||||
/* gruvbox light */
|
||||
"#fbf1c7", /* hard contrast: #f9f5d7 / soft contrast: #f2e5bc */
|
||||
"#cc241d", /* red */
|
||||
"#98971a", /* green */
|
||||
"#d79921", /* yellow */
|
||||
"#458588", /* blue */
|
||||
"#b16286", /* magenta */
|
||||
"#689d6a", /* cyan */
|
||||
"#7c6f64", /* white */
|
||||
"#928374", /* black */
|
||||
"#9d0006", /* red */
|
||||
"#79740e", /* green */
|
||||
"#b57614", /* yellow */
|
||||
"#076678", /* blue */
|
||||
"#8f3f71", /* magenta */
|
||||
"#427b58", /* cyan */
|
||||
"#3c3836", /* white */
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -224,6 +242,7 @@ static Shortcut shortcuts[] = {
|
|||
{ TERMMOD, XK_U, externalpipe, { .v = openurlcmd } },
|
||||
{ ShiftMask, XK_Up, kscrollup, {.i = -1} },
|
||||
{ ShiftMask, XK_Down, kscrolldown, {.i = -1} },
|
||||
{ XK_ANY_MOD, XK_F11, swapcolors, {.i = 0} },
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
1
st.h
1
st.h
|
@ -130,6 +130,7 @@ extern wchar_t *worddelimiters;
|
|||
extern int allowaltscreen;
|
||||
extern int allowwindowops;
|
||||
extern char *termname;
|
||||
extern int usealtcolors;
|
||||
extern unsigned int tabspaces;
|
||||
extern unsigned int defaultfg;
|
||||
extern unsigned int defaultbg;
|
||||
|
|
26
x.c
26
x.c
|
@ -55,6 +55,7 @@ static void clipcopy(const Arg *);
|
|||
static void clippaste(const Arg *);
|
||||
static void numlock(const Arg *);
|
||||
static void selpaste(const Arg *);
|
||||
static void swapcolors(const Arg *);
|
||||
static void zoom(const Arg *);
|
||||
static void zoomabs(const Arg *);
|
||||
static void zoomreset(const Arg *);
|
||||
|
@ -258,6 +259,8 @@ static char *opt_title = NULL;
|
|||
|
||||
static uint buttons; /* bit field of pressed buttons */
|
||||
|
||||
int usealtcolors = 0; /* 1 to use alternate palette */
|
||||
|
||||
void
|
||||
clipcopy(const Arg *dummy)
|
||||
{
|
||||
|
@ -296,6 +299,14 @@ numlock(const Arg *dummy)
|
|||
win.mode ^= MODE_NUMLOCK;
|
||||
}
|
||||
|
||||
void
|
||||
swapcolors(const Arg *dummy)
|
||||
{
|
||||
usealtcolors = !usealtcolors;
|
||||
xloadcols();
|
||||
redraw();
|
||||
}
|
||||
|
||||
void
|
||||
zoom(const Arg *arg)
|
||||
{
|
||||
|
@ -783,6 +794,11 @@ sixd_to_16bit(int x)
|
|||
return x == 0 ? 0 : 0x3737 + 0x2828 * x;
|
||||
}
|
||||
|
||||
const char* getcolorname(int i)
|
||||
{
|
||||
return (usealtcolors) ? altcolorname[i] : colorname[i];
|
||||
}
|
||||
|
||||
int
|
||||
xloadcolor(int i, const char *name, Color *ncolor)
|
||||
{
|
||||
|
@ -801,7 +817,7 @@ xloadcolor(int i, const char *name, Color *ncolor)
|
|||
return XftColorAllocValue(xw.dpy, xw.vis,
|
||||
xw.cmap, &color, ncolor);
|
||||
} else
|
||||
name = colorname[i];
|
||||
name = getcolorname(i);
|
||||
}
|
||||
|
||||
return XftColorAllocName(xw.dpy, xw.vis, xw.cmap, name, ncolor);
|
||||
|
@ -824,8 +840,8 @@ xloadcols(void)
|
|||
|
||||
for (i = 0; i < dc.collen; i++)
|
||||
if (!xloadcolor(i, NULL, &dc.col[i])) {
|
||||
if (colorname[i])
|
||||
die("could not allocate color '%s'\n", colorname[i]);
|
||||
if (getcolorname(i))
|
||||
die("could not allocate color '%s'\n", getcolorname(i));
|
||||
else
|
||||
die("could not allocate color %d\n", i);
|
||||
}
|
||||
|
@ -1332,13 +1348,13 @@ xinit(int cols, int rows)
|
|||
cursor = XCreateFontCursor(xw.dpy, mouseshape);
|
||||
XDefineCursor(xw.dpy, xw.win, cursor);
|
||||
|
||||
if (XParseColor(xw.dpy, xw.cmap, colorname[mousefg], &xmousefg) == 0) {
|
||||
if (XParseColor(xw.dpy, xw.cmap, getcolorname(mousefg), &xmousefg) == 0) {
|
||||
xmousefg.red = 0xffff;
|
||||
xmousefg.green = 0xffff;
|
||||
xmousefg.blue = 0xffff;
|
||||
}
|
||||
|
||||
if (XParseColor(xw.dpy, xw.cmap, colorname[mousebg], &xmousebg) == 0) {
|
||||
if (XParseColor(xw.dpy, xw.cmap, getcolorname(mousebg), &xmousebg) == 0) {
|
||||
xmousebg.red = 0x0000;
|
||||
xmousebg.green = 0x0000;
|
||||
xmousebg.blue = 0x0000;
|
||||
|
|
Loading…
Add table
Reference in a new issue