feat(statusbar): hide niche pills by default, user opts them in

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 <noreply@anthropic.com>
This commit is contained in:
Hakan Seven 2026-07-10 15:45:20 +03:00
commit 6bbd88153b

View file

@ -104,27 +104,50 @@ impl StatusPill {
} }
} }
/// Tracks which pills the user has hidden. Empty = every pill visible. /// Tracks which pills the user has hidden.
#[derive(Clone, Default)] #[derive(Clone)]
pub struct StatusBarConfig { pub struct StatusBarConfig {
hidden: HashSet<StatusPill>, hidden: HashSet<StatusPill>,
} }
impl StatusBarConfig { impl Default for StatusBarConfig {
/// Load the saved customization, or all-visible when none exists. /// The out-of-the-box bar: a few informational / niche pills are hidden by
pub fn load() -> Self { /// default to keep it uncluttered, and the user turns them on from the
let mut hidden = HashSet::default(); /// customization (⚙) menu if wanted. The mode toggles that matter most
if let Some(path) = config_path() { /// (Ortho, Polar, Otrack, Osnap, …) stay visible.
if let Ok(body) = std::fs::read_to_string(path) { fn default() -> Self {
for line in body.lines() { let hidden = [
if let Some(p) = StatusPill::from_id(line.trim()) { StatusPill::Coords,
hidden.insert(p); StatusPill::Lwt,
} StatusPill::Dyn,
} StatusPill::Space,
} StatusPill::Units,
} StatusPill::Transparency,
StatusPill::SelCycle,
StatusPill::Vp,
]
.into_iter()
.collect();
Self { hidden } 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 { pub fn is_visible(&self, pill: StatusPill) -> bool {
!self.hidden.contains(&pill) !self.hidden.contains(&pill)