Roller is a simple yet robust text truncation utility written in Rust.
It's really easy to use. Here's an example:
xtitle -s | roller | lemonbar- xtitle outputs the current window title
- lemonbar generates a status bar on the top of the screen
Roller requires Rust and its package manager, Cargo. Once you have these installed:
git clone https://github.com/kbrgl/roller.git
cd roller
cargo build --release
sudo ln -s ./target/release/roller /usr/bin/rollersudo pacman -S rust cargosudo apt install rust cargoRoller 1.0.0
Kabir Goel <kabirgoel.kg@gmail.com>
Truncate text by rolling it like a news ticker.
USAGE:
roller [FLAGS] [OPTIONS]
FLAGS:
-h, --help Prints help information
-m, --mutate Roll in place instead of on separate lines
-r, --reverse Roll in reverse
-V, --version Prints version information
OPTIONS:
-c, --count <NUMBER> Only roll this many times
-i, --interval <INTERVAL> Set a custom interval in milliseconds
-a, --postfix <POSTFIX> Append a static postfix to the text
-b, --prefix <PREFIX> Prepend a static prefix to the text
-s, --separator <SEPARATOR> Place a separator between consecutive rolls
-t, --truncate <LENGTH> Only roll if text is longer than LENGTH, effectively truncating it
$ echo 'Rust' | roller -c 5
Rust
ust R
st Ru
t Rus
RustBy default, Roller will refresh if there is any new input on stdin.
$ xtitle -s | roller
~/Code/roller | nvim
/Code/roller | nvim $
Code/roller | nvim $/
ode/roller | nvim $/C
~ | fish
| fish ~
| fish ~ - Before the first '~ | fish', I change my currently active window.
xtitleoutputs the new window title and outputs it. Roller picks up the change.
This option is useful if you want to make sure that the text does not exceed a certain length
$ echo 'Rust' | roller -c 5 -t 5
Rust
Rust
Rust
Rust
Rust Same options, different text:
$ echo 'Rusty.' | roller -c 5 -t 5
Rusty
usty.
sty.
ty. R
y. Ru- The
-tflag causes text to be 'truncated' at a certain length. This means that if the text exceeds that length then it is scrolled and truncated at given length, otherwise it is neither scrolled nor truncated.
$ echo 'Rust' | roller -c 3 -s ' -- '
Rust --
ust -- R
st -- RuBy default, the separator is a single space. If the default separator was an empty string (''), the output would look like the following:
Rust
ustR
stRu
$ echo 'Rust' | roller -a ' -- ' -b ' .. '
.. Rust --
.. ust R --
.. st Ru -- Roller is open source software licensed under the terms of the MIT license.