Skip to content

A highly customizable systemfetch written in nim

License

Notifications You must be signed in to change notification settings

stfnwp/catnip

This branch is 140 commits behind iinsertNameHere/catnap:main.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

c9b2de0 · May 10, 2024
May 10, 2024
May 10, 2024
Mar 27, 2024
Mar 28, 2024
May 10, 2024
May 10, 2024
May 9, 2024
May 10, 2024
Dec 12, 2023
May 10, 2024
Mar 24, 2024
May 10, 2024

Repository files navigation


Catnip🌿 Systemfetch

View Demo · Installation · Basic Usage · Configuration · Contributing


🌿 What is Catnip

I created Catnip🌿 as a playful, simple system-information concatenation tool using nim👑. It is quite customizable and has possibilities to alter the names and colors of the statistics. In the future, I also intend to add more distribution logos. Feel free to contribute to the project at any time.

⏱️ Execution Time

*Around 0.006 seconds on my laptop

📊 Displayed Statistics

View Statistics
  • username
  • hostname
  • uptime
  • os
  • kernel
  • desktop
  • shell
  • terminal
  • memory
  • disk space
  • cpu info
  • packages
  • colors

❤ Shoutout to:

Feel free to submit issues if you have any improvement ideas! ❤


📷 Demo Images

Demo Images ✨

Default:

FigletLogos (Nitch mode):

Image Mode:

Distro Showcase:


🪡 Installation/Build

Arch Linux users can install the catnip-git package from the AUR.

1. Install nim👑 and all dependencies

Dependencies:

  • pcre
  • gzip

Optional:

  • figlet (required for figletLogos)
  • viu (required for imageMode)

2. Clone the repo:

git clone https://github.com/iinsertNameHere/catnip.git

3. Change dir to repo

cd ./catnip

4. Run install using nim👑:

nim install

Important

For the icons to work, make sure you set a NerdFont as you terminal font.


💻 Usage

Run catnip in you terminal:

$ catnip

Change the distro icon using:

$ catnip -d <distro>

To get a full list of arguments use:

$ catnip --help

📒 Configuration

The config files are located at:

  • ~/.config/catnip

You can change the names, colors, and icons for the various stats inside the stats section of the config.toml file.

Example stats section that does not use NerdFont icons:

##############################################
##          FetchInfo stats Config          ##
##############################################
[stats]
username  = {icon = ">", name = "user", color = "(RD)"}
hostname  = {icon = ">", name = "hname", color = "(YW)"}
uptime    = {icon = ">", name = "uptime", color = "(BE)"}
distro    = {icon = ">", name = "distro", color = "(GN)"}
kernel    = {icon = ">", name = "kernel", color = "(MA)"}
desktop   = {icon = ">", name = "desktp", color = "(CN)"}
terminal  = {icon = ">", name = "term", color = "(RD)"}
shell     = {icon = ">", name = "shell", color = "(MA)"}
cpu       = {icon = ">", name = "cpu", color = "(RD)"}
disk_0    = {icon = ">", name = "disk", color = "(GN)"}
memory    = {icon = ">", name = "memory", color = "(YW)"}
sep_color = "SEPARATOR"
colors    = {icon = ">", name = "colors", color = "!DT!", symbol = "#"}

If you don't want to display a stat, you can just comment out the line:

##############################################
##          FetchInfo stats Config          ##
##############################################
[stats]
username  = {icon = ">", name = "user", color = "(RD)"}
hostname  = {icon = ">", name = "hname", color = "(YW)"}
uptime    = {icon = ">", name = "uptime", color = "(BE)"}
distro    = {icon = ">", name = "distro", color = "(GN)"}
kernel    = {icon = ">", name = "kernel", color = "(MA)"}
desktop   = {icon = ">", name = "desktp", color = "(CN)"}
terminal  = {icon = ">", name = "term", color = "(RD)"}
shell     = {icon = ">", name = "shell", color = "(MA)"}
# cpu       = {icon = ">", name = "cpu", color = "(RD)"}
# disk_0    = {icon = ">", name = "disk", color = "(GN)"}
memory    = {icon = ">", name = "memory", color = "(YW)"}
sep_color = "SEPARATOR"
colors    = {icon = ">", name = "colors", color = "!DT!", symbol = "#"}

You can change the order in which the stats are displayed by just changing the order in the config:

##############################################
##          FetchInfo stats Config          ##
##############################################
[stats]
uptime    = {icon = ">", name = "uptime", color = "(BE)"}
distro    = {icon = ">", name = "distro", color = "(GN)"}
kernel    = {icon = ">", name = "kernel", color = "(MA)"}
desktop   = {icon = ">", name = "desktp", color = "(CN)"}
terminal  = {icon = ">", name = "term", color = "(RD)"}
shell     = {icon = ">", name = "shell", color = "(MA)"}
cpu       = {icon = ">", name = "cpu", color = "(RD)"}
disk_0    = {icon = ">", name = "disk", color = "(GN)"}
memory    = {icon = ">", name = "memory", color = "(YW)"}
# Username and hostname are now displayed at the bottom
username  = {icon = ">", name = "user", color = "(RD)"}
hostname  = {icon = ">", name = "hname", color = "(YW)"}

sep_color = "SEPARATOR"
colors    = {icon = ">", name = "colors", color = "!DT!", symbol = "#"}

Separators are defined by creating a new key with the sep_ prefix. The value of the key can be anything.

##############################################
##          FetchInfo stats Config          ##
##############################################
[stats]
username  = {icon = ">", name = "user", color = "(RD)"}
hostname  = {icon = ">", name = "hname", color = "(YW)"}
sep_1     = "SEPARATOR" # Separates uname and hname from rest 
uptime    = {icon = ">", name = "uptime", color = "(BE)"}
distro    = {icon = ">", name = "distro", color = "(GN)"}
kernel    = {icon = ">", name = "kernel", color = "(MA)"}
desktop   = {icon = ">", name = "desktp", color = "(CN)"}
terminal  = {icon = ">", name = "term", color = "(RD)"}
shell     = {icon = ">", name = "shell", color = "(MA)"}
cpu       = {icon = ">", name = "cpu", color = "(RD)"}
disk_0    = {icon = ">", name = "disk", color = "(GN)"}
memory    = {icon = ">", name = "memory", color = "(YW)"}
sep_color = "SEPARATOR"
colors    = {icon = ">", name = "colors", color = "!DT!", symbol = "#"}

To display multiple disks, just create a new stat is named disk_[index]. To check what the index of the disk you want to add is, just run catnip -g disks.

##############################################
##          FetchInfo stats Config          ##
##############################################
[stats]
username  = {icon = ">", name = "user", color = "(RD)"}
hostname  = {icon = ">", name = "hname", color = "(YW)"}
sep_1     = "SEPARATOR" # Separates uname and hname from rest 
uptime    = {icon = ">", name = "uptime", color = "(BE)"}
distro    = {icon = ">", name = "distro", color = "(GN)"}
kernel    = {icon = ">", name = "kernel", color = "(MA)"}
desktop   = {icon = ">", name = "desktp", color = "(CN)"}
terminal  = {icon = ">", name = "term", color = "(RD)"}
shell     = {icon = ">", name = "shell", color = "(MA)"}
cpu       = {icon = ">", name = "cpu", color = "(RD)"}
disk_0    = {icon = ">", name = "disk", color = "(GN)"}
disk_1    = {icon = ">", name = "disk", color = "(GN)"} # New disk stat
memory    = {icon = ">", name = "memory", color = "(YW)"}
sep_color = "SEPARATOR"
colors    = {icon = ">", name = "colors", color = "!DT!", symbol = "#"}

🎨 Colors:

Catnip's color system uses a ColorId, which is made up of the colors first and last letter, enclosed in characters that indicate the type of color.

Color Types:

  • Foreground Normal -> (#)
  • Foreground Bright -> {#}
  • Background Normal -> [#]
  • Background Bright -> <#>

Note

# Should be replaced by the color id.

Color IDs:

  • BLACK -> BK
  • RED -> RD
  • GREEN -> GN
  • YELLOW -> YW
  • BLUE -> BE
  • MAGENTA -> MA
  • CYAN -> CN
  • WHITE -> WE

So {GN} translates to: Foreground-Bright-Green. To set the color to Default, use !DT!.

🚩 Misc

In the misc section of config.toml you can find 3 keys.

  1. layout
  2. figletLogos
  3. imageMode

Layout

In the layout you can define how the logo and stats will be arranged.

  • Use Inline to place the logo and stats next to each other.
  • Use ArtOnTop to place the logo on top of the stats.
  • Use StatsOnTop to place the stats on top of the logo.

Figlet Logos

In the figletLogos section you can find 4 keys:

  1. enable
  2. color
  3. font
  4. margin
  • Set enable to true/false to enable or disable figlet generated logos.
  • Use color to set the color the figlet logos should have.
  • Use font to set what font figlet should use.
  • Use margin to define the margins of the figlet logos.

Image Mode

In the imageMode section you can find 4 keys:

  1. enable
  2. path
  3. scale
  4. margin
  • Set enable to true/false to enable or disable image mode.
  • Use path to define what image file to display.
  • Use scale to set the scale of the image.
  • Use margin to define the logo margins.

🖌️ Distro Art

To create a new DistroArt object inside the distros.toml file, add a new section to the file (replace distroname with the name of your distro):

[distroname]

Catnip's DistroArt Objects have three possible keys.

  1. margin
  2. art
  3. alias

Margin

The margin key is used to define the top, left and right margins of the art. For example:

Art with margin = [0, 0, 0]

Art with margin = [3, 3, 3]

Art

The art key is used to define the ascii-art for your distro. For example:

art = [
  "Test",
  "Test",
  "Test"
]

Alias

The alias key can be used to define alternate names that should also refer to the DistroArt Object.

Example in which 'test1' also refers to your new DistroArt object:

alias = "test1"

This is also used to define the default DistroArt object, which defines what art should be displayed by default.


Example DistroArt object:

[distroart.test]
alias = "test1"
margin = [3, 3 ,3]
art = [
  "Test",
  "Test",
  "Test"
]

🧪 Testing

To test Catnip, run the following command in the Catnip repo:

$ cd tests/
$ ./commandline_args.sh

Contributing

More info in CONTRIBUTING.md

Thanks to all contributors ❤



About

A highly customizable systemfetch written in nim

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Nim 97.9%
  • Shell 2.1%