Giter VIP home page Giter VIP logo

st's Introduction

st (the simple terminal)

Here is a patched version of the simple terminal by suckless, "a simple terminal emulator for X which sucks less". Generally, I mostly use it with tmux, but it works perfectly fine without it.

Requirements

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

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

Nix/NixOS

For users of either the nix package manager or NixOS 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, so probably not the best version of this code but it works.

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:

{ 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: If a compositor like picom is enabled, a terminal with focus will have a set opacity, while all others will have another opacity.
  • Anygeomtry: Set st window sizes by pixel size, with the argument -G [width[xheight]].
  • Anysize: 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, awesomewm, i3wm, etc.
  • Blinking cursor: Makes the cursor blink, like the terminals of yore.
  • Boxdraw: Allows for the drawing of Unicode line characters, allowing programs like tmux to draw lines without gaps.
  • Clipboard: Use Xorg's clipboard, not primary.
  • Font2: Allows for different fonts to be used as "backup". Currently, I have not enabled any so far.
  • Netwmicon: Hardcodes a default icon.
  • Newterm: Using the keybinding of C-S-Return to open a new terminal with the present working directory as the current instance.
  • OSC-10-11-12: Enables those escape codes for modifying the background colours.
  • Scrollback: Enable a scrollback buffer by default …
  • Scrollback mouse: … and allow it to scroll that buffer with the scrollwheel (or buttons in the case of trackpoint). Note that I have disable the middle click and made scrolling with the scrollwheel default, without needing to press shift.
  • Themed cursor: Uses the cursor from the cursor theme. Requires libXcursor.
  • Undercurl: This patch adds support for curly underlining, such as vim's spelling correction.
  • Vertcenter: Center oversized lines horizontally.
  • Workingdir: Specify a working directory with -d [path]. Path can be absolute or relative.

Theming

Colours are based off of the Oceanic Material theme from iTerm2 Color Schemes. Specifically, it comes from a conversion the termite theme with terminal.sexy.

Not that I have changed some of the colours to be easier to read. Specifically, color5 (normal Magenta) was originally #8800a0 and color7 (normal White) was #a4a4a4 and color13 (bright Magenta) was originally #aa4abc.

Colours Normal Bright
Black #000000 #777777
Red #ee2b2a #dc5c60
Green #40a33f #70be71
Yellow #ffea2e #fff163
Blue #1e80f0 #54a4f3
Magenta #c900ed #C585d1
Cyan #16afca #42c7da
White #e3e3e3 #ffffff

Background = #1c262b

Foreground = #c2c8d7

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 for additional details.

TODO

  • Better integration with tmux, maybe using externalpipe?

License

See LICENSE for details.

Credits

Based on Aurélien APTEL bt source code.

Patch credits

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.