Skip to content

Commit

Permalink
parse: add percentage tag $%% + separate ram.swap* members to it's ow…
Browse files Browse the repository at this point in the history
…n module swap + add _perc module members for disk, ram and swap
  • Loading branch information
Toni500github committed Sep 6, 2024
1 parent be28ba4 commit 784acc6
Show file tree
Hide file tree
Showing 5 changed files with 202 additions and 93 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,10 @@ They can be used in the ascii art text file and layout, but how to use them?
use `${auto2}`, for the 4th one use `${auto4}` and so on.
If you're in GUI mode and the source path is an image, all the auto colors will be white

* **The Percentage tag (`$%%`)** is used for displaying the percentage between 2 numbers.\
It **Must** contain a comma for separating the 2. They can be either be taken from a tag or it put yourself.\
For example: $%10,5%

Any `$` or brackets can be escaped with a backslash `\`

# Thanks
Expand Down
6 changes: 6 additions & 0 deletions cufetch.1
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ This is useful when on some terminal or WM the detection can be different than o
.PP
The \fBBash command tag $()\fR speaks for itself. It can execute normal bash commands.
.PP
The \fBPercentage tag $%%\fR is used for displaying the percentage between 2 numbers.
.br
It \fBMust\fR contain a comma for separating the 2. They can be either be taken from a tag or it put yourself.
.br
For example: $%10,5%
.PP
To escape any $ or bracket, just use \\
.SH OPTIONS
.TP
Expand Down
4 changes: 4 additions & 0 deletions include/config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,10 @@ inline constexpr std::string_view AUTOCONFIG = R"#([config]
#
# If you're using GUI mode, all the \fB${auto}\fR colors are going to be ${white}
# The Percentage tag $%% is used for displaying the percentage between 2 numbers.\
# It **Must** contain a comma for separating the 2. They can be either be taken from a tag or it put yourself.\
# For example: $%10,5%
# Little FAQ
# Q: "Why when I use something like "$<os.kernel> <- Kernel" it won't work on GUI mode?"
# A: replace "<-" with "\\<-". It won't affect the printing in terminal
Expand Down
28 changes: 19 additions & 9 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ builtin
title : user and hostname colored with ${{auto2}} [toni@arch2]
title_sep : separator between the title and the system infos (with the title lenght) [--------]
colors_bg : color palette with background spaces
colors_light_bg: light color palette with background spaces
colors_symbol(symb): color palette with specific symbol
colors_light_bg: light color palette with background spaces
colors_light_symbol(symb): light color palette with specific symbol
# this module is just for generic theme stuff
Expand Down Expand Up @@ -154,27 +154,37 @@ theme-gtk-all
font : gtk font theme name [Cantarell 10 [GTK2], Noto Sans, 10 [GTK3], Noto Sans 10 [GTK4]]
# note: these members are auto displayed in KiB, MiB, GiB and TiB.
# they all (except ram.ram and ram.swap) have a -KiB, -GiB and -MiB variant
# they all (except those who has the same name as the module or that ends with "_perc")
# have a -KiB, -GiB and -MiB variant.
# example: if you want to show your 512MiB of used RAM in GiB
# use the used-GiB variant (they don't print the unit tho)
# use the `used-GiB` variant (they don't print the unit tho)
ram
ram : used and total amount of RAM (auto) [2.81 GiB / 15.88 GiB]
used : used amount of RAM (auto) [2.81 GiB]
free : available amount of RAM (auto) [10.46 GiB]
total : total amount of RAM (auto) [15.88 GiB]
swap : swapfile used and total amount of RAM (auto) [477.68 MiB / 512.00 MiB]
swap_free : swapfile available amount of RAM (auto) [34.32 MiB]
swap_total : swapfile total amount of RAM (auto) [512.00 MiB]
swap_used : swapfile used amount of RAM (auto) [477.68 MiB]
# same thing as RAM (above)
used_perc : percentage of used amount of RAM in total [17.69%]
free_perc : percentage of available amount of RAM in total [82.31%]
# same comments as RAM (above)
swap
swap : used and total amount of the swapfile (auto) [477.68 MiB / 512.00 MiB]
free : available amount of the swapfile (auto) [34.32 MiB]
total : total amount of the swapfile (auto) [512.00 MiB]
used : used amount of the swapfile (auto) [477.68 MiB]
used_perc : percentage of used amount of the swapfile in total [93.29%]
free_perc : percentage of available amount of the swapfile in total [6.71%]
# same comments as RAM (above)
# note: I mean literally /path/to/fs
# e.g disk(/)
disk(/path/to/fs)
disk : used and total amount of disk space (auto) with type of filesystem [360.02 GiB / 438.08 GiB - ext4]
used : used amount of disk space (auto) [360.02 GiB]
free : available amount of disk space (auto) [438.08 GiB]
total : total amount of disk space (auto) [100.08 GiB]
used_perc : percentage of used amount of the disk in total [82.18%]
free_perc : percentage of available amount of the disk in total [17.82%]
fs : type of filesystem [ext4]
# usually people have 1 GPU in their host,
Expand Down
Loading

0 comments on commit 784acc6

Please sign in to comment.