From 6bbd88153ba2d98a0ac4056d3d1b11a11faac7c6 Mon Sep 17 00:00:00 2001 From: Hakan Seven Date: Fri, 10 Jul 2026 15:45:20 +0300 Subject: [PATCH] feat(statusbar): hide niche pills by default, user opts them in MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The status bar showed all 17 pills out of the box. Hide the informational / niche ones by default so the bar stays uncluttered — Coordinates, Show Lineweight, Dynamic Input, Model/Paper Space, Drawing Units, Show Transparency, Selection Cycling and Viewport Count. The user turns any of them back on from the customization (gear) menu, which persists to statusbar.txt. The main drafting toggles (Ortho, Polar, Otrack, Osnap, …) stay visible. An existing statusbar.txt (even empty = user showed everything) is authoritative; only a fresh install with no config gets the new defaults. Co-Authored-By: Claude Opus 4.8 --- src/ui/statusbar/statusbar_config.rs | 53 ++++++++++++++++++++-------- 1 file changed, 38 insertions(+), 15 deletions(-) diff --git a/src/ui/statusbar/statusbar_config.rs b/src/ui/statusbar/statusbar_config.rs index 213ed571c..cd219cc36 100644 --- a/src/ui/statusbar/statusbar_config.rs +++ b/src/ui/statusbar/statusbar_config.rs @@ -104,27 +104,50 @@ impl StatusPill { } } -/// Tracks which pills the user has hidden. Empty = every pill visible. -#[derive(Clone, Default)] +/// Tracks which pills the user has hidden. +#[derive(Clone)] pub struct StatusBarConfig { hidden: HashSet, } -impl StatusBarConfig { - /// Load the saved customization, or all-visible when none exists. - pub fn load() -> Self { - let mut hidden = HashSet::default(); - if let Some(path) = config_path() { - if let Ok(body) = std::fs::read_to_string(path) { - for line in body.lines() { - if let Some(p) = StatusPill::from_id(line.trim()) { - hidden.insert(p); - } - } - } - } +impl Default for StatusBarConfig { + /// The out-of-the-box bar: a few informational / niche pills are hidden by + /// default to keep it uncluttered, and the user turns them on from the + /// customization (⚙) menu if wanted. The mode toggles that matter most + /// (Ortho, Polar, Otrack, Osnap, …) stay visible. + fn default() -> Self { + let hidden = [ + StatusPill::Coords, + StatusPill::Lwt, + StatusPill::Dyn, + StatusPill::Space, + StatusPill::Units, + StatusPill::Transparency, + StatusPill::SelCycle, + StatusPill::Vp, + ] + .into_iter() + .collect(); Self { hidden } } +} + +impl StatusBarConfig { + /// Load the saved customization. When no config file exists yet, fall back + /// to the shipped defaults ([`StatusBarConfig::default`]); an existing file + /// (even an empty one — the user showed every pill) is authoritative. + pub fn load() -> Self { + match config_path().and_then(|p| std::fs::read_to_string(p).ok()) { + Some(body) => { + let hidden = body + .lines() + .filter_map(|l| StatusPill::from_id(l.trim())) + .collect(); + Self { hidden } + } + None => Self::default(), + } + } pub fn is_visible(&self, pill: StatusPill) -> bool { !self.hidden.contains(&pill)