chore: Update libcosmic
This commit is contained in:
parent
4e12957169
commit
2a0b1cf7e9
10 changed files with 267 additions and 206 deletions
|
|
@ -7,13 +7,13 @@ use crate::{
|
|||
utils::iced::{IcedElement, Program},
|
||||
};
|
||||
|
||||
use apply::Apply;
|
||||
use calloop::LoopHandle;
|
||||
use cosmic::{
|
||||
iced::widget::{column, container, horizontal_space, row, vertical_space},
|
||||
iced_core::{Background, Color, Length},
|
||||
theme,
|
||||
widget::{icon, text},
|
||||
widget::{icon::from_name, text},
|
||||
Apply,
|
||||
};
|
||||
use smithay::utils::Size;
|
||||
|
||||
|
|
@ -64,26 +64,29 @@ impl Program for ResizeIndicatorInternal {
|
|||
|
||||
fn view(&self) -> crate::utils::iced::Element<'_, Self::Message> {
|
||||
let edges = self.edges.lock().unwrap();
|
||||
let icon_container_style = || {
|
||||
theme::Container::custom(|theme| container::Appearance {
|
||||
icon_color: Some(Color::from(theme.cosmic().accent.on)),
|
||||
text_color: Some(Color::from(theme.cosmic().accent.on)),
|
||||
background: Some(Background::Color(theme.cosmic().accent_color().into())),
|
||||
border_radius: 18.0.into(),
|
||||
border_width: 0.0,
|
||||
border_color: Color::TRANSPARENT,
|
||||
})
|
||||
};
|
||||
|
||||
column(vec![
|
||||
if edges.contains(ResizeEdge::TOP) {
|
||||
icon(
|
||||
if self.direction == ResizeDirection::Outwards {
|
||||
"go-up-symbolic"
|
||||
} else {
|
||||
"go-down-symbolic"
|
||||
},
|
||||
32,
|
||||
)
|
||||
.force_svg(true)
|
||||
from_name(if self.direction == ResizeDirection::Outwards {
|
||||
"go-up-symbolic"
|
||||
} else {
|
||||
"go-down-symbolic"
|
||||
})
|
||||
.size(32)
|
||||
.prefer_svg(true)
|
||||
.apply(container)
|
||||
.padding(2)
|
||||
.style(theme::Container::custom(|theme| container::Appearance {
|
||||
text_color: Some(Color::from(theme.cosmic().accent.on)),
|
||||
background: Some(Background::Color(theme.cosmic().accent_color().into())),
|
||||
border_radius: 18.0.into(),
|
||||
border_width: 0.0,
|
||||
border_color: Color::TRANSPARENT,
|
||||
}))
|
||||
.style(icon_container_style())
|
||||
.width(Length::Shrink)
|
||||
.apply(container)
|
||||
.center_x()
|
||||
|
|
@ -94,24 +97,16 @@ impl Program for ResizeIndicatorInternal {
|
|||
},
|
||||
row(vec![
|
||||
if edges.contains(ResizeEdge::LEFT) {
|
||||
icon(
|
||||
if self.direction == ResizeDirection::Outwards {
|
||||
"go-previous-symbolic"
|
||||
} else {
|
||||
"go-next-symbolic"
|
||||
},
|
||||
32,
|
||||
)
|
||||
.force_svg(true)
|
||||
from_name(if self.direction == ResizeDirection::Outwards {
|
||||
"go-previous-symbolic"
|
||||
} else {
|
||||
"go-next-symbolic"
|
||||
})
|
||||
.size(32)
|
||||
.prefer_svg(true)
|
||||
.apply(container)
|
||||
.padding(4)
|
||||
.style(theme::Container::custom(|theme| container::Appearance {
|
||||
text_color: Some(Color::from(theme.cosmic().accent.on)),
|
||||
background: Some(Background::Color(theme.cosmic().accent_color().into())),
|
||||
border_radius: 18.0.into(),
|
||||
border_width: 0.0,
|
||||
border_color: Color::TRANSPARENT,
|
||||
}))
|
||||
.style(icon_container_style())
|
||||
.width(Length::Shrink)
|
||||
.apply(container)
|
||||
.center_y()
|
||||
|
|
@ -144,13 +139,7 @@ impl Program for ResizeIndicatorInternal {
|
|||
.center_y()
|
||||
.padding(16)
|
||||
.apply(container)
|
||||
.style(theme::Container::custom(|theme| container::Appearance {
|
||||
text_color: Some(Color::from(theme.cosmic().accent.on)),
|
||||
background: Some(Background::Color(theme.cosmic().accent_color().into())),
|
||||
border_radius: 18.0.into(),
|
||||
border_width: 0.0,
|
||||
border_color: Color::TRANSPARENT,
|
||||
}))
|
||||
.style(icon_container_style())
|
||||
.width(Length::Shrink)
|
||||
.height(Length::Shrink)
|
||||
.apply(container)
|
||||
|
|
@ -160,24 +149,16 @@ impl Program for ResizeIndicatorInternal {
|
|||
.center_y()
|
||||
.into(),
|
||||
if edges.contains(ResizeEdge::RIGHT) {
|
||||
icon(
|
||||
if self.direction == ResizeDirection::Outwards {
|
||||
"go-next-symbolic"
|
||||
} else {
|
||||
"go-previous-symbolic"
|
||||
},
|
||||
32,
|
||||
)
|
||||
.force_svg(true)
|
||||
from_name(if self.direction == ResizeDirection::Outwards {
|
||||
"go-next-symbolic"
|
||||
} else {
|
||||
"go-previous-symbolic"
|
||||
})
|
||||
.size(32)
|
||||
.prefer_svg(true)
|
||||
.apply(container)
|
||||
.padding(4)
|
||||
.style(theme::Container::custom(|theme| container::Appearance {
|
||||
text_color: Some(Color::from(theme.cosmic().accent.on)),
|
||||
background: Some(Background::Color(theme.cosmic().accent_color().into())),
|
||||
border_radius: 18.0.into(),
|
||||
border_width: 0.0,
|
||||
border_color: Color::TRANSPARENT,
|
||||
}))
|
||||
.style(icon_container_style())
|
||||
.height(Length::Shrink)
|
||||
.apply(container)
|
||||
.center_y()
|
||||
|
|
@ -191,24 +172,16 @@ impl Program for ResizeIndicatorInternal {
|
|||
.height(Length::Fill)
|
||||
.into(),
|
||||
if edges.contains(ResizeEdge::BOTTOM) {
|
||||
icon(
|
||||
if self.direction == ResizeDirection::Outwards {
|
||||
"go-down-symbolic"
|
||||
} else {
|
||||
"go-up-symbolic"
|
||||
},
|
||||
32,
|
||||
)
|
||||
.force_svg(true)
|
||||
from_name(if self.direction == ResizeDirection::Outwards {
|
||||
"go-down-symbolic"
|
||||
} else {
|
||||
"go-up-symbolic"
|
||||
})
|
||||
.size(32)
|
||||
.prefer_svg(true)
|
||||
.apply(container)
|
||||
.padding(4)
|
||||
.style(theme::Container::custom(|theme| container::Appearance {
|
||||
text_color: Some(Color::from(theme.cosmic().accent.on)),
|
||||
background: Some(Background::Color(theme.cosmic().accent_color().into())),
|
||||
border_radius: 18.0.into(),
|
||||
border_width: 0.0,
|
||||
border_color: Color::TRANSPARENT,
|
||||
}))
|
||||
.style(icon_container_style())
|
||||
.width(Length::Shrink)
|
||||
.apply(container)
|
||||
.center_x()
|
||||
|
|
|
|||
|
|
@ -8,14 +8,13 @@ use crate::{
|
|||
utils::prelude::SeatExt,
|
||||
wayland::handlers::screencopy::ScreencopySessions,
|
||||
};
|
||||
use apply::Apply;
|
||||
use calloop::LoopHandle;
|
||||
use cosmic::{
|
||||
iced::{id::Id, widget as iced_widget},
|
||||
iced_core::{Background, BorderRadius, Color, Length},
|
||||
iced_runtime::Command,
|
||||
iced_widget::scrollable::AbsoluteOffset,
|
||||
theme, widget as cosmic_widget, Element as CosmicElement,
|
||||
theme, widget as cosmic_widget, Apply, Element as CosmicElement,
|
||||
};
|
||||
use cosmic_protocols::screencopy::v1::server::zcosmic_screencopy_session_v1::InputType;
|
||||
use once_cell::sync::Lazy;
|
||||
|
|
@ -652,8 +651,10 @@ impl Program for CosmicStackInternal {
|
|||
let group_focused = self.group_focused.load(Ordering::SeqCst);
|
||||
|
||||
let elements = vec![
|
||||
cosmic_widget::icon("window-stack-symbolic", 16)
|
||||
.force_svg(true)
|
||||
cosmic_widget::icon::from_name("window-stack-symbolic")
|
||||
.size(16)
|
||||
.prefer_svg(true)
|
||||
.icon()
|
||||
.style(if group_focused {
|
||||
theme::Svg::custom(|theme| iced_widget::svg::Appearance {
|
||||
color: Some(if theme.cosmic().is_dark {
|
||||
|
|
@ -663,7 +664,7 @@ impl Program for CosmicStackInternal {
|
|||
}),
|
||||
})
|
||||
} else {
|
||||
theme::Svg::Symbolic
|
||||
theme::Svg::Default
|
||||
})
|
||||
.apply(iced_widget::container)
|
||||
.padding([4, 24])
|
||||
|
|
@ -712,6 +713,7 @@ impl Program for CosmicStackInternal {
|
|||
.center_y()
|
||||
.style(if self.group_focused.load(Ordering::SeqCst) {
|
||||
theme::Container::custom(|theme| iced_widget::container::Appearance {
|
||||
icon_color: Some(Color::from(theme.cosmic().background.on)),
|
||||
text_color: Some(Color::from(theme.cosmic().background.on)),
|
||||
background: Some(Background::Color(theme.cosmic().accent_color().into())),
|
||||
border_radius: BorderRadius::from([8.0, 8.0, 0.0, 0.0]),
|
||||
|
|
@ -720,6 +722,7 @@ impl Program for CosmicStackInternal {
|
|||
})
|
||||
} else {
|
||||
theme::Container::custom(|theme| iced_widget::container::Appearance {
|
||||
icon_color: Some(Color::from(theme.cosmic().background.on)),
|
||||
text_color: Some(Color::from(theme.cosmic().background.on)),
|
||||
background: Some(Background::Color(theme.cosmic().palette.neutral_3.into())),
|
||||
border_radius: BorderRadius::from([8.0, 8.0, 0.0, 0.0]),
|
||||
|
|
|
|||
|
|
@ -1,10 +1,7 @@
|
|||
use apply::Apply;
|
||||
use cosmic::{
|
||||
font::Font,
|
||||
iced::{
|
||||
widget::{
|
||||
self, container::draw_background, rule::FillMode, text::StyleSheet as TextStyleSheet,
|
||||
},
|
||||
widget::{self, container::draw_background, rule::FillMode},
|
||||
Element,
|
||||
},
|
||||
iced_core::{
|
||||
|
|
@ -13,6 +10,7 @@ use cosmic::{
|
|||
mouse, overlay, renderer,
|
||||
widget::{
|
||||
operation::{Operation, OperationOutputWrapper},
|
||||
text::StyleSheet as TextStyleSheet,
|
||||
tree::Tree,
|
||||
Id, Widget,
|
||||
},
|
||||
|
|
@ -22,9 +20,10 @@ use cosmic::{
|
|||
button::StyleSheet as ButtonStyleSheet, container::StyleSheet as ContainerStyleSheet,
|
||||
rule::StyleSheet as RuleStyleSheet,
|
||||
},
|
||||
iced_widget::scrollable::AbsoluteOffset,
|
||||
iced_widget::{scrollable::AbsoluteOffset, text},
|
||||
theme,
|
||||
widget::{icon, text, Icon},
|
||||
widget::{icon::from_name, Icon},
|
||||
Apply,
|
||||
};
|
||||
|
||||
use super::tab_text::tab_text;
|
||||
|
|
@ -82,6 +81,7 @@ impl Into<theme::Container> for TabBackgroundTheme {
|
|||
match self {
|
||||
Self::ActiveActivated => {
|
||||
theme::Container::custom(move |theme| widget::container::Appearance {
|
||||
icon_color: Some(Color::from(theme.cosmic().accent_text_color())),
|
||||
text_color: Some(Color::from(theme.cosmic().accent_text_color())),
|
||||
background: Some(background_color),
|
||||
border_radius: 0.0.into(),
|
||||
|
|
@ -91,6 +91,7 @@ impl Into<theme::Container> for TabBackgroundTheme {
|
|||
}
|
||||
Self::ActiveDeactivated => {
|
||||
theme::Container::custom(move |_theme| widget::container::Appearance {
|
||||
icon_color: None,
|
||||
text_color: None,
|
||||
background: Some(background_color),
|
||||
border_radius: 0.0.into(),
|
||||
|
|
@ -113,9 +114,9 @@ pub trait TabMessage: Clone {
|
|||
fn scrolled() -> Self;
|
||||
}
|
||||
|
||||
pub struct Tab<'a, Message: TabMessage> {
|
||||
pub struct Tab<Message: TabMessage> {
|
||||
id: Id,
|
||||
app_icon: Icon<'a>,
|
||||
app_icon: Icon,
|
||||
title: String,
|
||||
font: Font,
|
||||
close_message: Option<Message>,
|
||||
|
|
@ -125,11 +126,11 @@ pub struct Tab<'a, Message: TabMessage> {
|
|||
active: bool,
|
||||
}
|
||||
|
||||
impl<'a, Message: TabMessage> Tab<'a, Message> {
|
||||
impl<Message: TabMessage> Tab<Message> {
|
||||
pub fn new(title: impl Into<String>, app_id: impl Into<String>, id: Id) -> Self {
|
||||
Tab {
|
||||
id,
|
||||
app_icon: icon(app_id.into(), 16),
|
||||
app_icon: from_name(app_id.into()).size(16).icon(),
|
||||
title: title.into(),
|
||||
font: cosmic::font::FONT,
|
||||
close_message: None,
|
||||
|
|
@ -175,25 +176,27 @@ impl<'a, Message: TabMessage> Tab<'a, Message> {
|
|||
self
|
||||
}
|
||||
|
||||
pub(super) fn internal<Renderer>(self, idx: usize) -> TabInternal<'a, Message, Renderer>
|
||||
pub(super) fn internal<'a, Renderer>(self, idx: usize) -> TabInternal<'a, Message, Renderer>
|
||||
where
|
||||
Renderer: cosmic::iced_core::Renderer + 'a,
|
||||
Renderer: cosmic::iced_core::text::Renderer<Font = Font>,
|
||||
Renderer::Theme: ButtonStyleSheet<Style = theme::Button>,
|
||||
Renderer::Theme: ButtonStyleSheet<Style = theme::iced::Button>,
|
||||
Renderer::Theme: ContainerStyleSheet,
|
||||
Renderer::Theme: RuleStyleSheet<Style = theme::Rule>,
|
||||
Renderer::Theme: TextStyleSheet,
|
||||
Message: 'a,
|
||||
widget::Button<'a, Message, Renderer>: Into<Element<'a, Message, Renderer>>,
|
||||
widget::Container<'a, Message, Renderer>: Into<Element<'a, Message, Renderer>>,
|
||||
Icon<'a>: Into<Element<'a, Message, Renderer>>,
|
||||
widget::Text<'a, Renderer>: Into<Element<'a, Message, Renderer>>,
|
||||
Icon: Into<Element<'a, Message, Renderer>>,
|
||||
{
|
||||
let mut close_button = icon("window-close-symbolic", 16)
|
||||
.force_svg(true)
|
||||
.style(theme::Svg::Symbolic)
|
||||
let mut close_button = from_name("window-close-symbolic")
|
||||
.size(16)
|
||||
.prefer_svg(true)
|
||||
.icon()
|
||||
.apply(widget::button)
|
||||
.padding(0)
|
||||
.style(theme::Button::Text);
|
||||
.style(theme::iced::Button::Text);
|
||||
if let Some(close_message) = self.close_message {
|
||||
close_button = close_button.on_press(close_message);
|
||||
}
|
||||
|
|
@ -207,16 +210,17 @@ impl<'a, Message: TabMessage> Tab<'a, Message> {
|
|||
.padding([2, 4])
|
||||
.center_y()
|
||||
.into(),
|
||||
text(self.title)
|
||||
.size(14)
|
||||
.font(self.font)
|
||||
.horizontal_alignment(alignment::Horizontal::Left)
|
||||
.vertical_alignment(alignment::Vertical::Center)
|
||||
.apply(tab_text)
|
||||
.background(self.background_theme.background_color())
|
||||
.height(Length::Fill)
|
||||
.width(Length::Fill)
|
||||
.into(),
|
||||
Element::<'a, Message, Renderer>::new(
|
||||
text(self.title)
|
||||
.size(14)
|
||||
.font(self.font)
|
||||
.horizontal_alignment(alignment::Horizontal::Left)
|
||||
.vertical_alignment(alignment::Vertical::Center)
|
||||
.apply(tab_text)
|
||||
.background(self.background_theme.background_color())
|
||||
.height(Length::Fill)
|
||||
.width(Length::Fill),
|
||||
),
|
||||
close_button
|
||||
.apply(widget::container)
|
||||
.height(Length::Fill)
|
||||
|
|
@ -325,7 +329,7 @@ where
|
|||
renderer: &Renderer,
|
||||
operation: &mut dyn Operation<OperationOutputWrapper<Message>>,
|
||||
) {
|
||||
operation.container(None, &mut |operation| {
|
||||
operation.container(None, layout.bounds(), &mut |operation| {
|
||||
self.elements
|
||||
.iter()
|
||||
.zip(&mut tree.children)
|
||||
|
|
@ -347,6 +351,7 @@ where
|
|||
renderer: &Renderer,
|
||||
clipboard: &mut dyn Clipboard,
|
||||
shell: &mut Shell<'_, Message>,
|
||||
viewport: &Rectangle,
|
||||
) -> event::Status {
|
||||
let status = self
|
||||
.elements
|
||||
|
|
@ -362,6 +367,7 @@ where
|
|||
renderer,
|
||||
clipboard,
|
||||
shell,
|
||||
viewport,
|
||||
)
|
||||
})
|
||||
.fold(event::Status::Ignored, event::Status::merge);
|
||||
|
|
@ -434,7 +440,9 @@ where
|
|||
renderer,
|
||||
theme,
|
||||
&renderer::Style {
|
||||
icon_color: style.text_color.unwrap_or(renderer_style.text_color),
|
||||
text_color: style.text_color.unwrap_or(renderer_style.text_color),
|
||||
scale_factor: renderer_style.scale_factor,
|
||||
},
|
||||
layout,
|
||||
cursor,
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ use cosmic::{
|
|||
gradient,
|
||||
layout::{Layout, Limits, Node},
|
||||
mouse::Cursor,
|
||||
renderer,
|
||||
renderer::{self, Renderer as IcedRenderer},
|
||||
widget::{Tree, Widget},
|
||||
Background, Color, Degrees, Gradient, Length, Point, Rectangle, Size,
|
||||
},
|
||||
|
|
@ -13,7 +13,7 @@ use cosmic::{
|
|||
|
||||
pub struct TabText<'a, Message, Renderer>
|
||||
where
|
||||
Renderer: cosmic::iced_core::Renderer,
|
||||
Renderer: IcedRenderer,
|
||||
Renderer::Theme: TextStyleSheet,
|
||||
{
|
||||
text: Element<'a, Message, Renderer>,
|
||||
|
|
@ -26,7 +26,7 @@ pub fn tab_text<'a, Message, Renderer>(
|
|||
text: impl Into<Element<'a, Message, Renderer>>,
|
||||
) -> TabText<'a, Message, Renderer>
|
||||
where
|
||||
Renderer: cosmic::iced_core::Renderer,
|
||||
Renderer: IcedRenderer,
|
||||
Renderer::Theme: TextStyleSheet,
|
||||
{
|
||||
TabText::new(text, Color::TRANSPARENT)
|
||||
|
|
@ -34,7 +34,7 @@ where
|
|||
|
||||
impl<'a, Message, Renderer> TabText<'a, Message, Renderer>
|
||||
where
|
||||
Renderer: cosmic::iced_core::Renderer,
|
||||
Renderer: IcedRenderer,
|
||||
Renderer::Theme: TextStyleSheet,
|
||||
{
|
||||
pub fn new(text: impl Into<Element<'a, Message, Renderer>>, background: Color) -> Self {
|
||||
|
|
@ -66,7 +66,7 @@ where
|
|||
|
||||
impl<'a, Message, Renderer> Widget<Message, Renderer> for TabText<'a, Message, Renderer>
|
||||
where
|
||||
Renderer: cosmic::iced_core::Renderer,
|
||||
Renderer: IcedRenderer,
|
||||
Renderer::Theme: TextStyleSheet,
|
||||
{
|
||||
fn width(&self) -> Length {
|
||||
|
|
@ -148,7 +148,7 @@ where
|
|||
|
||||
impl<'a, Message, Renderer> Into<Element<'a, Message, Renderer>> for TabText<'a, Message, Renderer>
|
||||
where
|
||||
Renderer: cosmic::iced_core::Renderer + 'a,
|
||||
Renderer: IcedRenderer + 'a,
|
||||
Renderer::Theme: TextStyleSheet,
|
||||
Message: 'a,
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
use super::tab::{Tab, TabBackgroundTheme, TabMessage, TabRuleTheme, MIN_ACTIVE_TAB_WIDTH};
|
||||
use apply::Apply;
|
||||
use cosmic::{
|
||||
font::Font,
|
||||
iced::{id::Id, widget, Element},
|
||||
|
|
@ -24,7 +23,8 @@ use cosmic::{
|
|||
},
|
||||
iced_widget::container::draw_background,
|
||||
theme,
|
||||
widget::{icon, Icon},
|
||||
widget::{icon::from_name, Icon},
|
||||
Apply,
|
||||
};
|
||||
use keyframe::{
|
||||
ease,
|
||||
|
|
@ -122,17 +122,17 @@ impl<'a, Message, Renderer> Tabs<'a, Message, Renderer>
|
|||
where
|
||||
Renderer: cosmic::iced_core::Renderer + 'a,
|
||||
Renderer: cosmic::iced_core::text::Renderer<Font = Font>,
|
||||
Renderer::Theme: ButtonStyleSheet<Style = theme::Button>,
|
||||
Renderer::Theme: ButtonStyleSheet<Style = theme::iced::Button>,
|
||||
Renderer::Theme: ContainerStyleSheet<Style = theme::Container>,
|
||||
Renderer::Theme: RuleStyleSheet<Style = theme::Rule>,
|
||||
Renderer::Theme: TextStyleSheet,
|
||||
Message: TabMessage + 'a,
|
||||
widget::Button<'a, Message, Renderer>: Into<Element<'a, Message, Renderer>>,
|
||||
widget::Container<'a, Message, Renderer>: Into<Element<'a, Message, Renderer>>,
|
||||
Icon<'a>: Into<Element<'a, Message, Renderer>>,
|
||||
Icon: Into<Element<'a, Message, Renderer>>,
|
||||
{
|
||||
pub fn new(
|
||||
tabs: impl IntoIterator<Item = Tab<'a, Message>>,
|
||||
tabs: impl IntoIterator<Item = Tab<Message>>,
|
||||
active: usize,
|
||||
activated: bool,
|
||||
group_focused: bool,
|
||||
|
|
@ -189,22 +189,24 @@ where
|
|||
TabRuleTheme::Default
|
||||
})
|
||||
.into(),
|
||||
icon("go-previous-symbolic", 16)
|
||||
.force_svg(true)
|
||||
.style(theme::Svg::Symbolic)
|
||||
from_name("go-previous-symbolic")
|
||||
.size(16)
|
||||
.prefer_svg(true)
|
||||
.icon()
|
||||
.apply(widget::button)
|
||||
.style(theme::Button::Text)
|
||||
.style(theme::iced::Button::Text)
|
||||
.on_press(Message::scroll_back())
|
||||
.into(),
|
||||
]
|
||||
.into_iter()
|
||||
.chain(tabs)
|
||||
.chain(vec![
|
||||
icon("go-next-symbolic", 16)
|
||||
.force_svg(true)
|
||||
.style(theme::Svg::Symbolic)
|
||||
from_name("go-next-symbolic")
|
||||
.size(16)
|
||||
.prefer_svg(true)
|
||||
.icon()
|
||||
.apply(widget::button)
|
||||
.style(theme::Button::Text)
|
||||
.style(theme::iced::Button::Text)
|
||||
.on_press(Message::scroll_further())
|
||||
.into(),
|
||||
widget::vertical_rule(4)
|
||||
|
|
@ -489,6 +491,7 @@ where
|
|||
let background_style = ContainerStyleSheet::appearance(
|
||||
theme,
|
||||
&theme::Container::custom(|theme| widget::container::Appearance {
|
||||
icon_color: None,
|
||||
text_color: None,
|
||||
background: Some(Background::Color(Color::from(
|
||||
theme.cosmic().palette.neutral_3,
|
||||
|
|
@ -659,11 +662,18 @@ where
|
|||
operation: &mut dyn Operation<OperationOutputWrapper<Message>>,
|
||||
) {
|
||||
let state = tree.state.downcast_mut::<State>();
|
||||
let bounds = layout.bounds();
|
||||
|
||||
state.cleanup_old_animations();
|
||||
|
||||
operation.scrollable(state, self.id.as_ref());
|
||||
operation.scrollable(
|
||||
state,
|
||||
self.id.as_ref(),
|
||||
bounds,
|
||||
Vector { x: 0.0, y: 0.0 }, /* seemingly unused */
|
||||
);
|
||||
|
||||
operation.container(self.id.as_ref(), &mut |operation| {
|
||||
operation.container(self.id.as_ref(), bounds, &mut |operation| {
|
||||
self.elements[2..self.elements.len() - 3]
|
||||
.iter()
|
||||
.zip(tree.children.iter_mut().skip(2))
|
||||
|
|
@ -685,6 +695,7 @@ where
|
|||
renderer: &Renderer,
|
||||
clipboard: &mut dyn Clipboard,
|
||||
shell: &mut Shell<'_, Message>,
|
||||
viewport: &Rectangle,
|
||||
) -> event::Status {
|
||||
let state = tree.state.downcast_mut::<State>();
|
||||
state.cleanup_old_animations();
|
||||
|
|
@ -826,6 +837,7 @@ where
|
|||
renderer,
|
||||
clipboard,
|
||||
&mut internal_shell,
|
||||
viewport,
|
||||
)
|
||||
})
|
||||
.fold(event::Status::Ignored, event::Status::merge)
|
||||
|
|
@ -848,6 +860,7 @@ where
|
|||
renderer,
|
||||
clipboard,
|
||||
&mut internal_shell,
|
||||
viewport,
|
||||
)
|
||||
})
|
||||
.fold(event::Status::Ignored, event::Status::merge)
|
||||
|
|
@ -870,6 +883,7 @@ where
|
|||
renderer,
|
||||
clipboard,
|
||||
&mut internal_shell,
|
||||
viewport,
|
||||
)
|
||||
})
|
||||
.fold(event::Status::Ignored, event::Status::merge)
|
||||
|
|
|
|||
|
|
@ -3,13 +3,13 @@ use crate::{
|
|||
utils::iced::{IcedElement, Program},
|
||||
};
|
||||
|
||||
use apply::Apply;
|
||||
use calloop::LoopHandle;
|
||||
use cosmic::{
|
||||
iced::widget::{container, row},
|
||||
iced_core::{Background, Color, Length},
|
||||
theme,
|
||||
widget::{icon, text},
|
||||
widget::{icon::from_name, text},
|
||||
Apply,
|
||||
};
|
||||
use smithay::utils::{Logical, Size};
|
||||
|
||||
|
|
@ -29,8 +29,10 @@ impl Program for StackHoverInternal {
|
|||
|
||||
fn view(&self) -> crate::utils::iced::Element<'_, Self::Message> {
|
||||
row(vec![
|
||||
icon("window-stack-symbolic", 24)
|
||||
.force_svg(true)
|
||||
from_name("window-stack-symbolic")
|
||||
.size(24)
|
||||
.prefer_svg(true)
|
||||
.icon()
|
||||
.apply(container)
|
||||
.padding([0, 8, 0, 0])
|
||||
.width(Length::Shrink)
|
||||
|
|
@ -54,6 +56,7 @@ impl Program for StackHoverInternal {
|
|||
.apply(container)
|
||||
.padding([8, 16])
|
||||
.style(theme::Container::custom(|theme| container::Appearance {
|
||||
icon_color: Some(Color::from(theme.cosmic().accent.on)),
|
||||
text_color: Some(Color::from(theme.cosmic().accent.on)),
|
||||
background: Some(Background::Color(theme.cosmic().accent_color().into())),
|
||||
border_radius: 24.0.into(),
|
||||
|
|
|
|||
|
|
@ -3,13 +3,13 @@ use crate::{
|
|||
utils::iced::{IcedElement, Program},
|
||||
};
|
||||
|
||||
use apply::Apply;
|
||||
use calloop::LoopHandle;
|
||||
use cosmic::{
|
||||
iced::widget::{container, horizontal_space, row},
|
||||
iced_core::{Alignment, Background, Color, Length},
|
||||
theme,
|
||||
widget::{icon, text},
|
||||
widget::{icon::from_name, text},
|
||||
Apply,
|
||||
};
|
||||
use smithay::utils::Size;
|
||||
|
||||
|
|
@ -26,7 +26,11 @@ impl Program for SwapIndicatorInternal {
|
|||
|
||||
fn view(&self) -> crate::utils::iced::Element<'_, Self::Message> {
|
||||
row(vec![
|
||||
icon("window-swap-symbolic", 32).force_svg(true).into(),
|
||||
from_name("window-swap-symbolic")
|
||||
.size(32)
|
||||
.prefer_svg(true)
|
||||
.icon()
|
||||
.into(),
|
||||
horizontal_space(16).into(),
|
||||
text(fl!("swap-windows"))
|
||||
.font(cosmic::font::FONT)
|
||||
|
|
@ -40,6 +44,7 @@ impl Program for SwapIndicatorInternal {
|
|||
.padding(16)
|
||||
.apply(container)
|
||||
.style(theme::Container::custom(|theme| container::Appearance {
|
||||
icon_color: Some(Color::from(theme.cosmic().accent.on)),
|
||||
text_color: Some(Color::from(theme.cosmic().accent.on)),
|
||||
background: Some(Background::Color(theme.cosmic().accent_color().into())),
|
||||
border_radius: 18.0.into(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue