Skip to content

Commit

Permalink
chore: Update libcosmic
Browse files Browse the repository at this point in the history
  • Loading branch information
Drakulix committed Oct 2, 2023
1 parent 89ecda5 commit e8c489f
Show file tree
Hide file tree
Showing 10 changed files with 430 additions and 364 deletions.
488 changes: 274 additions & 214 deletions Cargo.lock

Large diffs are not rendered by default.

9 changes: 4 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ members = [
]

[dependencies]
apply = "0.3.0"
anyhow = { version = "1.0.51", features = ["backtrace"] }
bitflags = "2.4"
bytemuck = "1.12"
Expand All @@ -36,11 +35,11 @@ libsystemd = { version = "0.5", optional = true }
wayland-backend = "0.3.0"
wayland-scanner = "0.31.0"
cosmic-comp-config = { path = "cosmic-comp-config" }
cosmic-config = { git = "https://github.com/pop-os/libcosmic/", rev = "94e147a", features = ["calloop"] }
cosmic-config = { git = "https://github.com/pop-os/libcosmic/", rev = "f91287d", features = ["calloop"] }
cosmic-protocols = { git = "https://github.com/pop-os/cosmic-protocols", rev = "bf7958d", default-features = false, features = ["server"] }
libcosmic = { git = "https://github.com/pop-os/libcosmic/", rev = "4895b0c", default-features = false }
iced_tiny_skia = { git = "https://github.com/pop-os/libcosmic/", rev = "4895b0c" }
tiny-skia = "0.9"
libcosmic = { git = "https://github.com/pop-os/libcosmic/", rev = "f91287d", default-features = false }
iced_tiny_skia = { git = "https://github.com/pop-os/libcosmic/", rev = "f91287d" }
tiny-skia = "0.10"
ordered-float = "3.0"
glow = "0.11.2"
tracing-subscriber = { version = "0.3.16", features = ["env-filter", "tracing-log"] }
Expand Down
119 changes: 46 additions & 73 deletions src/shell/element/resize_indicator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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()
Expand All @@ -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()
Expand Down Expand Up @@ -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)
Expand All @@ -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()
Expand All @@ -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()
Expand Down
13 changes: 8 additions & 5 deletions src/shell/element/stack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 {
Expand All @@ -663,7 +664,7 @@ impl Program for CosmicStackInternal {
}),
})
} else {
theme::Svg::Symbolic
theme::Svg::Default
})
.apply(iced_widget::container)
.padding([4, 24])
Expand Down Expand Up @@ -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]),
Expand All @@ -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]),
Expand Down
Loading

0 comments on commit e8c489f

Please sign in to comment.