Skip to content

Commit

Permalink
Added documentation for anygeometry patch
Browse files Browse the repository at this point in the history
* Added manpage entries for how to use the -G option

* Whole bunch of changes to README, such as: adding instruction for
  installation on Nix/NixOS, credits for all the patches, misc. typo
  fixes and clarifications.
  • Loading branch information
cjpbirkbeck committed Jul 30, 2021
1 parent 24b4a82 commit 0a7f953
Show file tree
Hide file tree
Showing 3 changed files with 114 additions and 18 deletions.
116 changes: 102 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,98 @@
# st (the simple terminal)
Here is a patched version of the [simple terminal](http://st.suckless.org/) by [suckless](http://www.suckless.org/), "a simple terminal emulator for X which sucks less". Generally, I mostly use it with [tmux](https://github.com/tmux/tmux/wiki), but it works perfectly fine without it.

# Requirements
## Requirements

* libX11: Basic Xorg headers
* libXft: font rendering libraries
* libXcursor: for a themed cursor

# Installation
## Installation

Edit config.mk to match your local setup (st is installed into the /usr/local namespace by default).

Afterwards enter the following command to build and install st (if necessary as root):

`make clean install`

# Patches
### Nix/NixOS

For users of either [the nix package manager or NixOS](https://www.nixos.org) can use the following default.nix to compile st into the nix store with `nix-build`. Based of an old version of [the default in nixpkgs](https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/terminal-emulators/st/default.nix), so probably not the best version of this code but it works.

```nix
rec {
pkgs = import <nixpkgs> {};
patches = [];
conf = null;
extraLibs = [];
libX11 = pkgs.xorg.libX11;
libXft = pkgs.xorg.libXft;
libXcursor = pkgs.xorg.libXcursor;
cjpb-st = with pkgs; stdenv.mkDerivation rec {
name = "st-0.8.3";
src = ./.;
inherit patches;
nativeBuildInputs = [ pkgconfig ncurses ];
buildInputs = [ libX11 libXft libXcursor ] ++ extraLibs;
preBuild = ''
sed -i -e '/share\/applications/d' Makefile
'';
installPhase = ''
TERMINFO=$out/share/terminfo make install PREFIX=$out
'';
};
}
```

To install st in the nix store in NixOS, you can add the following override:

```nix
{ pkgs, config, ... }:
{
nixpkgs.config.packageOverrides = pkgs: with pkgs; rec {
st_patched = st.overrideAttrs ( oldAttr: rec {
src = fetchFromGitHub {
owner = "cjpbirkbeck";
repo = "st";
# Replace this with the current revision!
rev = "0000000000000000000000000000000000000000";
# Likewise, replace this with current sha256!
sha256 = "0000000000000000000000000000000000000000000000000000";
};
buildInputs = with pkgs.xorg; [ libX11 libXft libXcursor ];
preBuild = ''
sed -i -e '/share\/applications/d' Makefile
'';
installPhase = ''
TERMINFO=$out/share/terminfo make install PREFIX=$out
mkdir -p $out/share/applications/
install -D st.desktop $out/share/applications/
'';
} );
};
}
```

## Patches

The following patches have been applied to vanilla st 0.8.3:

* [Alpha Focus Highlight]( ./applied/st-alphaFocusHighlight-20200216-26cdfeb.diff ): If a compositor like [picom](http://github.com/yshui/picom) is enabled, a terminal with focus will have a set opacity, while all others will have another opacity.
* [Anygeomtry](./applied/st-anygeometry-0.8.1.diff): Set st window sizes by pixel size.
* [Anysize]( ./applied/st-anysize-0.8.1.diff ): Dynamically set the inner border size and centers the terminal if the windows is not a multiple of the character size and inner border size.
* [Blinking cursor]( ./applied/st-blinking_cursor-20200531-a2a7044.diff ): Makes the cursor blink, like the terminal of yore.
* [Anygeomtry](./applied/st-anygeometry-0.8.1.diff): Set st window sizes by pixel size, with the argument `-G [width[xheight]]`.
* [Anysize]( ./applied/st-anysize-0.8.1.diff ): Dynamically set the inner border size and centers the terminal if the windows is not a multiple of the character size and inner border size. Useful for users of tiling window managers like [dwm](https://dwm.suckless.org), [awesomewm](https://www.awesomewm.org), [i3wm](https://i3wm.org), etc.
* [Blinking cursor]( ./applied/st-blinking_cursor-20200531-a2a7044.diff ): Makes the cursor blink, like the terminals of yore.
* [Boxdraw]( ./applied/st-boxdraw_v2-0.8.3.diff ): Allows for the drawing of Unicode line characters, allowing programs like tmux to draw lines without gaps.
* [Clipboard]( ./applied/st-clipboard-0.8.3.diff ): Use Xorg's clipboard, not primary.
* [Font2]( ./applied/st-font2-20190416-ba72400.diff ): Allows for different fonts to be used as "backup". Currently, I have not enabled any so far.
Expand All @@ -34,11 +106,11 @@ The following patches have been applied to vanilla st 0.8.3:
* [Vertcenter]( ./applied/st-vertcenter-20180320-6ac8c8a.diff ): Center oversized lines horizontally.
* [Workingdir]( ./applied/st-workingdir-20200317-51e19ea.diff ): Specify a working directory with `-d [path]`. Path can be absolute or relative.

## Theming
### Theming

Colours come from the [Oceanic Material](https://github.com/rahulpatel/oceanic-material-iterm) theme from [iTerm2 Color Schemes](https://github.com/mbadolato/iTerm2-Color-Schemes/). Specifically, it comes from conversion the termite theme with [terminal.sexy](https://www.terminal.sexy)
Colours come from the [Oceanic Material](https://github.com/rahulpatel/oceanic-material-iterm) theme from [iTerm2 Color Schemes](https://github.com/mbadolato/iTerm2-Color-Schemes/). Specifically, it comes from a conversion the termite theme with [terminal.sexy](https://www.terminal.sexy)

|Colours| Normal | Bright |
|Colours| Normal | Bright |
|-------|-----------|-----------|
|Black | `#000000` | `#777777` |
|Red | `#ee2b2a` | `#dc5c60` |
Expand All @@ -53,22 +125,38 @@ Background = `#1c262b`

Foreground = `#c2c8d7`

# Running st
## Running st

If you did not install st with make clean install, you must compile the st terminfo entry with the following command:

`tic -sx st.info`

See [the man page](./st.1) for additional details.

# TODO
## TODO

* Better integration with tmux, maybe using externalpipe?

# License
## License

See [LICENSE](./LICENSE) for details.

Credits
-------
## Credits
Based on Aurélien APTEL <aurelien dot aptel at gmail dot com> bt source code.

### Patch credits
* [Alpha Focus Highlight]( ./applied/st-alphaFocusHighlight-20200216-26cdfeb.diff ): Julius Hülsmann
* [Anygeomtry](./applied/st-anygeometry-0.8.1.diff): José Miguel Sánchez García
* [Anysize]( ./applied/st-anysize-0.8.1.diff ): Augusto Born de Oliveira
* [Blinking cursor]( ./applied/st-blinking_cursor-20200531-a2a7044.diff ): Genki Sky, Steve Ward, jvden
* [Boxdraw]( ./applied/st-boxdraw_v2-0.8.3.diff ): [Avi Halachmi](https://github.com/avih)
* [Clipboard]( ./applied/st-clipboard-0.8.3.diff ): Kai Hendry, Laslo Hunhold, Matthew Parnell
* [Font2]( ./applied/st-font2-20190416-ba72400.diff ): Kirill Bugaev
* [Netwmicon]( ./applied/st-netwmicon-0.8.4.diff ): Aleksandrs Stier
* [Newterm]( ./applied/st-newterm-0.8.2.diff ): Matías Long, Stein Bakkeby (orphan version)
* [OSC-10-11-12]( ./applied/st-osc_10_11_12-20200418-66520e1.diff ): Christian Tenllado
* [Scrollback]( ./applied/st-scrollback-20200419-72e3f6c.diff ): Jochen Sprickerhof, M Farkas-Dyck, Ivan Tham, Ori Bernstein, Matthias Schoth, Paride Legovini, Lorenzo Bracoo, Kamil Kleban, Avi Halachmi, Jacob Prosser
* [Themed cursor]( ./applied/st-themed_cursor-0.8.1.diff ): Jim Fowler
* [Undercurl](./applied/st-undercurl-0.8.4.diff): [HexOctal](https://github.com/hexoctal)
* [Vertcenter]( ./applied/st-vertcenter-20180320-6ac8c8a.diff ): Doug Whiteley
* [Workingdir]( ./applied/st-workingdir-20200317-51e19ea.diff ): David Gričar
8 changes: 8 additions & 0 deletions st.1
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ st \- simple terminal
.IR font ]
.RB [ \-g
.IR geometry ]
.RB [ \-G
.IR geometry ]
.RB [ \-n
.IR name ]
.RB [ \-o
Expand All @@ -38,6 +40,8 @@ st \- simple terminal
.IR font ]
.RB [ \-g
.IR geometry ]
.RB [ \-G
.IR geometry ]
.RB [ \-n
.IR name ]
.RB [ \-o
Expand Down Expand Up @@ -77,6 +81,10 @@ The form is [=][<cols>{xX}<rows>][{+-}<xoffset>{+-}<yoffset>]. See
.BR XParseGeometry (3)
for further details.
.TP
.BI \-G " geometry"
define st window size by number of pixels instead of cells.
The form is [width[xheight]].
.TP
.B \-i
will fixate the position given with the -g option.
.TP
Expand Down
8 changes: 4 additions & 4 deletions x.c
Original file line number Diff line number Diff line change
Expand Up @@ -2248,12 +2248,12 @@ void
usage(void)
{
die("usage: %s [-aivV] [-c class] [-d path] [-f font]"
" [-g geometry] [-n name] [-o file]\n"
" [-T title] [-t title] [-w windowid]"
" [-g geometry] [-G geometry] [-n name] \n"
" [-o file] [-T title] [-t title] [-w windowid]"
" [[-e] command [args ...]]\n"
" %s [-aivV] [-c class] [-d path] [-f font]"
" [-g geometry] [-n name] [-o file]\n"
" [-T title] [-t title] [-w windowid] -l line"
" [-g geometry] [-G geometry] [-n name] \n"
" [-o file] [-T title] [-t title] [-w windowid] -l line"
" [stty_args ...]\n", argv0, argv0);
}

Expand Down

0 comments on commit 0a7f953

Please sign in to comment.