2023-07-24 19:31:31 +02:00
|
|
|
use crate::{
|
|
|
|
|
fl,
|
|
|
|
|
utils::iced::{IcedElement, Program},
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
use calloop::LoopHandle;
|
|
|
|
|
use cosmic::{
|
2024-03-27 18:10:33 +01:00
|
|
|
iced::{
|
|
|
|
|
widget::{container, row},
|
|
|
|
|
Alignment,
|
|
|
|
|
},
|
2024-02-09 16:48:03 -08:00
|
|
|
iced_core::{Background, Border, Color, Length},
|
2023-07-24 19:31:31 +02:00
|
|
|
theme,
|
2024-03-27 18:10:33 +01:00
|
|
|
widget::{horizontal_space, icon::from_name, text},
|
2023-10-02 19:37:23 +02:00
|
|
|
Apply,
|
2023-07-24 19:31:31 +02:00
|
|
|
};
|
|
|
|
|
use smithay::utils::{Logical, Size};
|
|
|
|
|
|
|
|
|
|
pub type StackHover = IcedElement<StackHoverInternal>;
|
|
|
|
|
|
|
|
|
|
pub fn stack_hover(
|
2023-09-29 21:33:16 +02:00
|
|
|
evlh: LoopHandle<'static, crate::state::State>,
|
2023-07-24 19:31:31 +02:00
|
|
|
size: Size<i32, Logical>,
|
2023-10-10 13:55:34 -04:00
|
|
|
theme: cosmic::Theme,
|
2023-07-24 19:31:31 +02:00
|
|
|
) -> StackHover {
|
2023-10-10 13:55:34 -04:00
|
|
|
StackHover::new(StackHoverInternal, size, evlh, theme)
|
2023-07-24 19:31:31 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub struct StackHoverInternal;
|
|
|
|
|
|
|
|
|
|
impl Program for StackHoverInternal {
|
|
|
|
|
type Message = ();
|
|
|
|
|
|
2024-02-09 16:48:03 -08:00
|
|
|
fn view(&self) -> cosmic::Element<'_, Self::Message> {
|
2023-07-24 19:31:31 +02:00
|
|
|
row(vec![
|
2023-10-02 19:37:23 +02:00
|
|
|
from_name("window-stack-symbolic")
|
2024-03-27 18:10:33 +01:00
|
|
|
.size(32)
|
2023-10-02 19:37:23 +02:00
|
|
|
.prefer_svg(true)
|
|
|
|
|
.icon()
|
2023-07-24 19:31:31 +02:00
|
|
|
.into(),
|
2024-03-27 18:10:33 +01:00
|
|
|
horizontal_space(16).into(),
|
2024-09-28 13:58:51 +02:00
|
|
|
text::title3(fl!("stack-windows")).into(),
|
2023-07-24 19:31:31 +02:00
|
|
|
])
|
2024-03-27 18:10:33 +01:00
|
|
|
.align_items(Alignment::Center)
|
|
|
|
|
.apply(container)
|
|
|
|
|
.center_x()
|
|
|
|
|
.center_y()
|
|
|
|
|
.padding(16)
|
2023-07-24 19:31:31 +02:00
|
|
|
.apply(container)
|
|
|
|
|
.style(theme::Container::custom(|theme| container::Appearance {
|
2023-10-02 19:37:23 +02:00
|
|
|
icon_color: Some(Color::from(theme.cosmic().accent.on)),
|
2023-07-26 16:21:44 +02:00
|
|
|
text_color: Some(Color::from(theme.cosmic().accent.on)),
|
|
|
|
|
background: Some(Background::Color(theme.cosmic().accent_color().into())),
|
2024-02-09 16:48:03 -08:00
|
|
|
border: Border {
|
2024-03-27 18:10:33 +01:00
|
|
|
radius: 18.0.into(),
|
2024-02-09 16:48:03 -08:00
|
|
|
width: 0.0,
|
|
|
|
|
color: Color::TRANSPARENT,
|
|
|
|
|
},
|
|
|
|
|
shadow: Default::default(),
|
2023-07-24 19:31:31 +02:00
|
|
|
}))
|
|
|
|
|
.width(Length::Shrink)
|
2024-03-27 18:10:33 +01:00
|
|
|
.height(Length::Shrink)
|
2023-07-24 19:31:31 +02:00
|
|
|
.apply(container)
|
|
|
|
|
.width(Length::Fill)
|
|
|
|
|
.height(Length::Fill)
|
2024-03-27 18:10:33 +01:00
|
|
|
.center_x()
|
|
|
|
|
.center_y()
|
2023-07-24 19:31:31 +02:00
|
|
|
.into()
|
|
|
|
|
}
|
|
|
|
|
}
|