Skip to content

Latest commit

 

History

62 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rustfetch

Final implementation of sfetch rewritten into Rust. Fully configurable via toml. Supports Windows, and Linux; (Theoretically supports macOS, but untested ¯\_(ツ)_/¯)

image of rustfetch

Table of Contents

Features

  • Highly customizable with toml (see the section on configuring)
  • Super-lightweight design. Displays system information almost instantaneously.

Building

Compiling from source requires rustc version >= 1.95; Alternatively, you may lower the crate version of sysinfo inside of Cargo.toml to a lower version:

sysinfo = "0.33.1"

Which will support (rustc <= 1.74).

First clone the repository:

git clone https://github.com/merci-libre/rustfetch

After cloning you can either build the project as is, or configure some const variables inside of build.rs to change the location of where the configuration files will be stored. It should just be the path to the config that should be configurable, everything else is handled at runtime.

If you want to skip this, head to this section

Currently: there is only ONE compile-time defined variable: the location of where the configuration files are searched and created.

// inside of build.rs
const CONFIG_DIRECTORY:&str = ".config/shellrandomgreeter"

Compiling

Once you have everything setup to your liking, you can simply just build the project:

cargo build --release

Configuration

To configure rustfetch, you can configure it via the configuration file.

If you have not configured build.rs to use a different configuration directory, you can find the file in the default directory:

"$HOME"/.config/shellrandomgreeter/config.toml

Below is multiple lists of fields and possible values that you may use to configure rustfetch. Values inside of parenthesis are interchangeable and are parsed the exact same.

You can find more information about configuring each section from the following tables below:

Colors

By default some fields are already generated. Colors can be set from any keywords described from the list below:

  • black
  • red
  • green
  • yellow
  • blue
  • magenta
  • cyan
  • white
  • bright black
  • bright red
  • bright green
  • bright yellow
  • bright blue
  • bright magenta
  • bright cyan
  • bright white

which will use any of the 16 colors set for your terminal (if supported).

You may also set the color via hex code with using the following notation: #ffaf00.

note:

The terminal must support true colors in order to use hex colors. Some terminals may default to using the 8-color system if trying to set a hex color.

Intro

fields Type Possible Values
custom_welcome String any
name String any
at_sign_color String hex values (#ff0000); colors
hostname_color String hex values (#ff0000); colors

Section Titles

Section titles are subfields of both intro and system information. these act independent of one another, and can be modified separately.

# -- inside of config.toml --
[intro.section_title]
# or:
[system_information.section_title]
# respectively...
fields Type Possible Values
text_color String hex values (#ff0000); colors
background_color String hex values (#ff0000); colors
border_color String hex values (#ff0000); colors
left_border String any
right_border String any

Prompt

fields Type Possible Values
prompts_directory String (any valid path inside of $XDG_CONFIG_HOME/{configuration}*)
file_to_display String (any valid path)
motd String any
color String hex values (#ff0000); colors

*configuration is set by whatever compile time variable is set inside of build.rs

System Information

fields denoted with show_* can be set to omit or add the information to the final output.

fields Type Possible Values
custom_title String hex values (#ff0000); colors
info_text_color String hex values (#ff0000); colors
sub_clock_color String hex values (#ff0000); colors
clock_format String (12hour, 12-hour, meridian), (24hour, 24-hour, military), both
memory_info_format String (min, minimal), (total, max), all
show_date bool true, false
show_time bool true, false
show_kernel bool true, false
show_cpu bool true, false
show_cores bool true, false
show_memory bool true, false
show_uptime bool true, false

format examples

clock_format

  • 12hour, 12-hour, meridian:
Time: 2:08:26
  • 24hour, 24-hour, military:
Time: 14:08:26
  • both
Time: 14:08:26 (2:08:26 PM)

memory_info_format

  • min, minimal
Memory: 59.39 GiB available/62.71 GiB # will always show: (avail/max ram)
  • max, total
Memory: 62.71 GiB # will always show: (max ram)
  • all
Memory: 59.41 GiB available/62.71 GiB (5.26/100%) => 56.47 GiB free

Show

Modifying these values will omit sections of the output from being displayed.

fields Type Possible Values
show_welcome Bool true, false
show_message Bool true, false
show_system_information Bool true, false

Usage

On your first run, you will see that a message like this:

`$HOME/.config/shellrandomgreeter/prompts` is empty!

Do not fear! That is to be expected.

The way that Rustfetch works is that you can either set:

or, alternatively...

  • populate the listed directory with text files.

When doing this, rustfetch will randomly select a file to output at runtime.

either way, re-running the binary will actually display something in place of the message :D

History

Looking at the commits, you might wonder:

"Damn it took this long to implement?"

Truth be told no. See I made the mistake of not uploading the original files over to github because I wanted to make it perfect. Unfortunately, I had accidentally wiped 5 years of progress down the drain when I accidentally deleted my whole projects folder; Which, you guessed it, hosted the source code for this project. I've made the grave mistake of not hosting that folder on a separate partition and in the midst of moving it to my NFS server, I accidentally wiped the whole f.cking thing. Did my best to carve it, but EXT4 is brutal when it comes to recovery efforts when everything is practically on one partition.

So I not only had to start this project from scratch but I also wanted to make some optimizations with the structure of the project and also add in a sh.tload of features that honestly I wanted to add in the first release. On top of school and my other projects (primarily genpass, and my blog), it took a while to get this out.

At the time of writing I have yet to finish writing the documentation and the build script for the project. Still a lot to go, but hey-- as long as I can get to the finish line I'll be happy.

Granted, this version was a recreation of an already existing binary that I had made and installed for the previous version that I never released publicly. So that made things a little bit easier LOL.

About

Super customizable and lightweight neofetch clone.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages