✨ sleek typing tui with visualized results and historical logging

Overview

thokr

sleek typing tui with visualized results and historical logging

GitHub Build Workflow GitHub Deploy Workflow License Crate Version Github Stars

demo

Usage

For detailed usage run thokr -h.

thokr 0.4.1
sleek typing tui with visualized results and historical logging

USAGE:
    thokr [OPTIONS]

OPTIONS:
    -f, --full-sentences <NUMBER_OF_SENTENCES>
            number of sentences to use in test

    -h, --help
            Print help information

    -l, --supported-language <SUPPORTED_LANGUAGE>
            language to pull words from [default: english] [possible values: english, english1k,
            english10k]

    -p, --prompt <PROMPT>
            custom prompt to use

    -s, --number-of-secs <NUMBER_OF_SECS>
            number of seconds to run test

    -V, --version
            Print version information

    -w, --number-of-words <NUMBER_OF_WORDS>
            number of words to use in test [default: 15]

Installation

Cargo

$ cargo install thokr

Docker

$ docker run -it thatvegandev/thokr

Arch Linux

Install thokr-git from the AUR

Usage

For detailed usage run thokr -h.

Examples

command test contents
thokr 50 of the 200 most common english words
thokr -w 100 100 of the 200 most common English words
thokr -w 100 -l english1k 100 of the 1000 most common English words
thokr -w 10 -s 5 10 of the 200 most common English words (hard stop at 5 seconds)
thokr -p "$(cat foo.txt)" custom prompt with the output of cat foo.txt
thokr -f 4 4 grammatical sentences with full stops; overrides word settings

During a test you can press ← to start over or → to see a new prompt (assuming you didn't supply a custom one)

Supported Languages

The following languages are available by default:

name description
english 200 most common English words
english1k 1000 most common English words
english10k 10000 most common English words

Logging

Upon completion of a test, a row outlining your results is appended to the log.csv file found in the following platform-specific folders. This way you can easily track your progress over time.

platform value example
Linux $XDGCONFIG_HOME/_project_path or $HOME/.config/project_path /home/colby/.config/thokr
macOS $HOME/Library/Application Support/project_path /Users/Colby/Library/Application Support/thokr
Windows {FOLDERIDRoamingAppData}_project_path\config C:\Users\Colby\AppData\Roaming\thokr\config

Roadmap

  • ⚡️ Performance
    • Right now there are known performance issues surrounding the rendering of the tui at each tick interval and/or key press. Ideally each render uses the prior render as a base and only makes the necessary adjustments (possibly using StatefulWidget), but I haven't been able to figure that out yet.
  • 🔠 Multi-language support
    • I decided not to launch thokr with languages besides english because of some odd rendering issues I was experiencing when trying to input characters with accents. It's as though I'm not able to properly input the character in raw mode. I'd love to have that figure out before shipping other languages because I personally felt the experience was a bit jarring. I'll open an bug report for it with more details and replication steps -- would love more eyes on that problem!
  • 🧪 Tests
    • I've only written a small amount of tests at this point. I haven't sat down to really think through what tests look like when the output is dependent on the users terminal size, font size, etc. If you have any ideas for this please open up an issue and start the discussion!

Contributing

All contributions are greatly appreciated.

If you have a suggestion that would make thokr better, please fork the repo and create a pull request. You can also simply open an issue and select Feature Request

  1. Fork the repo
  2. Create your feature branch (git checkout -b [your_username]/xyz)
  3. Commit your changes (git commit -m 'add some xyz')
  4. Rebase off main (git fetch --all && git rebase origin/main)
  5. Push to your branch (git push origin [your_username]/xyz)
  6. Fill out pull request template

See the open issues for a full list of proposed features (and known issues).

License

Distributed under the MIT License. See LICENSE.md for more information.

Acknowledgments

Check out these amazing projects that inspired thokr!

Follow

github twitter youtube

Comments
  • Add AUR package

    Add AUR package

    What: Added AUR Package

    Why: It can be installed from the AUR directly.

    How: Creating the PKGBUILD

    Checklist:

    • [x] Documentation added
    • [ ] Tests added
    • [ ] No linting errors / broken tests
    • [x] Merge ready
    opened by crstian19 10
  • Added wikipedia support

    Added wikipedia support

    asciicast

    Summary

    This PR adds support for Wikipedia!!

    I added an option, -W, which will select a random article from Wikipedia and then make you type the summary of the article.

    I tried to add all the logic into its own file, to avoid cluttering the main.rs file.

    Changes

    • Cargo.toml → Added dependency reqwest to make requests to Wikipedia's API
    • main.rs → Added the module wiki, imported the appropriate function and added code to have a flag and check if the flag is present. The call to random_article() is a bit bloated because wikipedia can sometimes return an empty article (rarely), so I had to do a match (although most errors are caught inside the wiki module).
    • wiki.rs → Contains all the structs and the two functions to make the requests. It's honestly very simple, but seems complicated because all the structs and all the parsing...

    Why

    I think this is a cool addition to the program! Typing real-world text is better than randomly generated chains of words.

    In the future, an option could be added to change the article's language, or for the user to be able to provide an article title and select that one.

    How

    With reqwest! Wikipedia has an awesome API (here is the documentation), so I just tell it to give me a random article and then make a summary of that article. That summary is what will be displayed.

    Really all the complexity is because all the error checking and parsing.

    Checklist:

    • [x] Allow edits from maintainers option checked
    • [x] Branch name is prefixed with [your_username]/ (ex. coloradocolby/featureX)
    • [ ] Documentation added
    • [ ] Tests added
    • [x] No failing actions
    • [x] Merge ready

    I tried to comment all the relevant code. I would love feedback on how you would like to handle the errors when parsing or making a request.

    Hope you like this addition! 😄

    opened by margual56 6
  • ctrl+backspace to delete last word

    ctrl+backspace to delete last word

    Problem

    When I press Ctrl+Backspace, I'd expect the last word to be deleted – this is the behavior of most text input boxes, and Monkeytype. Instead, it adds a new character.

    Solution

    I don't know exactly how to implement this feature. It could be an optional argument in the CLI.

    Additional context

    Video demonstrating the behavior. I mistype the word "possible" and attempt to delete the whole word.

    https://user-images.githubusercontent.com/62364808/166745675-61dd4d1f-3972-4353-b151-3eec35ea3da9.mp4

    enhancement blocked 
    opened by RomanHN 3
  • Adds sentence functionality. Allows the -f <number_of_sentences> flag…

    Adds sentence functionality. Allows the -f flag…

    … to indicate that the user wishes to type-test full, grammatical sentences.

    What: Added -f as a flag to allow for the generation of random sentences instead of just words.

    Why: Personally, I felt that thokr's random words didn't really help certain typists as much (such as myself) due to the lack of structure. While nonsensical, the sentences generated by thokr with this new flag are grammatical, and have the necessary full stops and spaces.

    How: Through use of cgisf_lib. I shamelessly reused one of my own side-projects to expedite the process of sentence generation.

    Checklist:

    • [x] Allow edits from maintainers option checked
    • [x] Documentation added
    • [ ] Tests added N/A
    • [x] No failing actions
    • [x] Merge ready
    • Do note that get_random_sentence() has to return two results because there would be no other way to get the necessary word count for analysis later on.
    • I have also manually tested it myself and everything seems to be working.
    opened by merelymyself 3
  • Fix unwrap() causing panic at exit on Windows.

    Fix unwrap() causing panic at exit on Windows.

    What: Fix process always panicking on exit on Windows.

    Why: This bug isn't critical as it mainly occurs when the process is already exiting, but I think it would be better for the process to exit nominally instead of panicking so as not to confuse the user.

    How: The problem is caused by resize event arriving when the main thread and, therefore, the receiver end of the channel is already dead. All I did was replacing unwrap with a conditional break. Even though the problem presents itself only with the resize event at the moment, I figured it would be better and more consistent to change all three cases to a conditional break. Another option would be to return the join handles main and join them in the end, but since the code inside both threads is just an infinite cycle, breaking seems like a more straightforward and cleaner choice.

    Checklist:

    • [ ] Documentation added
    • [ ] Tests added
    • [x] No linting errors / broken tests
    • [x] Merge ready
    opened by dmitr101 3
  • Log results to platform specific location

    Log results to platform specific location

    What: Logging historical data to $XDG_DATA_HOME/thokr.log

    Why: So nerds like me can plot progress over time

    How: Results are logged whenever results are calculated. It may be smart to add a configuration to disable this, but that could be another comit

    Checklist: N/A

    • [x] Documentation added
    • [ ] Tests added
    • [x] No linting errors / broken tests
    • [x] Merge ready
    enhancement 
    opened by nickwanninger 3
  • (t)weet doesn't work in Docker container

    (t)weet doesn't work in Docker container

    Description

    After running a typing test and pressing t, nothing happens.

    To Reproduce

    1. Run in Docker (docker run -it coloradocolby/thokr)
    2. Complete a typing test
    3. Press t

    Expected behavior

    I would expect some sort of Twitter-friendly text to copy paste or Twitter opens up with the tweet pre-filled.

    Environment

    • OS: macOS
    • Terminal Emulator: xterm
    • Crate version: 0.1.0
    bug 
    opened by amorriscode 3
  • Multi-byte codepoints cause panic

    Multi-byte codepoints cause panic

    Description

    When a multiple-byte codepoint is rendered in the prompt, thokr panics and dies.

    To Reproduce

    Run thokr -p "ä" Observe the panic.

    Expected behavior

    Thokr should render the character properly, without panicking.

    Environment

    • OS: Devuan GNU/Linux Ceres on amd64
    • Terminal Emulator: gnome-terminal
    • Font: JetBrains Mono Nerd Font
    • Crate version: 0.3.0

    Additional context

    I suspect the source of the panic can be found on line 64 in thok.rs. https://github.com/thatvegandev/thokr/blob/9453468032cae753570b660146103abd55609df2/src/thok.rs#L64

    bug 
    opened by bluelhf 2
  • Fresh warp terminal bug

    Fresh warp terminal bug

    Description

    When I start a fresh terminal and run thokr for the first time it doesn't load any graphic until I run it again

    To Reproduce

    Run thokr in a fresh warp terminal.

    Expected behavior

    It's expected that it shows some graphics, isn't it?

    Screenshots

    first run in a fresh terminal: image after retry: image

    video:

    https://user-images.githubusercontent.com/39351332/175514836-d22ee8f4-8641-4ca4-83cb-bdaa07ecdcca.mov

    Environment

    • OS: macOS Monterey 12.4 (21F79)
    • Terminal Emulator: warp
    • Font: hack (warp default)
    • Thokr Version: 0.4.0

    Additional context

    I'm not an English speaker so sorry for any language mistake...

    In iTerm it runs normally...

    bug 
    opened by junque1r4 2
  • Problem with custom prompt

    Problem with custom prompt

    Description

    I have a test file with around 50 words that have this structure : (word in each line with no space at the end)

    dependencies
    visualization
    description
    parse
    duplicates
    possible
    nootropics
    scissors
    

    now when i run thokr -p "$(cat Notes/typing/words)" the app show like this : ( wiht no spaces between words)

    dependenciesvisualizationdescriptionparseduplicatespossible
    nootropicsscissors
    

    To Reproduce

    I tried to add space after each word in the text file and it worded almost : the problem i had is that i need to type twice for each

    Expected behavior

    To show the words with spaces

    Environment

    • OS: Linux Fedora 36 KDE
    • Terminal Emulator: kitty
    • Font: JetBrainsMono Nerd Font
    • Thokr Version: 0.3.0
    bug 
    opened by SamDc73 1
  • fix: remove tweet functionality if no browser available

    fix: remove tweet functionality if no browser available

    What: Remove tweet functionality if no browser is available.

    Why: Makes it so users running thokr in a docker container aren't shown a tweet option that won't work.

    This How: Uses the newly updated 0.7.1 version of webbrowser-rs which exposes Browser::is_available().

    Checklist:

    • [x] Documentation added
    • [ ] Tests added
    • [x] No linting errors / broken tests
    • [x] Merge ready
    opened by jrnxf 0
  • Add basic multi-language support

    Add basic multi-language support

    This PR attempts to support multiple languages by implementing grapheme cluster inputs and comparison using the unicode-segmentation crate. I've tested it with Finnish prompts (which can contain letters with diacritical marks, such as ä and ö), and they seem to work fine (under fish-shell on tmux, anyways).

    opened by bluelhf 2
  • Caret customization

    Caret customization

    Hi ! Thanks for creating thokr, i'm having fun playing it in random terminals :)

    My only issue is that I struggle noticing where my caret is sometimes (when i'm trying to see whether the key i hit registered or not); the underline is not always visible enough to me.

    It would be cool to see an option to use different caret types (block, beam), perhaps even following current terminal settings ! (That could perhaps expand into cool fluff like pace carets like the other issue describes as well).

    enhancement 
    opened by KaniDev 0
  • visualize historical test results

    visualize historical test results

    Problem

    There's no way to visualize historical test data, such as WPM and accuracy.

    Solution

    I would love to help write some code (in Python, if you're alright with that) to generate graphs that show average WPM and accuracy over time, for example. The logs would have to record the game mode for this to work. Let me know what you think.

    Alternatives

    A simple statistics summary page could show one's PB for each game mode, total time spent typing, etc.

    Additional context

    Statistics graph in Monkeytype.

    Thokr_graph

    enhancement 
    opened by RomanHN 2
  • pace caret

    pace caret

    Problem

    One of my favorite features of Monkeytype is called the "pace caret":

    Displays a second caret that moves at constant speed. The 'average' option averages the speed of last 10 results.

    This gives me a good idea of how fast I'm typing in each trial and helps me keep pace.

    Solution

    A pace caret feature in thokr could include "PB", "average", and "custom" WPM options, and would work just like in Monkeytype.

    Alternatives

    A live WPM counter could serve a similar purpose but is hard to pay attention to when focusing on typing. Also, it only indicates how fast I'm typing in the moment, and doesn't give me any idea how well I've been doing throughout the entire test (how likely I am to get a PR).

    Additional context

    Pace caret demo in Monkeytype. The underline caret moves at a consistent 130 WPM, but jumps when I miss a word.

    https://user-images.githubusercontent.com/62364808/166748602-748a802f-a758-4075-8918-af2dcf3a9568.mp4

    enhancement 
    opened by RomanHN 1
  • implemented basic scrolling #6

    implemented basic scrolling #6

    What

    This PR aims to address #6. It adds a scrolling functionality to the text field, so that the user isn't overwhelmed by having all the words displayed at once.

    Why

    Besides being a better user experience, rendering fewer words at a single time makes the application faster since there aren't as many characters to render/keep track of.

    How

    The difficult part was figuring out when the user is at the end of a line. I don't think there's a way to do this using rust-tui so I've had to do the math myself. This logic is present in the get_skip_count function. Once we have calculated the amount of characters to skip, the implementation is relatively straightforward.

    Checklist

    • [ ] Documentation added
    • [ ] Tests added
    • [ ] No linting errors / broken tests
    • [ ] Merge ready

    Once this is merged, I think it would be nice to increase the HORIZONTAL_MARGIN (dynamically) to center the text. It would result in a better UI in my opinion.

    opened by TheTrio 10
  • Change displayed words dynamically

    Change displayed words dynamically

    Problem

    Presently, when you pass -s to set a time limit, the test doesn't run for that amount of time. Instead, it runs until the you've typed all the words(which is 15 by default)

    Solution

    I really like 60 seconds typing tests and on something like monkeytype, the number of words isn't static - if you're typing fast, it increases the number of words automatically. There are 3 lines and as soon as you complete the 2nd line, a new line of words is added. So you never reach the last line.

    This makes more sense to me.

    Alternatives

    However, I have no clue if doing that is feasible in a terminal. If it isn't, I think doing something similar to →(but without resetting the timer) would be nice.

    Of course, I can do something like -s 60 -w 2000 but having so many words displayed at once makes it much more difficult for me to focus.

    enhancement performance 
    opened by TheTrio 5
Releases(v0.4.1)
Owner
colby thomas
should probably be sleeping
colby thomas
Sleek is a CLI tool for formatting SQL. It helps you maintain a consistent style across your SQL code, enhancing readability and productivity.

Sleek: SQL Formatter ✨ Sleek is a CLI tool for formatting SQL. It helps you maintain a consistent style across your SQL code, enhancing readability an

Nick Rempel 40 Apr 20, 2023
A template for bootstrapping a Rust TUI application with tui-rs & crossterm

rust-tui-template A template for bootstrapping a Rust TUI application with tui-rs & crossterm. tui-rs The library is based on the principle of immedia

Orhun Parmaksız 72 Dec 31, 2022
This CLI will help you improve your typing accuracy and speed

This CLI will help you improve your typing accuracy and speed! Improve your personal bests and look back on your previous records in a graph. All in the convenience of your own terminal!

Mitchel Wijt 8 May 25, 2023
Terminal-based typing test.

ttyper Ttyper is a terminal-based typing test built with Rust and tui-rs. installation With Cargo: cargo install ttyper usage For usage instructions,

Max Niederman 527 Dec 17, 2022
yet another typing test, but crab flavoured

toipe A trusty terminal typing tester for the tux. Usage Install cargo install toipe Run typing test toipe looks best on a nice terminal (such as Ala

Samyak Sarnayak 431 Dec 20, 2022
Typing accuracy practice app.

booktyping booktyping is a simple commandline tool for practicing typing accuracy while reading a book. installation booktyping has only been tested o

null 3 Dec 10, 2023
Application microframework with command-line option parsing, configuration, error handling, logging, and shell interactions

Abscissa is a microframework for building Rust applications (either CLI tools or network/web services), aiming to provide a large number of features w

iqlusion 524 Dec 26, 2022
A beautiful, tiny traceback and logging library supporting #![no_std] rust.

breadcrumbs Breadcrumbs is a beautiful, tiny traceback and logging library for Rust that offers seamless integration with #![no_std], multi-threading

Michael 18 Nov 21, 2023
Logging for text that should stay in the same place in a console.

console_static_text Crate for logging text that should stay in the same place in a console. This measures words to handle wrapping and has some consol

David Sherret 8 Dec 25, 2022
A super simple but lightweight logging library that tries to capture the most important (status) information.

Hackerlog A super simple but lightweight logging library that tries to capture the most important (status) information. The following is supported: Lo

434b 3 Aug 22, 2023
An extremely high performance logging system for clients (iOS, Android, Desktop), written in Rust.

Pinenut Log 中文文档 ・ English An extremely high performance logging system for clients (iOS, Android, Desktop), written in Rust. Overview Compression Pin

Tangent 4 Dec 1, 2023
AniTUI is a CLI (and in the future a TUI) app for searching and wathching anime in MPV.

AniTUI is a CLI (and in the future a TUI) app for searching and wathching anime in MPV. This is a Rust rewrite (quite literally a rewrite) of Pystardu

null 7 Oct 31, 2022
A hackable, minimal, fast TUI file explorer, stealing ideas from nnn and fzf.

xplr A hackable, minimal, fast TUI file explorer, stealing ideas from nnn and fzf. [Quickstart] [Features] [Plugins] [Documentation] [Upgrade Guide] [

Arijit Basu 2.6k Jan 1, 2023
TUI for crate management like lazydocker and lazynpm

TUI for crate management like lazydocker and lazynpm. Shouldve named it as lazycargo but lazycrates sounded good at that time.

Aquib 9 Dec 8, 2022
A user-friendly TUI for secure file transfers, with arrow-key and VIM-style navigation

gsftp SFTP with an interactive text-based user interface (TUI). Transfer files through an encrypted connection with a visual interface, so you can see

Ben Jiron 3 Jul 7, 2022
Simple yet powerful multi-line text editor widget for tui-rs and ratatui

tui-textarea tui-textarea is a simple yet powerful text editor widget like <textarea> in HTML for tui-rs and ratatui. Multi-line text editor can be ea

Linda_pp 126 Jul 12, 2023
Terminal UI for leetcode. Lets you browse questions through different topics. View, solve, run and submit questions from TUI.

Leetcode TUI Use Leetcode in your terminal. Why this TUI: My motivation for creating leetcode-tui stemmed from my preference for tools that are lightw

Akarsh 8 Aug 10, 2023
A fast, simple TUI for interacting with systemd services and their logs

systemctl-tui A fast, simple TUI for interacting with systemd services and their logs. systemctl-tui can quickly browse service status and logs, and s

Reilly Wood 11 Sep 1, 2023
A TUI feed reader for RSS, Atom, and (aspirationally) Podcasts

moccasin A TUI feed reader for RSS, Atom, and (eventually) Podcasts. VIM keybindings. Ranger-inspired interface. Configurable. Installation cargo inst

Tobias Fried 6 Sep 5, 2023