📚 flow state reading in the terminal

Overview

fsrx

📚 (f)low (s)tate (r)eading e(x)change – flow state reading in the terminal

GitHub CI Workflow GitHub Deploy Workflow License Crate Version Github Stars

demo

Inspired by (but not affiliated with) Renato Casutt and his revolutionary work on Bionic Reading.

Usage

For detailed usage run fsrx -h.

fsrx 1.0.1
Colby Thomas <[email protected]>
📚(f)low (s)tate (r)eading e(x)change
flow state reading in the terminal

USAGE:
    fsrx [OPTIONS] [PATH]

ARGS:
    <PATH>    path to file (or supply input via stdin)

OPTIONS:
    -c, --contrast               high contrast
    -f, --fixation <FIXATION>    fixation intensity [default: m] [possible values: l, m, h]
    -h, --help                   Print help information
    -s, --saccade <SACCADE>      saccade intensity [default: h] [possible values: l, m, h]
    -V, --version                Print version information

Examples

$ echo "the quick brown fox jumps over the lazy dog" | fsrx
$ fsrx input.txt | less
$ fmt -w60 input.txt | fsrx -c -fh -sl

Installation

Cargo

$ cargo install fsrx

Homebrew

incoming @ homebrew-fsrx

Arch Linux

fsrx via the AUR

NetBSD

fsrx from the official repositories

Contributing

All contributions are greatly appreciated. Please keep in mind this project is meant to be as lightweight as possible, so not every idea will be considered.

If you have a suggestion that would make fsrx 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.

Follow

github twitter youtube

Comments
  • AUR Package

    AUR Package

    Hello,

    I started using the project (thank you!) and also packaged it to Arch User Repository

    Arch Linux user can simply;

    paru -S fsrx-git
    

    Or using any other AUR helper they use. This can be added to the README.md if you'd like.

    The -git tag (sorry if you already know this) says that the package tracks this repository directly. AUR Submission Guidelines says that the fsrx package can be submitted to AUR when there's an official release on upstream (here). On a potential fsrx, the AUR package will download the release .tar.gz (instead of cloning the repository) and build the package using that.

    Currently the repository is using prereleases, if you'd like you can start releasing full releases (feedback: as far as I can tell the program is stable and ready for use) and that can be packaged as well

    Cheers

    enhancement 
    opened by yigitsever 6
  • Newlines stripped when reading STDIN

    Newlines stripped when reading STDIN

    Description

    When the file is provided as an argument, the newlines are handled correctly. But when fsrx reads from standard input the newlines are stripped away.

    To Reproduce

    $ fsrx .bashrc # as expected
    $ cat .bashrc | fsrx # a mess
    

    Expected behavior

    The newline handling should be consistent between those two methods.

    Screenshots

    screenshot_54628065

    Additional context

    Fixing this would make it possible to use fmt to reflow incoming text to a managable width, like so:

    $ fmt -w 60 long_lines.txt | fsrx | less -R
    

    Right now the newlines created by fmt are deleted.

    bug 
    opened by piotr-machura 3
  • Requesting documentation for some suggested compatible color settings

    Requesting documentation for some suggested compatible color settings

    Problem

    Some terminal themes slightly or greatly obscure the effect.

    Hoping to request guidance at least for which settings could help replicate the awesome readme image : )

    Solution

    Examples of color settings, possibly hex codes for font, bold-font, and background for reproducing the readme image.

    enhancement 
    opened by gkielian 1
  • nix info

    nix info

    What:

    Adds an installation part for Nix.

    Why:

    Improves user experience for users with nix installed.

    How:

    Checklist:

    • [x] Allow edits from maintainers option checked
    • [x] Branch name is prefixed with [your_username]/ (ex. thatvegandev/featureX)
    • [x] Documentation added
    • [ ] Tests added N/A
    • [ ] No failing actions N/A
    • [x] Merge ready
    opened by MoritzBoehme 0
  • Separate fsrx functionality into a lib

    Separate fsrx functionality into a lib

    Add default feature to build bin Update cli to use fsrx_lib

    Bump dependencies

    What: Migrated the functionality of FSRX into a library that the CLI app uses to mark-up the text.

    Why: Moving fsrx functionality into a library would allow it to be used as a dependency as well to offer the flow state reading conversion of any text. I was looking to add fsrx into my own fork of the himalaya command line webmail client and, instead of just piping the output to fsrx, I wanted to implement it as an output mode.

    Another application would be to quickly make a wasm based browser extension to manipulate <p> tags on a website

    How: I changed clap and atty to be feature dependent, added the cli feature and made it default. I then added a lib that provides the FSRXStyler struct that maintains contrast, fixation, saccade mode and regex snippet states. it provides publicly the style_line function which accepts a &str and returns a FSRX styled String

    Checklist:

    • [x] Allow edits from maintainers option checked
    • [x] Branch name is prefixed with [your_username]/ (ex. thatvegandev/featureX)
    • [ ] Documentation added
    • [ ] Tests added
    • [x] No failing actions
    • [x] Merge ready
    opened by TheBestJohn 1
  • nix info

    nix info

    What:

    Adds an installation part for Nix.

    Why:

    Improves user experience for users with nix installed.

    How:

    Checklist:

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

    Closes #6.

    opened by MoritzBoehme 0
  • "thread 'main' panicked at 'failed printing to stdout: Broken pipe (os error 32)" when writing to a pipe

    Description

    I've worked out how to use fsrx to speed up my reading of manpages. However, intermittently, I get an error when closing the pager.

    $ echo "$MANPAGER"
    col -bx | fsrx | ifne less -R
    $ RUST_BACKTRACE="full" man man
    thread 'main' panicked at 'failed printing to stdout: Broken pipe (os error 32)', library/std/src/io/stdio.rs:1016:9
    stack backtrace:
       0:        0x10032b60c - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::ha610dc96df5533b5
       1:        0x10033dab8 - core::fmt::write::h85a0222d7173f527
       2:        0x100318834 - std::io::Write::write_fmt::h1e81e1aae1f60926
       3:        0x100320564 - std::panicking::default_hook::{{closure}}::hafcdd34daa6aee47
       4:        0x100320228 - std::panicking::default_hook::hbdef0c99978ce86d
       5:        0x100320a78 - std::panicking::rust_panic_with_hook::he857adbde651a96b
       6:        0x10032bbcc - std::panicking::begin_panic_handler::{{closure}}::h78d4b95de3b3c015
       7:        0x10032b720 - std::sys_common::backtrace::__rust_end_short_backtrace::h948efd9d51b5e877
       8:        0x100320678 - _rust_begin_unwind
       9:        0x10034a1d0 - core::panicking::panic_fmt::h4c391ad4ab25a9e0
      10:        0x100312004 - std::io::stdio::_print::hff0a1d2b7e1a5800
      11:        0x10026ab8c - fsrx::main::h55fca34d33cf796a
      12:        0x10026e77c - std::sys_common::backtrace::__rust_begin_short_backtrace::h389c28ebd38b79bf
      13:        0x10026e79c - std::rt::lang_start::{{closure}}::hcd3d64d5e1b5843b
      14:        0x100318288 - std::rt::lang_start_internal::h0a14a326db0de5c9
      15:        0x10026b72c - _main
    $
    

    Expected behavior

    Everything works as desired except for the error at the end.

    Environment

    • OS: macOS-12.4
    • Terminal Emulator: kitty
    • Font: Iosevka Custom
    • fsrx version: 1.0.2
    bug 
    opened by rpdelaney 1
  • Nix Package

    Nix Package

    Hey, first of all I wanted to thank you for this awesome application. Secondly, I just wanted to let you know that I recently packaged fsrx for nix. Perhaps you could add a small note to the README, so other nix users could know that it is packaged and ready to go.

    enhancement 
    opened by MoritzBoehme 0
  • Unicode-based split of words and graphemes

    Unicode-based split of words and graphemes

    What:

    • Inputs with non-latin alphabets are now processed correctly.

    Why:

    • The original regex [\w\\']+ only matches latin alphabets, thus non-latin inputs were not processed at all.
    • The &str.len() is not always the same as the length of the Unicode graphemes, and indices in style_substr were calculated wrongly for multibyte characters.

    How:

    • Changed the word-split algorithm from regex to unicode_word_indices
    • Changed the character indexing from &str slice to UnicodeSegmentation::graphemes

    Tests:

    • English echo 'The Quick Brown Fox Jumps Over The Lazy Dog' | fsrx
    • French echo "Le cœur déçu mais l'âme plutôt naïve, Louÿs rêva de crapaüter en canoë au-delà des îles, près du mälström où brûlent les novæ" | fsrx
    • Korean echo '키스의 고유 조건은 입술끼리 만나야 하고 특별한 기술은 필요치 않다.' | fsrx

    Checklist:

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

    Caveat:

    • I comfirmed that languages putting spaces between words are processed quite similarly to English. However, it seems that fsrx's algorithm (and Bionic Reading) cannot be applicable to some Asian languages that do not use spaces (such as Japanese and Chinese.)
    • Some terminal emulators (e.g., Alacritty, if I remember correctly) may not properly support Unicode input / output. I tested my code with xfce4-terminal.
    • For non-latin alphabets, I tested my code with D2Coding font, but other fonts such as Noto will work as well.
    opened by ichianr 1
Releases(v1.0.2)
Owner
colby thomas
should probably be sleeping
colby thomas
Recompile Rust faster. Good for your flow state.

plonk Plonk is a development-time build tool for Rust projects. cargo install cargo-plonk # fn main() { # lib::say_hello(); # } $ cargo build -p exam

Divy Srivastava 16 Dec 12, 2023
An open source, programmed in rust, privacy focused tool for reading programming resources (like stackoverflow) fast, efficient and asynchronous from the terminal.

Falion An open source, programmed in rust, privacy focused tool for reading programming resources (like StackOverFlow) fast, efficient and asynchronou

Obscurely 17 Dec 20, 2022
A blazingly fast rust-based bionic reader for blazingly fast reading within a terminal console 🦀

This Rust-based CLI tool reads text and returns it back in bionic reading format for blazingly fast loading and even faster reading! Bionic reading is

Ismet Handzic 5 Aug 5, 2023
Rust crate `needleman_wunsch` of the `fasebare` package: reading FASTA sequences, Needleman-Wunsch alignment

fasebare Rust crate needleman_wunsch of the fasebare package: reading FASTA sequences, Needleman-Wunsch alignment. Synopsis The crate needleman_wunsch

Laurent Bloch 2 Nov 19, 2021
Desktop app for reading and downloading manga. With clean distraction-free design and no clutter

Tonbun Tonbun is a desktop app for reading and downloading manga. With clean distraction-free design and no clutter. Build with Rust, Tauri, Vue.js, a

null 23 Nov 30, 2022
Pure rust library for reading / writing DNG files providing access to the raw data in a zero-copy friendly way.

DNG-rs   A pure rust library for reading / writing DNG files providing access to the raw data in a zero-copy friendly way. Also containing code for re

apertus° - open source cinema 4 Dec 1, 2022
Reading Getting Friendly With CPU Caches

Getting Friendly With CPU Caches Reading Getting Friendly With CPU Caches, by Miki Tebeka and William Kennedy, inspired me to look at some Rust equiva

Herbert 6 Jul 25, 2023
Tool and framework for securely reading untrusted USB mass storage devices.

usbsas is a free and open source (GPLv3) tool and framework for securely reading untrusted USB mass storage devices. Description Following the concept

CEA IT Security 250 Aug 16, 2023
A terminal ASCII media player. View images, gifs, videos, webcam, YouTube, etc.. directly in the terminal as ASCII art.

Terminal Media Player View images, videos (files or YouTube links), webcam, etc directly in the terminal as ASCII. All images you see below are just m

Max Curzi 36 May 8, 2023
ask.sh: AI terminal assistant that can read and write your terminal directly!

ask.sh: AI terminal assistant that read from & write to your terminal ask.sh is an AI terminal assistant based on OpenAI APIs such as GPT-3.5/4! What'

hmirin 5 Jun 20, 2023
A simple and efficient terminal UI implementation with ratatui.rs for getting quick insights from csv files right on the terminal

CSV-GREP csv-grep is an intuitive TUI application writting with ratatui.rs for reading, viewing and quickly analysing csv files right on the terminal.

Anthony Ezeabasili 16 Mar 10, 2024
Run your Rust CLI programs as state machines with persistence and recovery abilities

step-machine Run your CLI programs as state machines with persistence and recovery abilities. When such a program breaks you'll have opportunity to ch

Imbolc 31 Nov 23, 2022
This is the data collector that gets your system's state and sends it to the backend

⚡ Installation Linux curl -s https://raw.githubusercontent.com/xornet-cloud/Reporter/main/scripts/install.sh | sudo bash Windows Invoke-Command -Scrip

Xornet 18 Sep 3, 2022
global state management for dioxus built on the concept of atoms. currently under 🏗

Fermi: A global state management solution for Dioxus, inspired by Recoil.Js Fermi provides primitives for managing global state in Dioxus applications

Dioxus 15 Feb 12, 2022
Alexander Mongus is a state-of-the-art filter to sneak amogus characters in pictures

A. Mongus Go to: http://www.lortex.org/amogu/ ??? This is a client-side, Webassembly-based filter to hide amongus characters in your images. Example:

Lucas Pluvinage 3 Apr 16, 2022
A command line tool to control the power state of Valve Base Stations 2.0.

lighthousectl A command line tool to control the power state of Valve Base Stations 2.0. Usage Scan All Base Stations It scans endlessly. You can stop

KOBA789 11 Aug 9, 2022
Low level access to processors using the AArch64 execution state.

aarch64-cpu Low level access to processors using the AArch64 execution state. Usage Please note that for using this crate's register definitions (as p

Rust Embedded 18 Jan 5, 2023
Leptos Query - a robust asynchronous state management library for Leptos,

Leptos Query is a robust asynchronous state management library for Leptos, providing simplified data fetching, integrated reactivity, server-side rendering support, and intelligent cache management.

Nico Burniske 5 Jul 24, 2023
Fully-typed, async, reusable state management and synchronization for Dioxus 🧬

dioxus-query ?? ⚡ Fully-typed, async, reusable state management and synchronization for Dioxus ??. Inspired by TanStack Query. ⚠️ Work in progress ⚠️

Marc Espín 9 Aug 7, 2023