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 <[email protected]>
This commit is contained in:
Hakan SevenandClaude Opus 4.8 committed 2026-07-10 15:45:20 +03:00
1 parent da2c600953
commit 6bbd88153b
1 file changed
+38 -15
+38 -15
View File
@@ -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<StatusPill>,
}
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)