forked from PerfectlyInternal/layfetch
*fetch with better layout and parallelism
- Rust 100%
| config | remove default param for network readouts | |
| src | reverted formatting | |
| .gitignore | chore: add Cargo.lock | |
| Cargo.lock | chore: add Cargo.lock | |
| Cargo.toml | typo | |
| LICENSE | Initial commit | |
| README.md | woker default config + readme | |
| screenshot.png | woker default config + readme | |
layfetch
*fetch with better layout and parallelism
A screenshot of layfetch displaying some information
Project Goals
- Use libmacchina to fetch system info
- Use ratatui to do layout and rendering
- Flexible layout configuration loaded from a file
- Dynamically update layout to fit contents
- Maybe replace JSON with something that's a little less of a pain to write
- Parallel execution of each fetch, instead of doing them in order like most *fetch do
Completed
- Loading layout from a file
- Fetching system info with libmacchina
- Got it to work in parallel too!
- Rendering layout with ratatui
- Dynamically updates when the fetched info is too big
- Support for shell command readouts
- Colored logos!
Installation
Run cargo build --release and copy the binary to your PATH.
Copy the contents of config to ~/.config/layfetch and edit them to your liking.
Configuration
The layout is a JSON file of nested objects. The following fields in each object control what it does:
constraint: The constraint for this object. Set as an object with the following fields:type: The type of constraint. Can belength,percentage,min,max, orfill.value: The value of the constraint. Forlength, this is the number of characters. Forpercentage, this is the percentage of the parent object to take up. Forminandmax, this is the minimum or maximum number of characters to take up. Forfill, this is ignored.
borders: The borders to draw around this object. Set as an object with the following boolean fields:all: Enables all borders.topbottomleftright
title: A title to draw at the top of the object, inside the top border. Will allocate space for a top border if drawn without one.margin: The margin to draw around this object. Set as an object with the following fields:horizontal: The horizontal margin in characters.vertical: The vertical margin in characters.
readoutandparams: The readout to display in this object, and parameters for it. For a full list of options, seesrc/readouts.rs. Some options include:logo: Display a logo. Params:logo: A path to a text file with ASCII art in it. The path is relative to the layout JSON.colors: A path to a JSON file with an array of colors in it. The path is relative to the layout JSON.
static: Display a static text field. Params:text: The text to display.
shell_cmd: Run shell command and display its output. Params:cmd: The command to run.
style: The style to apply to this object. Set as an object with the following fields:fg: The foreground color. Can be a hex code or a named color.bg: The background color. Can be a hex code or a named color.
align: The alignment of the content in this object. Can beleft,center, orright.direction: The direction the children of this object are laid out in. Can behorizontalorvertical.flex: How to lay out children when there is extra space. Can bestart,center,end,space_betweenorspace_around. Defaults tostartif not specified. See Ratatui docs for details.children: An array of child objects. The layout will be applied to these children.