From 3e600cd7e79c9f83311e7376e7c8cf6da388de1f Mon Sep 17 00:00:00 2001 From: Michele Venturi Date: Fri, 23 Jan 2026 04:57:40 +0100 Subject: [PATCH 1/2] Unpacked assets from binary. --- Makefile | 5 +- README.md | 8 ++- man.md | 33 +++++---- scripts/pack | 14 ++-- src/packed.go | 193 -------------------------------------------------- src/tt.go | 18 ++++- src/util.go | 21 +++++- tt.1.gz | Bin 2106 -> 2168 bytes 8 files changed, 73 insertions(+), 219 deletions(-) diff --git a/Makefile b/Makefile index 0696fe1..7379929 100644 --- a/Makefile +++ b/Makefile @@ -9,18 +9,21 @@ all: install: install -d $(DESTDIR)$(PREFIX)/bin install -d $(DESTDIR)$(PREFIX)/share/man/man1 + install -d $(DESTDIR)$(PREFIX)/share/tt install -m755 bin/tt $(DESTDIR)$(PREFIX)/bin install -m644 tt.1.gz $(DESTDIR)$(PREFIX)/share/man/man1 + cp -r themes words quotes $(DESTDIR)$(PREFIX)/share/tt .PHONY: uninstall uninstall: rm -f $(DESTDIR)$(PREFIX)/bin/tt rm -f $(DESTDIR)$(PREFIX)/share/man/man1/tt.1.gz + rm -rf $(DESTDIR)$(PREFIX)/share/tt .PHONY: assets assets: python3 ./scripts/themegen.py - ./scripts/pack themes/ words/ quotes/ > src/packed.go + ./scripts/pack > src/packed.go pandoc -s -t man -o - man.md|gzip > tt.1.gz .PHONY: rel diff --git a/README.md b/README.md index 439ca6a..d1fd923 100644 --- a/README.md +++ b/README.md @@ -69,9 +69,10 @@ other *nix tools. With a little shell scripting most features the user can conceive of should be possible to implement. Below are some simple examples of what can be achieved. - - `shuf -n 40 /usr/share/dict/words|tt` Produces a test consisting of 40 random words drawn from your system's dictionary. - - `curl http://api.quotable.io/random|jq '[.text=.content|.attribution=.author]'|tt -quotes -` Produces a test consisting of a random quote. + - `shuf -n 40 /usr/share/dict/words | tt` Produces a test consisting of 40 random words drawn from your system's dictionary. + - `curl http://api.quotable.io/random | jq -M '[.text=.content|.attribution=.author]'|tt -quotes -` Produces a test consisting of a random quote. - `alias ttd='tt -csv >> ~/wpm.csv'` Creates an alias called ttd which keeps a log of progress in your home directory`. + - `fortune matrix | tt -bold -blockcursor -showwpm -theme matrix -w "$[COLUMNS/2]"` Produces a test consisting of a random "The Matrix" quote. The default behaviour is equivalent to `tt -n 50`. @@ -79,7 +80,8 @@ See `-help` for an exhaustive list of options. ## Configuration -Custom themes and word lists can be defined in `~/.tt/themes` and `~/.tt/words` +Custom themes and word lists can be defined in `~/.config/tt/themes` and `~/.config/tt/words` and used in conjunction with the `-theme` and `-words` flags. A list of preloaded themes and word lists can be found in `words/` and `themes/` and are accessible by default using the respective flags. + diff --git a/man.md b/man.md index aa593ad..bf79f99 100644 --- a/man.md +++ b/man.md @@ -170,35 +170,41 @@ tt ~/war_and_peace.txt -start 1 Produces a test consisting of 40 random words draw from the system dictionary (similar to 'tt -n 40'). ``` -shuf -n 40 /usr/share/dict/words|tt +shuf -n 40 /usr/share/dict/words | tt ``` Starts a test consisting of two randomly drawn quotes from api.quotable.io and prints the output of each test to STDOUT in csv format. ``` -curl https://api.quotable.io/quotes|\ - jq '[.results[]|.text=.content|.attribution=.author][:2]'|\ - tt -quotes - -norreport -csv +curl -L api.quotable.io/quotes \ +| jq -M '[.results[]|.text=.content|.attribution=.author][:2]' \ +| tt -quotes - -norreport -csv +``` + +Starts a test consisting of a randomly drawn quote from "The Matrix" movies. +``` +fortune matrix | tt -bold -showwpm -theme matrix -w "$[COLUMNS/2]" ``` Starts a new typing test which uses the tt source as input: ``` -curl -LsS https://raw.githubusercontent.com/lemnos/tt/master/src/tt.go | head -n 20 | tt -noskip -raw +curl -L raw.githubusercontent.com/lemnos/tt/master/src/tt.go \ +| head -n 20 | tt -noskip -raw ``` -Modify to taste. - # PATHS Some options like **-words** and **-theme** accept a path. If the given path does not exist, the following directories are searched for a file with the given name before falling back to internal resources: - ~/.tt/words\ - ~/.tt/themes\ - /etc/tt/words\ - /etc/tt/themes + ~/.config/tt/words/\ + ~/.config/tt/themes/\ + /usr/local/tt/words/\ + /usr/local/tt/themes/\ + /etc/tt/words/\ + /etc/tt/themes/\ # KEYS @@ -206,7 +212,7 @@ Modify to taste. **C-c: ** Terminates tt\ **C-backspace: ** Deletes the previous word\ **right** Move to the next test.\ - **left** Move to the previous test. + **left** Move to the previous test.\ # AUTHOR @@ -215,9 +221,12 @@ Aetnaeus (aetnaeus@protonmail.com) # SEE ALSO ## Project Page + https://github.com/dardo82/tt + Originally forked from https://github.com/lemnos/tt # LICENSE MIT + diff --git a/scripts/pack b/scripts/pack index 9a1f3c2..cb2dea9 100755 --- a/scripts/pack +++ b/scripts/pack @@ -1,7 +1,5 @@ #!/bin/sh -[ $# -gt 0 ] || { echo "Usage: $0 ... > packed.go"; exit 1; } - cat <}!bK5u)z2jG)a@ZtQHf3jLF0RT!V{69VwJohEZze0L zCJ+fph)IG5K+CH2{P%ecfRtoATeYd!ApvxwKVH9XCYinC{l@81IF*T_*z%REq!CW$ ze6i&tQRO=0e@}j9$?P3VCYSu3bMN@OQ~c0hmZX>bwtq8V&hgnX?{gB=hW=pw!3Kc8?zc9#d3* zD!)3YR)w-_UWjVdz`lfCEqQJ9qsmEza%)^!3%5QZD>kYqcw?m(U8zS|@ueyx7o@Ll zU@4gitC$qo8gfRgjHuUiKyWK*!AU%8kaGOkq}Y+bpbnXy^u2J?c!*ATsXg9Y9!9c zjKp^ie3%_uCye7KJQEdPND2dzt+|m_xHajkXCiNZ% znQiL2P&kR$ZPp4(GoY8hNZV_TF@wPvf^2|tiszKy=v-RV%!tj71IlL0>DBzpaC|`+ z$IE!m(pqL}set7+XWU~nSP{g8kvl}^Mr@qp2|bP5-(ZP6m5d zQN}FyCy>`%?!1jsZ(P(BjK?=40|Pj{sdlZKBBvDoBOTsyS!J3E1uFPjJchzp>Y~sa zs?DV~(wT^uG$O|27`pjne-_$E6G5t(tNn4Z$P?Hl`Zo;FN0!UVLSAQ@6of1!cEE+Ygm_ znK!kyz)1P86s|oxL-~01qyD)6+qg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turi Date: Fri, 23 Jan 2026 05:01:05 +0100 Subject: [PATCH 2/2] Added Matrix theme. --- themes/matrix | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 themes/matrix diff --git a/themes/matrix b/themes/matrix new file mode 100644 index 0000000..d21ce8c --- /dev/null +++ b/themes/matrix @@ -0,0 +1,6 @@ +bgcol: #000000 +fgcol: #0000ff +hicol: #00ff00 +hicol2: #00ff88 +hicol3: #00ff44 +errcol: #ff0000