Suckless-st

From wikinotes
Revision as of 16:34, 1 January 2021 by Will (talk | contribs) (→‎Hotkeys)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

st is a termian emulator from the suckless project.
It is a simple and lightweight terminal, in addition to linux, I have successfully built it in windows, and on a OSX.
xterm is more universally available, and faster.

Documentation

homepage https://st.suckless.org/

Install

# download/extract
curl -O# https://dl.suckless.org/st/st-0.8.2.tar.gz
tar -xvf st-0.8.2.tar.gz

# compile/install
cd st
./configure
make
sudo make install

Configuration

Suckless st does not have any dynamic configuration. To make changes, you change the source-code and then recompile it. Most options you'll be interested in (keybindings, colours, fonts) can be found in config.h.

Font/shell

static char font[]  = "Droid Sans Mono:size=14:antialias=true";
static char shell[] = "/bin/zsh";

If UTF-8 characters are not being rendered, check that your /etc/locale.conf is set properly. See Also: Linux Fonts.

Colours

/* Terminal colors (16 first used in escape sequence) */
static const char *colorname[] = {
	/* 8 normal colors */

	"#000000",	//"black",
	"#A93025",	//	"red3",
	"#93d44f",	//	"green3",
	"#eab93d",	//	"yellow3",
	"#306a87",	//	"blue2",
	"#ce5c00",	//	"magenta3",
	"#89b6e2",	//	"cyan3",
	"#cccccc",	//	"gray90",

	/* 8 bright colors */
	"#555753",	//	"gray50",
	"#ff8d8d",	//	"red",
	"#40a030",	//	"green",
	"#ffc123",	//	"yellow",
	"#3465a9",	//	"#5c5cff",
	"#f57900",	//	"magenta",
	"#46a4ff",	//	"cyan",
	"#ffffff",	//	"white",

	[255] = 0,

	/* more colors can be added after 255 to use with DefaultXX */
	"#cccccc",
};

/*
 * Default colors (colorname index)
 * foreground, background, cursor
 */
static unsigned int defaultfg = 243;
static unsigned int defaultbg = 236;
static unsigned int defaultcs = 245;

Hotkeys

Use xev to retrieve keysym

static Shortcut shortcuts[] = {
	/* mask                 keysym          function        argument */

        /* hotkeys to resize fonts */
	{ ControlMask,          XK_Up,          xzoom,          {.i = +1} },
	{ ControlMask,          XK_Down,        xzoom,          {.i = -1} },

        /* paste */
	{ ShiftMask,            XK_Insert,      selpaste,       {.i =  0} },  /* shift-ins pastes selection buffer */
	{ MODKEY|ShiftMask,     XK_Insert,      clippaste,      {.i =  0} },  /* alt-shift-ins pastes clipboard */
	{ MODKEY|ControlMask,   XK_v,           clippaste,      {.i =  0} },  /* ctrl-alt-v pastes clipboard */

};