Skip to content

A fast file manager for Windows and macOS that never freezes: tabs, dual panes, archives as folders, Quick Look-style previews. A File Explorer and Finder alternative written in Rust.

dock: restore proportional right-island status icon sizing

Konstantin Pertsevca89391ab7f8
diff --git a/crates/rf-app/src/dock/right.rs b/crates/rf-app/src/dock/right.rs
index 01680e25..452d637f 100644
--- a/crates/rf-app/src/dock/right.rs
+++ b/crates/rf-app/src/dock/right.rs
@@ -77,10 +77,14 @@ struct StatusPress {
target: Option<usize>,
}
-/// How often the pointer is looked at while one of the island's own buttons is held (the tray strip's rate).
-/// The right island's symbols (network, volume, the bell…), logical px.
+/// The right island's symbols (network, volume, the bell…), dock units: sized to sit within the 20-unit separator
+/// height and balance with the 16-unit tray icons, language label, and two-line clock inside the 32-unit button.
const STATUS_GLYPH: f32 = 18.0;
+const BELL_DOT_TOP: f32 = 7.0;
+const BELL_DOT_RIGHT: f32 = 8.0;
+const BELL_DOT_SIZE: f32 = 8.0;
+/// How often the pointer is looked at while one of the island's own buttons is held (the tray strip's rate).
const STATUS_POLL: Duration = Duration::from_millis(16);
/// How often the removable drives are looked at (off the UI thread: a few system calls).
@@ -682,7 +686,7 @@ fn bell_button(pal: Palette, dot: Option<Hsla>, k: f32, on_click: impl Fn(&mut A
.hover(move |s| s.bg(hover))
.active(move |s| s.bg(pressed))
.child(Icon::new(L::Bell).size(px(STATUS_GLYPH * k)).text_color(pal.text().hsla()))
- .when_some(dot, |d, color| d.child(div().absolute().top(px(7. * k)).right(px(8. * k)).size(px(8. * k)).rounded_full().bg(color)))
+ .when_some(dot, |d, color| d.child(div().absolute().top(px(BELL_DOT_TOP * k)).right(px(BELL_DOT_RIGHT * k)).size(px(BELL_DOT_SIZE * k)).rounded_full().bg(color)))
.on_click(move |_, _, cx| on_click(cx))
}
@@ -947,4 +951,22 @@ mod tests {
assert_eq!(super::classify_home_hit(6, 2, true, &buttons, true), Some(Spot::Bell));
assert_eq!(super::classify_home_hit(7, 2, true, &buttons, true), Some(Spot::Glass), "show desktop strip");
}
+
+ #[test]
+ fn status_glyphs_fit_within_buttons_and_separator_height() {
+ use super::{BELL_DOT_RIGHT, BELL_DOT_SIZE, BELL_DOT_TOP, STATUS_GLYPH, plan};
+ use rf_win::dock::tray_strip as ts;
+
+ assert!(STATUS_GLYPH >= ts::ICON);
+ assert!(STATUS_GLYPH <= plan::RIGHT_SEP_HEIGHT, "status icons should not exceed the separator height");
+ assert!(STATUS_GLYPH <= plan::BUTTON - 8.0, "status icons keep breathing room inside the 32-unit button");
+
+ // The bell badge stays anchored to the upper-right corner of the centered glyph across dock scales.
+ let glyph_left = (plan::BUTTON - STATUS_GLYPH) / 2.0;
+ let glyph_right = glyph_left + STATUS_GLYPH;
+ let dot_right = plan::BUTTON - BELL_DOT_RIGHT;
+ let dot_left = dot_right - BELL_DOT_SIZE;
+ assert!(dot_left >= glyph_left && dot_right <= glyph_right + 1.0);
+ assert!(BELL_DOT_TOP >= glyph_left - 1.0 && BELL_DOT_TOP + BELL_DOT_SIZE <= glyph_right);
+ }
}