Home

Awesome

tspreed

tspreed is a terminal RSVP speed reader with Spritz-like functionality written in POSIX-compliant shell. The script reads plain text piped into it and presents it one word at time.

tspreed demo gif

Installation

Packages

DistroPackageMaintainer
Arch Linuxtspreed (AUR)Nicholas Ivkovic

Manual

Install

Replace github.com with gitlab.com if using GitLab.

$ git clone https://github.com/n-ivkovic/tspreed
$ cd tspreed
# make install

Update

$ git pull origin
# make update

Additional options

$ make help

Usage

To begin a presentation, pipe plain text into tspreed.

The presentation starts with the first word displayed for a minimum of 1 second, then all subsequent words are presented at the given speed (WPM).

If tspreed is terminated before the presentation has finished, the progress of the presentation is passed to stdout.

Keyboard controls

Keyboard controls can be enabled via the -k/keycontrols option. However, not all systems and shells are able to utilise keyboard controls, see the Portability section.

KeyAction
IShow/hide the presentation progress information.
PPause/resume the presentation. After resuming, the word that was paused on is displayed for a minimum of 0.5 seconds.
QTerminate the presentation.

Examples

$ tspreed < textfile
$ tspreed --wpm 300 --hide-cursor < textfile
$ pdftotext document.pdf - | tspreed -w 300 -n 120 -s '\r\f' -lqihkfb -p line -c 1 -K /dev/tty

Configuration

The values provided in the command options take precedence over the values provided in the local configuration file $XDG_CONFIG_HOME/tspreed/tspreed.rc (~/.config/tspreed/tspreed.rc if not defined), which takes precedence over the values provided in the global configuration file /etc/tspreed/tspreed.rc.

The default configuration is provided in ./default.rc, which is installed as the global configuration file.

OptionConfiguration fileDefault configDescription
-w, --wpm wpmwpm=wpm300Present words at the given speed in words per minute (WPM). Required to be set. Minimum value of 1, maximum value of 60000
-n, --num-start numnumstart=numStart presenting from the given nth word. Minimum value of 1.
-s, --separators charsseparators=chars\r\fUse the given characters to separate words in addition to the characters set in $IFS. Backslash escapes are interpreted.
-l, --length-varylengthvary=boolVary the speed words are presented at based on their length.
-q, --quiet-exitquietexit=boolDo not output the presentation progress if tspreed is terminated before the presentation has finished.
-h, --hide-cursorhidecursor=booltrueHide the cursor during the presentation.
-i, --progress-infoproginfo=boolDisplay progress information during the presentation.
-k, --key-controlskeycontrols=boolEnable keyboard controls.
-f, --focusfocus=boolHighlight the focus letter (also known as the pivot or optimal recognition point) of the word being presented.
-p, --focus-pointer stylefocuspointer=stylelineDisplay pointers in a given style pointing towards the focus letter. Only relevant if focus letter highlighting is enabled. Styles: none, line, point.
-b, --focus-boldfocusbold=booltrueDisplay the focus letter in bold. Only relevant if focus letter highlighting is enabled.
-c, --focus-color colorfocuscolor=color1Display the focus letter in the given color. Only relevant if focus letter highlighting is enabled. Color values are ANSI X3.64 8-bit color values, ranging from 0 to 255.
-K, --dev-key-input pathdevkeyinput=pathDevice/path to read keyboard input from. Only relevant if keyboard controls are enabled. Defaults to /dev/tty.
-v, -V, --versionPrint tspreed version and exit.

Portability

tspreed 'officially' supports GNU-based, BSD-based, and BusyBox-based systems only due to POSIX-compliance issues described below. This does not mean the script is guaranteed to not work on other Unix-like systems or issues specific to those systems will not be addressed, merely it is unknown how well supported the script is on other Unix-like systems.

POSIX-compliance

tspreed attempts to comply with POSIX.1-2001 through to POSIX.1-2008 in order to maintain portability across Unix-like systems. However, the script must utilize non-compliant features and commands and will exit with an error if none are supported.

If keyboard controls are enabled (-k/keycontrols option), both of the below non-compliant features must be supported:

Otherwise, at least one of the below non-compliant features and commands must be supported:

Terminal I/O

The script utilizes terminal capabilities via tput(1), but will fall back to the following where possible if those capabilities fail:

If keyboard controls are enabled (-k/keycontrols option), keyboard input is read from /dev/tty by default. This can be changed via the -K/devkeyinput option.

Contributing

Please adhere to the following when creating a pull request:

License

Copyright © 2020-2024 Nicholas Ivkovic.

Licensed under the GNU General Public License version 3 or later. See ./LICENSE, or https://gnu.org/licenses/gpl.html if more recent, for details.

This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.