Introduction

twitch-tui is a Terminal User Interface for reading and interacting with Twitch chat users.

The ideal setup would be this application and streamlink, to obliterate all need for a browser while watching streams.

This book is still under construction, so some sections might still be missing. Feel free to submit an issue if you find that something needs improvement.

Quick start

This application has vim and emacs inspired keybinds. That means you will start out in visual mode.

The default start screen is the dashboard. This can be configured with first_state in the config file.

Once in the application, hitting ? or h will bring up the keybind window. To go back to the previous window, hit Esc.

To go to a channel, either hit Enter or an integer between square brackets to go to the corresponding channel.

To get a message to pop up in the chat, press i or c, then type your message and hit Enter. If you want to cancel typing a message, hit Esc.

You can go back to the dashboard by hitting S (Shift + s).

Insert modes at this time are message search (Ctrl + f), channel swapper (s), and the previously mentioned insert mode (i or c).

To see all the options with keybinds, either head over to the keybinds section of this book, or press ? while in visual mode.

Configuration and installation

The how-to of getting this application up and running.

Installation

Cargo

After installing Rust, use the following command to install twitch-tui:

cargo install twitch-tui

For a specific version, head over to the releases page and select the release you want.

Installing a version such as 2.0.0-alpha.1 would be cargo install twitch-tui --version "2.0.0-alpha.1".

(PPT and AUR repos coming soon)

To uninstall, run the command cargo uninstall twitch-tui.

Nix

twitch-tui is also a Nix Flake! You can build and run it on nix using:

nix run github:Xithrius/twitch-tui

Configuration

Config file

After running twt for the first time, a config file will be generated at the following locations, depending on your OS:

  • Linux/MacOS: ~/.config/twt/config.toml
  • Windows: %appdata%\twt\config.toml

You can find the default configuration values here.

Authentication

You can get a Twitch token to use for authentication from one of two places:

  • https://twitchapps.com/tmi/: Generates a token with minimal scopes
  • https://twitchtokengenerator.com/: Generates a token with custom scopes

The latter is needed for emotes and what users you follow. If you want those features, enable the user:read:follows and user:read:emotes scopes.

The minimal scope generator will only give you scopes of chat:read, chat:edit, whispers:read, whispers:edit, and channel:moderate. Be aware that whispers are currently not supported.

Once you have your token, put oauth: at the start if it's not there already, then place it in one of two places:

  1. The token variable in the config.toml that was previously generated.
  2. The environment variable TWT_TOKEN.

The environment variable will be used first, even if a token exists in config.toml. If one doesn't exist there, your config token will be used.

Emotes

Currently, only the graphics protocol for kitty is supported, so any other terminal without it won't be able to render emotes.

Enable the emotes by setting twitch_emotes, betterttv_emotes and/or seventv_emotes to true.

The emotes will be downloaded to ~/.cache/twt/ on Linux/MacOs and %appdata%\twt\cache\ on Windows.

Run it

Run twt in the terminal. For help, twt --help.

Keybind guide

All of the keybinds are in this section.

Troubleshooting

  • Option doesn't work as a replacement for Alt in the Kitty terminal on MacOS

Set macos_option_as_alt yes in your kitty config.

Normal mode keybind map

Can be the start state by configuring first_state in the config to either "normal" or "default".

Key Description
i or c Enter message insert (chat) mode for sending messages. Exit this mode with `Esc`.
@ Enter insert (chat) mode with the mention symbol `@` already existing.
/ Enter insert (chat) mode with the command symbol `/` already existing.
? or h Have the keybinds popup window appear.
q Quit the application (when no user input box is open).
s Open the recent channel switcher popup
f Open the followed channel search popup
o Open the current channel stream in a web browser
S Go to the dashboard screen (start screen).
Ctrl + f Enter message search mode, which highlights messages in the main window which match the query.
Ctrl + t Toggle the message filter.
Ctrl + r Reverse the message filter.
Ctrl + p Manually crash the application.
Esc Go back to the previous window.

Insert mode(s) keybind map

Message sending and searching, along with channel swapping keybinds are explained in this section.

Key Description
Ctrl + w Cuts a single word (from the cursor to the next whitespace).
Ctrl + u Cuts the entire line.
Ctrl + f Move cursor to the right.
Ctrl + b Move cursor to the left.
Ctrl + a Move cursor to the start.
Ctrl + e Move cursor to the end.
Alt + f Move to the end of the next word.
Alt + b Move to the start of the previous word.
Ctrl + t Swap previous character with current character.
Alt + t Swap previous word with current word.
Ctrl + u Remove everything before the cursor.
Ctrl + k Remove everything after the cursor.
Ctrl + w Remove the previous word.
Ctrl + d Remove character to the right.
Tab Fill in suggestion, if one is available.
Enter Confirm the current text to go through (doesn't do anything in message search mode).
Esc Go back to the previous window