Daylight bar chrome + embedded launcher, v0.7.5 pins #5

Merged
Breadway merged 41 commits from feature/theme-spotlight into main 2026-08-31 18:14:19 +08:00
2 changed files with 21 additions and 7 deletions
Showing only changes of commit 1d30818510 - Show all commits

View file

@ -180,8 +180,12 @@ pub fn build_window(store: Store) -> Ui {
// Overrides `[surfaces."breadbar-notif"].width` (320px, the live-toast // Overrides `[surfaces."breadbar-notif"].width` (320px, the live-toast
// popup's width — see `surface::apply`'s doc comment): the history // popup's width — see `surface::apply`'s doc comment): the history
// window genuinely wants a different width on the same namespace, and // window genuinely wants a different width on the same namespace, and
// that isn't something the manifest schema models today. // that isn't something the manifest schema models today. Both calls
// must be overridden, not just `set_default_width` — `apply()` also
// pins `set_size_request` to the toast's 320px, and a bare width alone
// would lose to that pin the same way it lost to a wide child before.
window.set_default_width(360); window.set_default_width(360);
window.set_size_request(360, -1);
window.set_keyboard_mode(KeyboardMode::OnDemand); window.set_keyboard_mode(KeyboardMode::OnDemand);
crate::theme::bind_auto(&window); crate::theme::bind_auto(&window);

View file

@ -19,12 +19,15 @@ use gtk4_layer_shell::{Edge, Layer, LayerShell};
/// gtk4-layer-shell's own defaults rather than panicking, matching every /// gtk4-layer-shell's own defaults rather than panicking, matching every
/// other "malformed/incomplete theme" fallback in this system. /// other "malformed/incomplete theme" fallback in this system.
/// ///
/// Does not set `set_default_width` for a namespace shared by more than one /// The width applied here is not authoritative for a namespace shared by
/// window with genuinely different widths (`breadbar-notif`'s live toast is /// more than one window with genuinely different widths (`breadbar-notif`'s
/// 320px, its history sibling is 360px, and only the toast's width is /// live toast is 320px, its history sibling is 360px, and only the toast's
/// modeled in `[surfaces.*]` — see the Phase 0 constant inventory); callers /// width is modeled in `[surfaces.*]` — see the Phase 0 constant inventory);
/// that need a different width than the theme's own set it explicitly /// callers that need a different width than the theme's own set it
/// afterward. /// explicitly afterward. Because a `Px` width is pinned with BOTH
/// `set_default_width` and `set_size_request` (see below — the latter is
/// what actually holds against a wide child), such a caller must override
/// both, not just `set_default_width`, or the pin from here wins.
pub fn apply(window: &gtk4::Window, namespace: &str) { pub fn apply(window: &gtk4::Window, namespace: &str) {
let theme = crate::theme::shell_theme(); let theme = crate::theme::shell_theme();
let Some(surf) = theme.surfaces().get(namespace) else { let Some(surf) = theme.surfaces().get(namespace) else {
@ -74,5 +77,12 @@ pub fn apply(window: &gtk4::Window, namespace: &str) {
if let SurfaceWidth::Px(px) = surf.width { if let SurfaceWidth::Px(px) = surf.width {
window.set_default_width(px); window.set_default_width(px);
// set_default_width alone is only a preference — a wide child (an
// unwrapped app-name label, or a long summary/body before GTK has
// any allocation narrower than its natural width to wrap against)
// overrides it, so the window renders wider than the theme's
// requested px and stops matching the theme. Same trap, same fix,
// as main.rs's capsule `Width::Px` handling — see its comment.
window.set_size_request(px, -1);
} }
} }