Skip to content

Commit

Permalink
misc: fix typos and --list-modules
Browse files Browse the repository at this point in the history
android widget: uncheck radiobuttons by default

display: I think some fix for `parse_args.no_more_reset = false` after use
  • Loading branch information
Toni500github committed Dec 25, 2024
1 parent b4e338a commit 0115673
Show file tree
Hide file tree
Showing 5 changed files with 105 additions and 105 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,7 @@ class customfetchConfigureActivity : Activity() {
argsHelp.text = customfetchRender.mainAndroid("customfetch --help")

showModulesList.setOnCheckedChangeListener { _, isChecked ->
if (isChecked)
argsHelp.text = customfetchRender.mainAndroid("customfetch -l")
else
argsHelp.text = customfetchRender.mainAndroid("customfetch --help")
argsHelp.text = customfetchRender.mainAndroid("customfetch ${if (isChecked) "-l" else "-h"}")
}

disableWrapLinesCheck.setOnCheckedChangeListener { _, isChecked ->
Expand Down
3 changes: 1 addition & 2 deletions android/app/src/main/res/layout/customfetch_configure.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@
android:id="@+id/radio_system_bg_color"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/use_system_theme_color"
android:checked="true" />
android:text="@string/use_system_theme_color" />

<RadioButton
android:id="@+id/radio_transparent_bg"
Expand Down
12 changes: 6 additions & 6 deletions include/config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ inline constexpr std::string_view AUTOCONFIG = R"#([config]
# The colors can be predefined such as: black, red, green, blue, cyan, yellow, magenta, white.
# They can be configured in the config file.
#
# They can have hexcodes colors (e.g "#5522dd").
# They can have hex codes colors (e.g "#5522dd").
# You can apply special effects to colors by using the following symbols before the '#' in hex codes:
#
# Terminal and GUI GUI Only
Expand Down Expand Up @@ -198,7 +198,7 @@ inline constexpr std::string_view AUTOCONFIG = R"#([config]
# Read the manual customfetch.1 for more infos with $() tag
#
# Q: Can I run recursive tags?
# A: If "$<disk($<disk($[1,1,$(echo -n $<disk(/).mountdir>),23]).mountdir>).disk>" works,
# A: If "$<disk($<disk($[1,1,$(echo -n $<disk(/).mountdir>),23]).mountdir>)>" works,
# Then I guess yeah
################################################################
Expand Down Expand Up @@ -247,7 +247,7 @@ ascii-logo-type = ""
# A char (or string) to use in $<builtin.title_sep>
title-sep = "-"
# A separator (or string) that when ecountered, will automatically
# A separator (or string) that when encountered, will automatically
# reset color, aka. automatically add ${0} (only in layout)
# Make it empty for disabling
sep-reset = ":"
Expand Down Expand Up @@ -297,7 +297,7 @@ use-SI-byte-unit = false
# Colors to be used in percentage tag and modules members.
# They are used as if you're using the color tag.
# It's an array just for "convinience"
# It's an array just for "convenience"
# 1st color for good
# 2nd color for normal
# 3rd color for bad
Expand Down Expand Up @@ -327,14 +327,14 @@ secs = " seconds"
# remember to not enter the same name twice, else the world will finish
# Choices: pacman, flatpak, dpkg, apk
#
# Pro-tip: if your package manager isnt listed here, yet,
# Pro-tip: if your package manager isn't listed here, yet,
# use the bash command tag in the layout
# e.g "Packages: $(pacman -Q | wc -l) (pacman)"
pkg-managers = ["pacman", "dpkg", "flatpak"]
# Distros and package manager specific
# package manager paths for getting the packages count from path.
# They are arrayies so you can add multiple paths.
# They are arrays so you can add multiple paths.
#
# If you don't know what these ares, leave them by default settings
pacman-dirs = ["/var/lib/pacman/local/"]
Expand Down
15 changes: 10 additions & 5 deletions src/display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,13 @@ std::string Display::detect_distro(const Config& config)
format = fmt::format("{}/ascii/{}.txt", config.data_dir, str_tolower(system.os_name()));
if (std::filesystem::exists(format))
return format;

return config.data_dir + "/ascii/linux.txt";
}
#if ANDROID_APP
return config.data_dir + "/ascii/android.txt";
#else
return config.data_dir + "/ascii/linux.txt";
#endif

}

#if !ANDROID_APP
Expand All @@ -93,12 +97,13 @@ static std::vector<std::string> render_with_image(systemInfo_t& systemInfo, std:
stbi_image_free(img);

std::string _;
parse_args_t parse_args{ systemInfo, _, config, colors, true, true };
parse_args_t parse_args{ systemInfo, _, config, colors, true, true, false, "" };
for (std::string& line : layout)
{
line = parse(line, parse_args);
if (!config.m_disable_colors)
line.insert(0, NOCOLOR);
parse_args.no_more_reset = false;
}

// erase each element for each instance of MAGIC_LINE
Expand Down Expand Up @@ -128,9 +133,9 @@ static std::vector<std::string> render_with_image(systemInfo_t& systemInfo, std:
return layout;
}

for (size_t i = 0; i < layout.size(); ++i)
for (auto& str : layout)
for (size_t _ = 0; _ < width + config.offset; ++_)
layout.at(i).insert(0, " ");
str.insert(0, " ");

return layout;
}
Expand Down
175 changes: 87 additions & 88 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ using namespace std::string_view_literals;
#define _false "failed"
#else
#define STRING_IF_ANDROID_APP_ELSE(x) x
#define RETURN_OR_PRINT(x) fmt::println("{}", x)
#define RETURN_OR_PRINT(x) fmt::print("{}\n", x)
#define RETURN_IF_ANDROID_APP
#define _true true
#define _false false
Expand Down Expand Up @@ -150,11 +150,11 @@ static STRING_IF_ANDROID_APP_ELSE(void) modules_list()
{
constexpr std::string_view list(R"(
MODULE ONLY
Should be used in the config as like as $<module>
Should be used as like as $<module>
Syntax:
# maybe comments of the module
module:
description [maybe example of what it prints]
description [example of what it prints]
ram:
used and total amount of RAM (auto) with used percentage [2.81 GiB / 15.88 GiB (5.34%)]
Expand All @@ -176,168 +176,167 @@ disk(/path/to/fs):
GPU shorter vendor name and model name [NVIDIA GeForce GTX 1650]
cpu:
CPU model name with number of virtual proccessors and max freq [AMD Ryzen 5 5500 (12) @ 4.90 GHz]
CPU model name with number of virtual processors and max freq [AMD Ryzen 5 5500 (12) @ 4.90 GHz]
title:
user and hostname colored with ${{auto2}} [toni@arch2]
title_sep:
separator between the title and the system infos (with the title lenght) [--------]
separator between the title and the system infos (with the title length) [--------]
colors:
color palette with background spaces
colors_light:
light color palette with background spaces
# with `symb` I mean a symbol to be used for the
# with `symbol` I mean a symbol to be used for the
# view of the color palette
colors_symbol(symb):
colors_symbol(symbol):
color palette with specific symbol
# with `symb` I mean a symbol to be used for the
# with `symbol` I mean a symbol to be used for the
# view of the color palette
colors_light_symbol(symb):
colors_light_symbol(symbol):
light color palette with specific symbol
MODULE MEMBERS
Should be used as like as $<module.member>
NOTE: there are modules such as "user.de_version" that may slow down customfetch because of querying things like the DE version
customfetch is still fast tho :)
Syntax:
# maybe comments of the module
module
member : description [example of what it prints, maybe another]
Should be used in the config as like as $<module.member>
NOTE: there are modules such as "user.de_version" that may slow down customfetch because of querying things like the DE version
customfetch is still fast tho :)
member: description [example of what it prints; maybe another]
os
name : OS name (pretty name) [Ubuntu 22.04.4 LTS, Arch Linux]
name_id : OS name id [ubuntu, arch]
kernel : kernel name and version [Linux 6.9.3-zen1-1-zen]
kernel_name : kernel name [Linux]
kernel_version: kernel version [6.9.3-zen1-1-zen]
version_id : OS version id [22.04.4, 20240101.0.204074]
name: OS name (pretty name) [Ubuntu 22.04.4 LTS; Arch Linux]
name_id: OS name id [ubuntu, arch]
kernel: kernel name and version [Linux 6.9.3-zen1-1-zen]
kernel_name: kernel name [Linux]
kernel_version: kernel version [6.9.3-zen1-1-zen]
version_id: OS version id [22.04.4, 20240101.0.204074]
version_codename: OS version codename [jammy]
pkgs : the count of the installed packages by a package manager [1869 (pacman), 4 (flatpak)]
uptime : (auto) uptime of the system [36 mins, 3 hours, 23 days]
uptime_secs : uptime of the system in seconds (should be used along with others uptime_ members) [45]
uptime_mins : uptime of the system in minutes (should be used along with others uptime_ members) [12]
uptime_hours : uptime of the system in hours (should be used along with others uptime_ members) [34]
uptime_days : uptime of the system in days (should be used along with others uptime_ members) [2]
hostname : hostname of the OS [mymainPC]
initsys_name : Init system name [systemd]
initsys_version: Init system version [256.5-1-arch]
pkgs: count of the installed packages by a package manager [1869 (pacman), 4 (flatpak)]
uptime: (auto) uptime of the system [36 mins, 3 hours, 23 days]
uptime_secs: uptime of the system in seconds (should be used along with others uptime_ members) [45]
uptime_mins: uptime of the system in minutes (should be used along with others uptime_ members) [12]
uptime_hours: uptime of the system in hours (should be used along with others uptime_ members) [34]
uptime_days: uptime of the system in days (should be used along with others uptime_ members) [2]
hostname: hostname of the OS [myMainPC]
initsys_name: Init system name [systemd]
initsys_version: Init system version [256.5-1-arch]
user
name : name you are currently logged in (not real name) [toni69]
shell : login shell name and version [zsh 5.9]
shell_name : login shell [zsh]
shell_path : login shell (with path) [/bin/zsh]
shell_version : login shell version (may be not correct) [5.9]
de_name : Desktop Enviroment current session name [Plasma]
wm_name : Window manager current session name [dwm, xfwm4]
wm_version : Window manager version (may not working correctly) [6.2, 4.18.0]
terminal : Terminal name and version [alacritty 0.13.2]
terminal_name : Terminal name [alacritty]
terminal_version: Terminal version [0.13.2]
name: name you are currently logged in (not real name) [toni69]
shell: login shell name and version [zsh 5.9]
shell_name: login shell [zsh]
shell_path: login shell (with path) [/bin/zsh]
shell_version: login shell version (may be not correct) [5.9]
de_name: Desktop Environment current session name [Plasma]
wm_name: Window Manager current session name [dwm; xfwm4]
wm_version: Window Manager version (may not work correctly) [6.2; 4.18.0]
terminal: terminal name and version [alacritty 0.13.2]
terminal_name: terminal name [alacritty]
terminal_version: terminal version [0.13.2]
# this module is just for generic theme stuff
# such as indeed cursor
# because it is not GTK-Qt specific
theme
cursor : cursor name with its size (auto add the size if queried) [Bibata-Modern-Ice (16px)]
cursor_name : cursor name [Bibata-Modern-Ice]
cursor_size : cursor size [16]
cursor: cursor name with its size (auto add the size if queried) [Bibata-Modern-Ice (16px)]
cursor_name: cursor name [Bibata-Modern-Ice]
cursor_size: cursor size [16]
# If USE_DCONF flag is set, then we're going to use
# dconf, else backing up to gsettings
theme-gsettings
name : gsettings theme name [Decay-Green]
icons : gsettings icons theme name [Papirus-Dark]
font : gsettings font theme name [Cantarell 10]
cursor : gsettings cursor name with its size (auto add the size if queried) [Bibata-Modern-Ice (16px)]
cursor_name : gsettings cursor name [Bibata-Modern-Ice]
cursor_size : gsettings cursor size [16]
name: gsettings theme name [Decay-Green]
icons: gsettings icons theme name [Papirus-Dark]
font: gsettings font theme name [Cantarell 10]
cursor: gsettings cursor name with its size (auto add the size if queried) [Bibata-Modern-Ice (16px)]
cursor_name: gsettings cursor name [Bibata-Modern-Ice]
cursor_size: gsettings cursor size [16]
# the N stands for the gtk version number to query
# so for example if you want to query the gtk3 theme name
# write it like "theme-gtk3.name"
# note: may be slow because of calling "gsettings" if couldn't read from configs.
# Read theme-gsettings module comments
theme-gtkN
name : gtk theme name [Arc-Dark]
icons : gtk icons theme name [Qogir-Dark]
font : gtk font theme name [Noto Sans 10]
name: gtk theme name [Arc-Dark]
icons: gtk icons theme name [Qogir-Dark]
font: gtk font theme name [Noto Sans 10]
# basically as like as the "theme-gtkN" module above
# but with gtk{{2,3,4}} and auto format gkt version
# note: may be slow because of calling "gsettings" if couldn't read from configs.
# Read theme-gsettings module comments
theme-gtk-all
name : gtk theme name [Arc-Dark [GTK2/3/4]]
icons : gtk icons theme name [Papirus-Dark [GTK2/3], Qogir [GTK4]]
font : gtk font theme name [Hack Nerd Font 13 [GTK2], Noto Sans 10 [GTK3/4]]
name: gtk theme name [Arc-Dark [GTK2/3/4]]
icons: gtk icons theme name [Papirus-Dark [GTK2/3], Qogir [GTK4]]
font: gtk font theme name [Hack Nerd Font 13 [GTK2], Noto Sans 10 [GTK3/4]]
# note: these members are auto displayed in from B to YB (depending if using SI byte unit or not(IEC)).
# they all (except those that has the same name as the module or that ends with "_perc")
# have variants from -B to -YB and -B to -YiB
# 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)
ram
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]
used_perc : percentage of used amount of RAM in total [17.69%]
free_perc : percentage of available amount of RAM in total [82.31%]
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]
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
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%]
used: used amount of the swapfile (auto) [477.68 MiB]
free: available amount of the swapfile (auto) [34.32 MiB]
total: total amount of the swapfile (auto) [512.00 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: the module can have either a device path
# or a filesystem path
# e.g disk(/) or disk(/dev/sda5)
disk(/path/to/fs)
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]
device : path to device [/dev/sda5]
mountdir : path to the device mount point [/]
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]
device: path to device [/dev/sda5]
mountdir: path to the device mount point [/]
# usually people have 1 GPU in their PC,
# but if you got more than 1 and want to query it,
# you should call gpu module with a number, e.g gpu1 (default gpu0).
# Infos are gotten from `/sys/class/drm/` and on each cardN directory
gpu
name : GPU model name [GeForce GTX 1650]
vendor : GPU short vendor name [NVIDIA]
vendor_long : GPU vendor name [NVIDIA Corporation]
name: GPU model name [GeForce GTX 1650]
vendor: GPU short vendor name [NVIDIA]
vendor_long: GPU vendor name [NVIDIA Corporation]
# cpu module has a memeber called "temp" and it has 3 variant units:
# cpu module has a member called "temp" and it has 3 variant units:
# "temp_C" (Celsius) "temp_F" (Fahrenheit) "temp_K" (Kelvin)
cpu
name : CPU model name [AMD Ryzen 5 5500]
temp : CPU temperature (by the choosen unit) [40.62]
nproc : CPU number of virtual proccessors [12]
name: CPU model name [AMD Ryzen 5 5500]
temp: CPU temperature (by the chosen unit) [40.62]
nproc: CPU number of virtual processors [12]
freq_cur: CPU freq (current, in GHz) [3.42]
freq_min: CPU freq (minimum, in GHz) [2.45]
freq_max: CPU freq (maximum, in GHz) [4.90]
freq_bios_limit: CPU freq (limited by bios, in GHz) [4.32]
freq_cur : CPU freq (current, in GHz) [3.42]
freq_min : CPU freq (mininum, in GHz) [2.45]
freq_max : CPU freq (maxinum, in GHz) [4.90]
system
host : Host (aka. Motherboard) model name with vendor and version [Micro-Star International Co., Ltd. PRO B550M-P GEN3 (MS-7D95) 1.0]
host_name : Host (aka. Motherboard) model name [PRO B550M-P GEN3 (MS-7D95)]
host_version : Host (aka. Motherboard) model version [1.0]
host_vendor : Host (aka. Motherboard) model vendor [Micro-Star International Co., Ltd.]
arch : the architecture of the machine [x86_64, aarch64]
host: Host (aka. Motherboard) model name with vendor and version [Micro-Star International Co., Ltd. PRO B550M-P GEN3 (MS-7D95) 1.0]
host_name: Host (aka. Motherboard) model name [PRO B550M-P GEN3 (MS-7D95)]
host_version: Host (aka. Motherboard) model version [1.0]
host_vendor: Host (aka. Motherboard) model vendor [Micro-Star International Co., Ltd.]
arch: the architecture of the machine [x86_64, aarch64]
)");

Expand Down

0 comments on commit 0115673

Please sign in to comment.