Skip to content

Commit fd9fa70

Browse files
committed
misc: update configs + some code renames
1 parent 34639b8 commit fd9fa70

File tree

9 files changed

+147
-58
lines changed

9 files changed

+147
-58
lines changed

assets/config-examples/config_cool.toml

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,17 +74,32 @@ source-path = "os"
7474
# note: it MUST contain an "ascii" subdirectory
7575
data-dir = "/usr/share/customfetch"
7676

77-
# A separetor (string) that when ecountered, will automatically
77+
# The type of ASCII art to apply ("small", "old").
78+
# Basically will add "_<type>" to the logo filename.
79+
# It will return the regular linux ascii art if it doesn't exist.
80+
# Leave empty it for regular.
81+
ascii-logo-type = ""
82+
83+
# A char (or string) to use in $<user.title_sep>
84+
sep-title = "-"
85+
86+
# A separetor (or string) that when ecountered, will automatically
7887
# reset color, aka. automatically add ${0} (only in layout)
7988
# Make it empty for disabling
8089
sep-reset = ":"
8190

82-
# Offset between the ascii art and the system infos
91+
# Offset between the ascii art and the layout
8392
offset = 5
8493

85-
# Padding of the logo from the top
94+
# Padding between the start and the ascii art
95+
logo-padding-left = 0
96+
97+
# Padding of the ascii art from the top
8698
logo-padding-top = 0
8799

100+
# Padding of the layout from the top
101+
layout-padding-top = 0
102+
88103
# Colors can be with: hexcodes (#55ff88) and for bold put '!' (!#55ff88)
89104
# OR ANSI escape code colors like "\e[1;34m"
90105
# remember to add ${0} where you want to reset color
@@ -110,13 +125,23 @@ secs = " seconds"
110125
[os.pkgs]
111126
# Ordered list of which packages installed count should be displayed in $<os.pkgs>
112127
# remember to not enter the same name twice, else the world will finish
113-
# Choices: pacman, flatpak, dpkg
128+
# Choices: pacman, flatpak, dpkg, apk
114129
#
115130
# Pro-tip: if your package manager isnt listed here, yet,
116131
# use the bash command component in the layout
117132
# e.g "Packages: $(pacman -Q | wc -l) (pacman)"
118133
pkg-managers = ["pacman", "dpkg", "flatpak"]
119134

135+
# Distros and package manager specific
136+
# package manager paths for getting the packages count from path.
137+
# They are arrayies so you can add multiple paths.
138+
#
139+
# If you don't know what these ares, leave them by default settings
140+
pacman-dirs = ["/var/lib/pacman/local/"]
141+
dpkg-files = ["/var/lib/dpkg/status"]
142+
flatpak-dirs = ["/var/lib/flatpak/app/", "~/.local/share/flatpak/app/"]
143+
apk-files = ["/var/lib/apk/db/installed"]
144+
120145
# GUI options
121146
# note: customfetch needs to be compiled with GUI_MODE=1 (check with "cufetch --version")
122147
[gui]

assets/config-examples/config_modified.toml

Lines changed: 38 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -61,37 +61,52 @@ source-path = "os"
6161
# note: it MUST contain an "ascii" subdirectory
6262
data-dir = "/usr/share/customfetch"
6363

64-
# A separetor (string) that when ecountered, will automatically
64+
# The type of ASCII art to apply ("small", "old").
65+
# Basically will add "_<type>" to the logo filename.
66+
# It will return the regular linux ascii art if it doesn't exist.
67+
# Leave empty it for regular.
68+
ascii-logo-type = ""
69+
70+
# A char (or string) to use in $<user.title_sep>
71+
sep-title = "-"
72+
73+
# A separetor (or string) that when ecountered, will automatically
6574
# reset color, aka. automatically add ${0} (only in layout)
6675
# Make it empty for disabling
6776
sep-reset = ":"
6877

69-
# Offset between the ascii art and the system infos
78+
# Offset between the ascii art and the layout
7079
offset = 5
7180

72-
# Padding of the logo from the top
81+
# Padding between the start and the ascii art
82+
logo-padding-left = 0
83+
84+
# Padding of the ascii art from the top
7385
logo-padding-top = 0
7486

87+
# Padding of the layout from the top
88+
layout-padding-top = 0
89+
7590
# Colors can be with: hexcodes (#55ff88) and for bold put '!' (!#55ff88)
7691
# OR ANSI escape code colors like "\e[1;34m"
7792
# remember to add ${0} where you want to reset color
78-
black = "\e[1;30m"
79-
red = "\e[1;31m"
80-
green = "\e[1;32m"
81-
yellow = "\e[1;33m"
82-
blue = "\e[1;34m"
93+
black = "\e[1;30m"
94+
red = "\e[1;31m"
95+
green = "\e[1;32m"
96+
yellow = "\e[1;33m"
97+
blue = "\e[1;34m"
8398
magenta = "\e[1;35m"
84-
cyan = "\e[1;36m"
85-
white = "\e[1;37m"
99+
cyan = "\e[1;36m"
100+
white = "\e[1;37m"
86101

87102
# $<os.uptime> config
88103
[os.uptime]
89104
# how to display the name of the uptime
90105
# e.g: hours = "hrs" -> "Uptime: 3hrs"
91-
days = " days"
106+
days = " days"
92107
hours = " hours"
93-
mins = " mins"
94-
secs = " seconds"
108+
mins = " mins"
109+
secs = " seconds"
95110

96111
# $<os.pkgs> config
97112
[os.pkgs]
@@ -104,6 +119,16 @@ secs = " seconds"
104119
# e.g "Packages: $(pacman -Q | wc -l) (pacman)"
105120
pkg-managers = ["pacman", "dpkg", "flatpak"]
106121

122+
# Distros and package manager specific
123+
# package manager paths for getting the packages count from path.
124+
# They are arrayies so you can add multiple paths.
125+
#
126+
# If you don't know what these ares, leave them by default settings
127+
pacman-dirs = ["/var/lib/pacman/local/"]
128+
dpkg-files = ["/var/lib/dpkg/status"]
129+
flatpak-dirs = ["/var/lib/flatpak/app/", "~/.local/share/flatpak/app/"]
130+
apk-files = ["/var/lib/apk/db/installed"]
131+
107132
# GUI options
108133
# note: customfetch needs to be compiled with GUI_MODE=1 (which is enabled by default)
109134
[gui]

assets/config-examples/config_simple.toml

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,17 +52,32 @@ source-path = "os"
5252
# note: it MUST contain an "ascii" subdirectory
5353
data-dir = "/usr/share/customfetch"
5454

55-
# A separetor (string) that when ecountered, will automatically
55+
# The type of ASCII art to apply ("small", "old").
56+
# Basically will add "_<type>" to the logo filename.
57+
# It will return the regular linux ascii art if it doesn't exist.
58+
# Leave empty it for regular.
59+
ascii-logo-type = ""
60+
61+
# A char (or string) to use in $<user.title_sep>
62+
sep-title = "-"
63+
64+
# A separetor (or string) that when ecountered, will automatically
5665
# reset color, aka. automatically add ${0} (only in layout)
5766
# Make it empty for disabling
5867
sep-reset = ":"
5968

60-
# Offset between the ascii art and the system infos
69+
# Offset between the ascii art and the layout
6170
offset = 5
6271

63-
# Padding of the logo from the top
72+
# Padding between the start and the ascii art
73+
logo-padding-left = 0
74+
75+
# Padding of the ascii art from the top
6476
logo-padding-top = 0
6577

78+
# Padding of the layout from the top
79+
layout-padding-top = 0
80+
6681
# Colors can be with: hexcodes (#55ff88) and for bold put '!' (!#55ff88)
6782
# OR ANSI escape code colors like "\e[1;34m"
6883
# remember to add ${0} where you want to reset color
@@ -95,6 +110,16 @@ secs = " seconds"
95110
# e.g "Packages: $(pacman -Q | wc -l) (pacman)"
96111
pkg-managers = ["pacman", "dpkg", "flatpak"]
97112

113+
# Distros and package manager specific
114+
# package manager paths for getting the packages count from path.
115+
# They are arrayies so you can add multiple paths.
116+
#
117+
# If you don't know what these ares, leave them by default settings
118+
pacman-dirs = ["/var/lib/pacman/local/"]
119+
dpkg-files = ["/var/lib/dpkg/status"]
120+
flatpak-dirs = ["/var/lib/flatpak/app/", "~/.local/share/flatpak/app/"]
121+
apk-files = ["/var/lib/apk/db/installed"]
122+
98123
# GUI options
99124
# note: customfetch needs to be compiled with GUI_MODE=1 (which is enabled by default)
100125
[gui]

assets/config-examples/nitch_like_config.toml

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,15 @@ sep-reset = ":"
7171
# Offset between the ascii art and the system infos
7272
offset = 3
7373

74-
# Offset between the start and the ascii art
75-
pre-logo-offset = 3
74+
# Padding between the start and the ascii art
75+
logo-padding-left = 3
7676

77-
# Padding of the logo from the top
77+
# Padding of the ascii art from the top
7878
logo-padding-top = 3
7979

80+
# Padding of the layout from the top
81+
layout-padding-top = 0
82+
8083
# Colors can be with: hexcodes (#55ff88) and for bold put '!' (!#55ff88)
8184
# OR ANSI escape code colors like "\e[1;34m"
8285
# remember to add ${0} where you want to reset color
@@ -109,6 +112,16 @@ secs = " seconds"
109112
# e.g "Packages: $(pacman -Q | wc -l) (pacman)"
110113
pkg-managers = ["pacman", "dpkg", "flatpak"]
111114

115+
# Distros and package manager specific
116+
# package manager paths for getting the packages count from path.
117+
# They are arrayies so you can add multiple paths.
118+
#
119+
# If you don't know what these ares, leave them by default settings
120+
pacman-dirs = ["/var/lib/pacman/local/"]
121+
dpkg-files = ["/var/lib/dpkg/status"]
122+
flatpak-dirs = ["/var/lib/flatpak/app/", "~/.local/share/flatpak/app/"]
123+
apk-files = ["/var/lib/apk/db/installed"]
124+
112125
# GUI options
113126
# note: customfetch needs to be compiled with GUI_MODE=1 (check with "cufetch --version")
114127
[gui]

include/config.hpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class Config
3535
Config(const std::string_view configFile, const std::string_view configDir, colors_t& colors);
3636

3737
// config file
38-
std::vector<std::string> layouts;
38+
std::vector<std::string> layout;
3939
std::string source_path;
4040
std::string font;
4141
std::string data_dir;
@@ -182,23 +182,23 @@ layout-padding-top = 0
182182
# Colors can be with: hexcodes (#55ff88) and for bold put '!' (!#55ff88)
183183
# OR ANSI escape code colors like "\e[1;34m"
184184
# remember to add ${0} where you want to reset color
185-
black = "\e[1;30m"
186-
red = "\e[1;31m"
187-
green = "\e[1;32m"
188-
yellow = "\e[1;33m"
189-
blue = "\e[1;34m"
185+
black = "\e[1;30m"
186+
red = "\e[1;31m"
187+
green = "\e[1;32m"
188+
yellow = "\e[1;33m"
189+
blue = "\e[1;34m"
190190
magenta = "\e[1;35m"
191-
cyan = "\e[1;36m"
192-
white = "\e[1;37m"
191+
cyan = "\e[1;36m"
192+
white = "\e[1;37m"
193193
194194
# $<os.uptime> config
195195
[os.uptime]
196196
# how to display the name of the uptime
197197
# e.g: hours = "hrs" -> "Uptime: 3hrs"
198-
days = " days"
198+
days = " days"
199199
hours = " hours"
200-
mins = " mins"
201-
secs = " seconds"
200+
mins = " mins"
201+
secs = " seconds"
202202
203203
# $<os.pkgs> config
204204
[os.pkgs]
@@ -214,7 +214,7 @@ pkg-managers = ["pacman", "dpkg", "flatpak"]
214214
# Distros and package manager specific
215215
# package manager paths for getting the packages count from path.
216216
# They are arrayies so you can add multiple paths.
217-
#
217+
#
218218
# If you don't know what these ares, leave them by default settings
219219
pacman-dirs = ["/var/lib/pacman/local/"]
220220
dpkg-files = ["/var/lib/dpkg/status"]

src/config.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ void Config::loadConfigFile(const std::string_view filename, colors_t& colors)
3838

3939
// clang-format off
4040
// Idk but with `this->` looks more readable
41-
this->layouts = this->getValueArrayStr("config.layout", {});
41+
this->layout = this->getValueArrayStr("config.layout", {});
4242
this->gui = this->getValue<bool>("gui.enable", false);
4343
this->ascii_logo_type = this->getValue<std::string>("config.ascii-logo-type", "");
4444
this->source_path = this->getValue<std::string>("config.source-path", "os");

src/display.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ std::vector<std::string> Display::render(const Config& config, const colors_t& c
4444
const std::string_view path)
4545
{
4646
systemInfo_t systemInfo{};
47-
std::vector<std::string> asciiArt{}, layouts{ config.layouts };
47+
std::vector<std::string> asciiArt{}, layout{ config.layout };
4848

4949
if (!config.m_display_distro && !config.m_disable_source && !config.source_path.empty())
5050
{
@@ -89,7 +89,7 @@ std::vector<std::string> Display::render(const Config& config, const colors_t& c
8989

9090
for (int i = 0; i < config.layout_padding_top; i++)
9191
{
92-
layouts.insert(layouts.begin(), "");
92+
layout.insert(layout.begin(), "");
9393
}
9494

9595
while (std::getline(file, line))
@@ -140,26 +140,26 @@ std::vector<std::string> Display::render(const Config& config, const colors_t& c
140140
return asciiArt;
141141

142142
std::string _;
143-
for (std::string& layout : layouts)
143+
for (std::string& layout : layout)
144144
layout = parse(layout, systemInfo, _, config, colors, true);
145145

146146
// erase each element for each instance of MAGIC_LINE
147-
layouts.erase(std::remove_if(layouts.begin(), layouts.end(),
147+
layout.erase(std::remove_if(layout.begin(), layout.end(),
148148
[](const std::string_view str) { return str.find(MAGIC_LINE) != std::string::npos; }),
149-
layouts.end());
149+
layout.end());
150150

151151
size_t i;
152-
for (i = 0; i < layouts.size(); i++)
152+
for (i = 0; i < layout.size(); i++)
153153
{
154154
size_t origin = config.logo_padding_left;
155155

156156
// The user-specified offset to be put before the logo
157157
for (size_t j = 0; j < config.logo_padding_left; j++)
158-
layouts.at(i).insert(0, " ");
158+
layout.at(i).insert(0, " ");
159159

160160
if (i < asciiArt.size())
161161
{
162-
layouts.at(i).insert(origin, asciiArt.at(i));
162+
layout.at(i).insert(origin, asciiArt.at(i));
163163
origin += asciiArt.at(i).length();
164164
}
165165

@@ -169,9 +169,9 @@ std::vector<std::string> Display::render(const Config& config, const colors_t& c
169169
debug("spaces: {}", spaces);
170170

171171
for (size_t j = 0; j < spaces; j++)
172-
layouts.at(i).insert(origin, " ");
172+
layout.at(i).insert(origin, " ");
173173

174-
layouts.at(i) += config.gui ? "" : NOCOLOR;
174+
layout.at(i) += config.gui ? "" : NOCOLOR;
175175
}
176176

177177
for (; i < asciiArt.size(); i++)
@@ -183,10 +183,10 @@ std::vector<std::string> Display::render(const Config& config, const colors_t& c
183183

184184
line += asciiArt[i];
185185

186-
layouts.push_back(line);
186+
layout.push_back(line);
187187
}
188188

189-
return layouts;
189+
return layout;
190190
}
191191

192192
void Display::display(const std::vector<std::string>& renderResult)

0 commit comments

Comments
 (0)