Skip to content

Commit 0115673

Browse files
committed
misc: fix typos and --list-modules
android widget: uncheck radiobuttons by default display: I think some fix for `parse_args.no_more_reset = false` after use
1 parent b4e338a commit 0115673

File tree

5 files changed

+105
-105
lines changed

5 files changed

+105
-105
lines changed

android/app/src/main/java/org/toni/customfetch_android/widget/customfetchConfigureActivity.kt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,7 @@ class customfetchConfigureActivity : Activity() {
120120
argsHelp.text = customfetchRender.mainAndroid("customfetch --help")
121121

122122
showModulesList.setOnCheckedChangeListener { _, isChecked ->
123-
if (isChecked)
124-
argsHelp.text = customfetchRender.mainAndroid("customfetch -l")
125-
else
126-
argsHelp.text = customfetchRender.mainAndroid("customfetch --help")
123+
argsHelp.text = customfetchRender.mainAndroid("customfetch ${if (isChecked) "-l" else "-h"}")
127124
}
128125

129126
disableWrapLinesCheck.setOnCheckedChangeListener { _, isChecked ->

android/app/src/main/res/layout/customfetch_configure.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,7 @@
6161
android:id="@+id/radio_system_bg_color"
6262
android:layout_width="wrap_content"
6363
android:layout_height="wrap_content"
64-
android:text="@string/use_system_theme_color"
65-
android:checked="true" />
64+
android:text="@string/use_system_theme_color" />
6665

6766
<RadioButton
6867
android:id="@+id/radio_transparent_bg"

include/config.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ inline constexpr std::string_view AUTOCONFIG = R"#([config]
157157
# The colors can be predefined such as: black, red, green, blue, cyan, yellow, magenta, white.
158158
# They can be configured in the config file.
159159
#
160-
# They can have hexcodes colors (e.g "#5522dd").
160+
# They can have hex codes colors (e.g "#5522dd").
161161
# You can apply special effects to colors by using the following symbols before the '#' in hex codes:
162162
#
163163
# Terminal and GUI GUI Only
@@ -198,7 +198,7 @@ inline constexpr std::string_view AUTOCONFIG = R"#([config]
198198
# Read the manual customfetch.1 for more infos with $() tag
199199
#
200200
# Q: Can I run recursive tags?
201-
# A: If "$<disk($<disk($[1,1,$(echo -n $<disk(/).mountdir>),23]).mountdir>).disk>" works,
201+
# A: If "$<disk($<disk($[1,1,$(echo -n $<disk(/).mountdir>),23]).mountdir>)>" works,
202202
# Then I guess yeah
203203
################################################################
204204
@@ -247,7 +247,7 @@ ascii-logo-type = ""
247247
# A char (or string) to use in $<builtin.title_sep>
248248
title-sep = "-"
249249
250-
# A separator (or string) that when ecountered, will automatically
250+
# A separator (or string) that when encountered, will automatically
251251
# reset color, aka. automatically add ${0} (only in layout)
252252
# Make it empty for disabling
253253
sep-reset = ":"
@@ -297,7 +297,7 @@ use-SI-byte-unit = false
297297
298298
# Colors to be used in percentage tag and modules members.
299299
# They are used as if you're using the color tag.
300-
# It's an array just for "convinience"
300+
# It's an array just for "convenience"
301301
# 1st color for good
302302
# 2nd color for normal
303303
# 3rd color for bad
@@ -327,14 +327,14 @@ secs = " seconds"
327327
# remember to not enter the same name twice, else the world will finish
328328
# Choices: pacman, flatpak, dpkg, apk
329329
#
330-
# Pro-tip: if your package manager isnt listed here, yet,
330+
# Pro-tip: if your package manager isn't listed here, yet,
331331
# use the bash command tag in the layout
332332
# e.g "Packages: $(pacman -Q | wc -l) (pacman)"
333333
pkg-managers = ["pacman", "dpkg", "flatpak"]
334334
335335
# Distros and package manager specific
336336
# package manager paths for getting the packages count from path.
337-
# They are arrayies so you can add multiple paths.
337+
# They are arrays so you can add multiple paths.
338338
#
339339
# If you don't know what these ares, leave them by default settings
340340
pacman-dirs = ["/var/lib/pacman/local/"]

src/display.cpp

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,13 @@ std::string Display::detect_distro(const Config& config)
7171
format = fmt::format("{}/ascii/{}.txt", config.data_dir, str_tolower(system.os_name()));
7272
if (std::filesystem::exists(format))
7373
return format;
74-
75-
return config.data_dir + "/ascii/linux.txt";
7674
}
75+
#if ANDROID_APP
76+
return config.data_dir + "/ascii/android.txt";
77+
#else
78+
return config.data_dir + "/ascii/linux.txt";
79+
#endif
80+
7781
}
7882

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

9599
std::string _;
96-
parse_args_t parse_args{ systemInfo, _, config, colors, true, true };
100+
parse_args_t parse_args{ systemInfo, _, config, colors, true, true, false, "" };
97101
for (std::string& line : layout)
98102
{
99103
line = parse(line, parse_args);
100104
if (!config.m_disable_colors)
101105
line.insert(0, NOCOLOR);
106+
parse_args.no_more_reset = false;
102107
}
103108

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

131-
for (size_t i = 0; i < layout.size(); ++i)
136+
for (auto& str : layout)
132137
for (size_t _ = 0; _ < width + config.offset; ++_)
133-
layout.at(i).insert(0, " ");
138+
str.insert(0, " ");
134139

135140
return layout;
136141
}

src/main.cpp

Lines changed: 87 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ using namespace std::string_view_literals;
5656
#define _false "failed"
5757
#else
5858
#define STRING_IF_ANDROID_APP_ELSE(x) x
59-
#define RETURN_OR_PRINT(x) fmt::println("{}", x)
59+
#define RETURN_OR_PRINT(x) fmt::print("{}\n", x)
6060
#define RETURN_IF_ANDROID_APP
6161
#define _true true
6262
#define _false false
@@ -150,11 +150,11 @@ static STRING_IF_ANDROID_APP_ELSE(void) modules_list()
150150
{
151151
constexpr std::string_view list(R"(
152152
MODULE ONLY
153-
Should be used in the config as like as $<module>
153+
Should be used as like as $<module>
154154
Syntax:
155155
# maybe comments of the module
156156
module:
157-
description [maybe example of what it prints]
157+
description [example of what it prints]
158158
159159
ram:
160160
used and total amount of RAM (auto) with used percentage [2.81 GiB / 15.88 GiB (5.34%)]
@@ -176,168 +176,167 @@ disk(/path/to/fs):
176176
GPU shorter vendor name and model name [NVIDIA GeForce GTX 1650]
177177
178178
cpu:
179-
CPU model name with number of virtual proccessors and max freq [AMD Ryzen 5 5500 (12) @ 4.90 GHz]
179+
CPU model name with number of virtual processors and max freq [AMD Ryzen 5 5500 (12) @ 4.90 GHz]
180180
181181
title:
182182
user and hostname colored with ${{auto2}} [toni@arch2]
183183
184184
title_sep:
185-
separator between the title and the system infos (with the title lenght) [--------]
185+
separator between the title and the system infos (with the title length) [--------]
186186
187187
colors:
188188
color palette with background spaces
189189
190190
colors_light:
191191
light color palette with background spaces
192192
193-
# with `symb` I mean a symbol to be used for the
193+
# with `symbol` I mean a symbol to be used for the
194194
# view of the color palette
195-
colors_symbol(symb):
195+
colors_symbol(symbol):
196196
color palette with specific symbol
197197
198-
# with `symb` I mean a symbol to be used for the
198+
# with `symbol` I mean a symbol to be used for the
199199
# view of the color palette
200-
colors_light_symbol(symb):
200+
colors_light_symbol(symbol):
201201
light color palette with specific symbol
202202
203203
MODULE MEMBERS
204+
Should be used as like as $<module.member>
205+
NOTE: there are modules such as "user.de_version" that may slow down customfetch because of querying things like the DE version
206+
customfetch is still fast tho :)
204207
Syntax:
205208
# maybe comments of the module
206209
module
207-
member : description [example of what it prints, maybe another]
208-
209-
Should be used in the config as like as $<module.member>
210-
NOTE: there are modules such as "user.de_version" that may slow down customfetch because of querying things like the DE version
211-
customfetch is still fast tho :)
210+
member: description [example of what it prints; maybe another]
212211
213212
os
214-
name : OS name (pretty name) [Ubuntu 22.04.4 LTS, Arch Linux]
215-
name_id : OS name id [ubuntu, arch]
216-
kernel : kernel name and version [Linux 6.9.3-zen1-1-zen]
217-
kernel_name : kernel name [Linux]
218-
kernel_version: kernel version [6.9.3-zen1-1-zen]
219-
version_id : OS version id [22.04.4, 20240101.0.204074]
213+
name: OS name (pretty name) [Ubuntu 22.04.4 LTS; Arch Linux]
214+
name_id: OS name id [ubuntu, arch]
215+
kernel: kernel name and version [Linux 6.9.3-zen1-1-zen]
216+
kernel_name: kernel name [Linux]
217+
kernel_version: kernel version [6.9.3-zen1-1-zen]
218+
version_id: OS version id [22.04.4, 20240101.0.204074]
220219
version_codename: OS version codename [jammy]
221-
pkgs : the count of the installed packages by a package manager [1869 (pacman), 4 (flatpak)]
222-
uptime : (auto) uptime of the system [36 mins, 3 hours, 23 days]
223-
uptime_secs : uptime of the system in seconds (should be used along with others uptime_ members) [45]
224-
uptime_mins : uptime of the system in minutes (should be used along with others uptime_ members) [12]
225-
uptime_hours : uptime of the system in hours (should be used along with others uptime_ members) [34]
226-
uptime_days : uptime of the system in days (should be used along with others uptime_ members) [2]
227-
hostname : hostname of the OS [mymainPC]
228-
initsys_name : Init system name [systemd]
229-
initsys_version: Init system version [256.5-1-arch]
220+
pkgs: count of the installed packages by a package manager [1869 (pacman), 4 (flatpak)]
221+
uptime: (auto) uptime of the system [36 mins, 3 hours, 23 days]
222+
uptime_secs: uptime of the system in seconds (should be used along with others uptime_ members) [45]
223+
uptime_mins: uptime of the system in minutes (should be used along with others uptime_ members) [12]
224+
uptime_hours: uptime of the system in hours (should be used along with others uptime_ members) [34]
225+
uptime_days: uptime of the system in days (should be used along with others uptime_ members) [2]
226+
hostname: hostname of the OS [myMainPC]
227+
initsys_name: Init system name [systemd]
228+
initsys_version: Init system version [256.5-1-arch]
230229
231230
user
232-
name : name you are currently logged in (not real name) [toni69]
233-
shell : login shell name and version [zsh 5.9]
234-
shell_name : login shell [zsh]
235-
shell_path : login shell (with path) [/bin/zsh]
236-
shell_version : login shell version (may be not correct) [5.9]
237-
de_name : Desktop Enviroment current session name [Plasma]
238-
wm_name : Window manager current session name [dwm, xfwm4]
239-
wm_version : Window manager version (may not working correctly) [6.2, 4.18.0]
240-
terminal : Terminal name and version [alacritty 0.13.2]
241-
terminal_name : Terminal name [alacritty]
242-
terminal_version: Terminal version [0.13.2]
231+
name: name you are currently logged in (not real name) [toni69]
232+
shell: login shell name and version [zsh 5.9]
233+
shell_name: login shell [zsh]
234+
shell_path: login shell (with path) [/bin/zsh]
235+
shell_version: login shell version (may be not correct) [5.9]
236+
de_name: Desktop Environment current session name [Plasma]
237+
wm_name: Window Manager current session name [dwm; xfwm4]
238+
wm_version: Window Manager version (may not work correctly) [6.2; 4.18.0]
239+
terminal: terminal name and version [alacritty 0.13.2]
240+
terminal_name: terminal name [alacritty]
241+
terminal_version: terminal version [0.13.2]
243242
244243
# this module is just for generic theme stuff
245244
# such as indeed cursor
246245
# because it is not GTK-Qt specific
247246
theme
248-
cursor : cursor name with its size (auto add the size if queried) [Bibata-Modern-Ice (16px)]
249-
cursor_name : cursor name [Bibata-Modern-Ice]
250-
cursor_size : cursor size [16]
247+
cursor: cursor name with its size (auto add the size if queried) [Bibata-Modern-Ice (16px)]
248+
cursor_name: cursor name [Bibata-Modern-Ice]
249+
cursor_size: cursor size [16]
251250
252251
# If USE_DCONF flag is set, then we're going to use
253252
# dconf, else backing up to gsettings
254253
theme-gsettings
255-
name : gsettings theme name [Decay-Green]
256-
icons : gsettings icons theme name [Papirus-Dark]
257-
font : gsettings font theme name [Cantarell 10]
258-
cursor : gsettings cursor name with its size (auto add the size if queried) [Bibata-Modern-Ice (16px)]
259-
cursor_name : gsettings cursor name [Bibata-Modern-Ice]
260-
cursor_size : gsettings cursor size [16]
254+
name: gsettings theme name [Decay-Green]
255+
icons: gsettings icons theme name [Papirus-Dark]
256+
font: gsettings font theme name [Cantarell 10]
257+
cursor: gsettings cursor name with its size (auto add the size if queried) [Bibata-Modern-Ice (16px)]
258+
cursor_name: gsettings cursor name [Bibata-Modern-Ice]
259+
cursor_size: gsettings cursor size [16]
261260
262261
# the N stands for the gtk version number to query
263262
# so for example if you want to query the gtk3 theme name
264263
# write it like "theme-gtk3.name"
265264
# note: may be slow because of calling "gsettings" if couldn't read from configs.
266265
# Read theme-gsettings module comments
267266
theme-gtkN
268-
name : gtk theme name [Arc-Dark]
269-
icons : gtk icons theme name [Qogir-Dark]
270-
font : gtk font theme name [Noto Sans 10]
267+
name: gtk theme name [Arc-Dark]
268+
icons: gtk icons theme name [Qogir-Dark]
269+
font: gtk font theme name [Noto Sans 10]
271270
272271
# basically as like as the "theme-gtkN" module above
273272
# but with gtk{{2,3,4}} and auto format gkt version
274273
# note: may be slow because of calling "gsettings" if couldn't read from configs.
275274
# Read theme-gsettings module comments
276275
theme-gtk-all
277-
name : gtk theme name [Arc-Dark [GTK2/3/4]]
278-
icons : gtk icons theme name [Papirus-Dark [GTK2/3], Qogir [GTK4]]
279-
font : gtk font theme name [Hack Nerd Font 13 [GTK2], Noto Sans 10 [GTK3/4]]
276+
name: gtk theme name [Arc-Dark [GTK2/3/4]]
277+
icons: gtk icons theme name [Papirus-Dark [GTK2/3], Qogir [GTK4]]
278+
font: gtk font theme name [Hack Nerd Font 13 [GTK2], Noto Sans 10 [GTK3/4]]
280279
281280
# note: these members are auto displayed in from B to YB (depending if using SI byte unit or not(IEC)).
282281
# they all (except those that has the same name as the module or that ends with "_perc")
283282
# have variants from -B to -YB and -B to -YiB
284283
# example: if you want to show your 512MiB of used RAM in GiB
285284
# use the `used-GiB` variant (they don't print the unit tho)
286285
ram
287-
used : used amount of RAM (auto) [2.81 GiB]
288-
free : available amount of RAM (auto) [10.46 GiB]
289-
total : total amount of RAM (auto) [15.88 GiB]
290-
used_perc : percentage of used amount of RAM in total [17.69%]
291-
free_perc : percentage of available amount of RAM in total [82.31%]
286+
used: used amount of RAM (auto) [2.81 GiB]
287+
free: available amount of RAM (auto) [10.46 GiB]
288+
total: total amount of RAM (auto) [15.88 GiB]
289+
used_perc: percentage of used amount of RAM in total [17.69%]
290+
free_perc: percentage of available amount of RAM in total [82.31%]
292291
293292
# same comments as RAM (above)
294293
swap
295-
free : available amount of the swapfile (auto) [34.32 MiB]
296-
total : total amount of the swapfile (auto) [512.00 MiB]
297-
used : used amount of the swapfile (auto) [477.68 MiB]
298-
used_perc : percentage of used amount of the swapfile in total [93.29%]
299-
free_perc : percentage of available amount of the swapfile in total [6.71%]
294+
used: used amount of the swapfile (auto) [477.68 MiB]
295+
free: available amount of the swapfile (auto) [34.32 MiB]
296+
total: total amount of the swapfile (auto) [512.00 MiB]
297+
used_perc: percentage of used amount of the swapfile in total [93.29%]
298+
free_perc: percentage of available amount of the swapfile in total [6.71%]
300299
301300
# same comments as RAM (above)
302301
# note: the module can have either a device path
303302
# or a filesystem path
304303
# e.g disk(/) or disk(/dev/sda5)
305304
disk(/path/to/fs)
306-
used : used amount of disk space (auto) [360.02 GiB]
307-
free : available amount of disk space (auto) [438.08 GiB]
308-
total : total amount of disk space (auto) [100.08 GiB]
309-
used_perc : percentage of used amount of the disk in total [82.18%]
310-
free_perc : percentage of available amount of the disk in total [17.82%]
311-
fs : type of filesystem [ext4]
312-
device : path to device [/dev/sda5]
313-
mountdir : path to the device mount point [/]
305+
used: used amount of disk space (auto) [360.02 GiB]
306+
free: available amount of disk space (auto) [438.08 GiB]
307+
total: total amount of disk space (auto) [100.08 GiB]
308+
used_perc: percentage of used amount of the disk in total [82.18%]
309+
free_perc: percentage of available amount of the disk in total [17.82%]
310+
fs: type of filesystem [ext4]
311+
device: path to device [/dev/sda5]
312+
mountdir: path to the device mount point [/]
314313
315314
# usually people have 1 GPU in their PC,
316315
# but if you got more than 1 and want to query it,
317316
# you should call gpu module with a number, e.g gpu1 (default gpu0).
318317
# Infos are gotten from `/sys/class/drm/` and on each cardN directory
319318
gpu
320-
name : GPU model name [GeForce GTX 1650]
321-
vendor : GPU short vendor name [NVIDIA]
322-
vendor_long : GPU vendor name [NVIDIA Corporation]
319+
name: GPU model name [GeForce GTX 1650]
320+
vendor: GPU short vendor name [NVIDIA]
321+
vendor_long: GPU vendor name [NVIDIA Corporation]
323322
324-
# cpu module has a memeber called "temp" and it has 3 variant units:
323+
# cpu module has a member called "temp" and it has 3 variant units:
325324
# "temp_C" (Celsius) "temp_F" (Fahrenheit) "temp_K" (Kelvin)
326325
cpu
327-
name : CPU model name [AMD Ryzen 5 5500]
328-
temp : CPU temperature (by the choosen unit) [40.62]
329-
nproc : CPU number of virtual proccessors [12]
326+
name: CPU model name [AMD Ryzen 5 5500]
327+
temp: CPU temperature (by the chosen unit) [40.62]
328+
nproc: CPU number of virtual processors [12]
329+
freq_cur: CPU freq (current, in GHz) [3.42]
330+
freq_min: CPU freq (minimum, in GHz) [2.45]
331+
freq_max: CPU freq (maximum, in GHz) [4.90]
330332
freq_bios_limit: CPU freq (limited by bios, in GHz) [4.32]
331-
freq_cur : CPU freq (current, in GHz) [3.42]
332-
freq_min : CPU freq (mininum, in GHz) [2.45]
333-
freq_max : CPU freq (maxinum, in GHz) [4.90]
334333
335334
system
336-
host : Host (aka. Motherboard) model name with vendor and version [Micro-Star International Co., Ltd. PRO B550M-P GEN3 (MS-7D95) 1.0]
337-
host_name : Host (aka. Motherboard) model name [PRO B550M-P GEN3 (MS-7D95)]
338-
host_version : Host (aka. Motherboard) model version [1.0]
339-
host_vendor : Host (aka. Motherboard) model vendor [Micro-Star International Co., Ltd.]
340-
arch : the architecture of the machine [x86_64, aarch64]
335+
host: Host (aka. Motherboard) model name with vendor and version [Micro-Star International Co., Ltd. PRO B550M-P GEN3 (MS-7D95) 1.0]
336+
host_name: Host (aka. Motherboard) model name [PRO B550M-P GEN3 (MS-7D95)]
337+
host_version: Host (aka. Motherboard) model version [1.0]
338+
host_vendor: Host (aka. Motherboard) model vendor [Micro-Star International Co., Ltd.]
339+
arch: the architecture of the machine [x86_64, aarch64]
341340
342341
)");
343342

0 commit comments

Comments
 (0)