fix: opacity

This commit is contained in:
Ashley Wulber 2025-10-06 15:02:34 -04:00 committed by Ashley Wulber
parent 4599e1bb68
commit e40b955f33
3 changed files with 31 additions and 20 deletions

View file

@ -2749,6 +2749,7 @@ impl Application for App {
.on_window_unfocused(|| Message::WindowUnfocused)
.opacity(self.config.opacity_ratio())
.padding(space_xxs)
.sharp_corners(self.core.window.sharp_corners)
.show_headerbar(self.config.show_headerbar);
if self.config.focus_follow_mouse {

View file

@ -65,6 +65,7 @@ pub struct TerminalBox<'a, Message> {
on_window_focused: Option<Box<dyn Fn() -> Message + 'a>>,
on_window_unfocused: Option<Box<dyn Fn() -> Message + 'a>>,
key_binds: HashMap<KeyBind, Action>,
sharp_corners: bool,
}
impl<'a, Message> TerminalBox<'a, Message>
@ -89,6 +90,7 @@ where
on_open_hyperlink: None,
on_window_focused: None,
on_window_unfocused: None,
sharp_corners: false,
}
}
@ -145,6 +147,11 @@ where
self
}
pub fn sharp_corners(mut self, sharp_corners: bool) -> Self {
self.sharp_corners = sharp_corners;
self
}
pub fn on_open_hyperlink(
mut self,
on_open_hyperlink: Option<Box<dyn Fn(String) -> Message + 'a>>,
@ -294,9 +301,12 @@ where
let cosmic_theme = theme.cosmic();
// matches the corners to the window border
let corner_radius = cosmic_theme
.radius_s()
.map(|x| if x < 4.0 { x - 1.0 } else { x + 3.0 });
let corner_radius = if self.sharp_corners {
cosmic_theme.radius_0()
} else {
cosmic_theme.radius_s()
}
.map(|x| if x < 4.0 { x - 1.0 } else { x + 3.0 });
let scrollbar_w = f32::from(cosmic_theme.spacing.space_xxs);
let view_position = layout.position() + [self.padding.left, self.padding.top].into();