Suckless-st

From wikinotes
Revision as of 06:52, 27 December 2021 by Will (talk | contribs)

st is a termial emulator from the suckless project.

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

# patch, if desired
curl -#O 'https://st.suckless.org/patches/alpha/st-alpha-0.8.2.diff'
patch -ruN -d st-0.8.2 < st-alpha-0.8.2.diff

# 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
 */
unsigned int defaultfg = 243;
unsigned int defaultbg = 236;
static unsigned int defaultcs = 245;
static unsigned int defaultrcs = 257;

Hotkeys

Use xev to retrieve keysym

static Shortcut shortcuts[] = {
	/* mask                 keysym          function        argument */
    /* resize fonts */
    { ControlMask,          XK_equal,       zoom,           {.f = +1} },
    { ControlMask,          XK_minus,       zoom,           {.f = -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 */
};