feat(config): add color and layout configuration fields
Swadhin Biswas committed 7 months ago
62078a7
1 parent 3cedbb6
commit 62078a7
1 file changed
+60 -0
Showing 1 changed file+60-0
▼src/config/mod.rs
+60-0
| @@ -158,3 +158,63 @@ pub struct Config { | ||
158 | 158 | #[serde(default = "default_false")] |
159 | 159 | pub show_local_ip: bool, |
160 | 160 | #[serde(default = "default_false")] |
161 | + pub show_public_ip: bool, | |
162 | + #[serde(default = "default_false")] | |
163 | + pub show_locale: bool, | |
164 | + #[serde(default = "default_false")] | |
165 | + pub show_song: bool, | |
166 | + #[serde(default = "default_false")] | |
167 | + pub show_users: bool, | |
168 | + #[serde(default = "default_true")] | |
169 | + pub show_colors: bool, | |
170 | + | |
171 | + // ── Progress bars ──────────────────────────────────────────── | |
172 | + | |
173 | + /// Show progress bar next to memory percentage | |
174 | + #[serde(default = "default_false")] | |
175 | + pub memory_bar: bool, | |
176 | + | |
177 | + /// Show progress bar next to disk percentage | |
178 | + #[serde(default = "default_false")] | |
179 | + pub disk_bar: bool, | |
180 | + | |
181 | + /// Width of progress bars (in chars) | |
182 | + #[serde(default = "default_bar_width")] | |
183 | + pub bar_width: usize, | |
184 | + | |
185 | + // ── Color blocks ───────────────────────────────────────────── | |
186 | + | |
187 | + #[serde(default = "default_block_range")] | |
188 | + pub block_range: (u8, u8), | |
189 | + #[serde(default = "default_block_width")] | |
190 | + pub block_width: usize, | |
191 | + #[serde(default = "default_block_height")] | |
192 | + pub block_height: usize, | |
193 | + | |
194 | + // ── Underline ──────────────────────────────────────────────── | |
195 | + | |
196 | + /// Underline character (neofetch defaults to "-") | |
197 | + #[serde(default = "default_underline_char")] | |
198 | + pub underline_char: String, | |
199 | + | |
200 | + // ── Misc ───────────────────────────────────────────────────── | |
201 | + | |
202 | + /// Stdout mode — disable colors & image backend (for piping) | |
203 | + #[serde(default = "default_false")] | |
204 | + pub stdout: bool, | |
205 | +} | |
206 | + | |
207 | +fn default_true() -> bool { | |
208 | + true | |
209 | +} | |
210 | +fn default_false() -> bool { | |
211 | + false | |
212 | +} | |
213 | +fn default_ascii() -> String { | |
214 | + "ascii".to_string() | |
215 | +} | |
216 | +fn default_auto() -> String { | |
217 | + "auto".to_string() | |
218 | +} | |
219 | +fn default_normal() -> String { | |
220 | + "normal".to_string() | |
161 | 221 | |