fix: applet button styles
This commit is contained in:
parent
ebcaf242e9
commit
9ddadd330f
2 changed files with 18 additions and 7 deletions
|
|
@ -4,7 +4,6 @@ use cosmic::iced::window::Id;
|
||||||
use cosmic::iced::{Command, Limits};
|
use cosmic::iced::{Command, Limits};
|
||||||
use cosmic::iced_runtime::core::window;
|
use cosmic::iced_runtime::core::window;
|
||||||
use cosmic::iced_style::application;
|
use cosmic::iced_style::application;
|
||||||
use cosmic::theme::Button;
|
|
||||||
use cosmic::widget::{list_column, settings, toggler};
|
use cosmic::widget::{list_column, settings, toggler};
|
||||||
use cosmic::{Element, Theme};
|
use cosmic::{Element, Theme};
|
||||||
|
|
||||||
|
|
@ -88,9 +87,8 @@ impl cosmic::Application for Window {
|
||||||
fn view(&self) -> Element<Self::Message> {
|
fn view(&self) -> Element<Self::Message> {
|
||||||
self.core
|
self.core
|
||||||
.applet
|
.applet
|
||||||
.icon_button(ID)
|
.icon_button("display-symbolic")
|
||||||
.on_press(Message::TogglePopup)
|
.on_press(Message::TogglePopup)
|
||||||
.style(Button::Text)
|
|
||||||
.into()
|
.into()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ use iced_widget::runtime::command::platform_specific::wayland::popup::{
|
||||||
SctkPopupSettings, SctkPositioner,
|
SctkPopupSettings, SctkPositioner,
|
||||||
};
|
};
|
||||||
use sctk::reexports::protocols::xdg::shell::client::xdg_positioner::{Anchor, Gravity};
|
use sctk::reexports::protocols::xdg::shell::client::xdg_positioner::{Anchor, Gravity};
|
||||||
|
use std::rc::Rc;
|
||||||
|
|
||||||
use crate::app::cosmic;
|
use crate::app::cosmic;
|
||||||
|
|
||||||
|
|
@ -132,12 +133,24 @@ impl Context {
|
||||||
&self,
|
&self,
|
||||||
icon_name: &'a str,
|
icon_name: &'a str,
|
||||||
) -> crate::widget::Button<'a, Message, Renderer> {
|
) -> crate::widget::Button<'a, Message, Renderer> {
|
||||||
|
let suggested = self.suggested_size();
|
||||||
crate::widget::button(
|
crate::widget::button(
|
||||||
widget::icon::from_name(icon_name)
|
widget::icon(
|
||||||
.symbolic(true)
|
widget::icon::from_name(icon_name)
|
||||||
.size(self.suggested_size().0),
|
.symbolic(true)
|
||||||
|
.size(self.suggested_size().0)
|
||||||
|
.into(),
|
||||||
|
)
|
||||||
|
.style(theme::Svg::Custom(Rc::new(|theme| {
|
||||||
|
crate::iced_style::svg::Appearance {
|
||||||
|
color: Some(theme.cosmic().background.on.into()),
|
||||||
|
}
|
||||||
|
})))
|
||||||
|
.width(Length::Fixed(suggested.0 as f32))
|
||||||
|
.height(Length::Fixed(suggested.1 as f32)),
|
||||||
)
|
)
|
||||||
.padding(8)
|
.padding(APPLET_PADDING as u16)
|
||||||
|
.style(Button::Text)
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO popup container which tracks the size of itself and requests the popup to resize to match
|
// TODO popup container which tracks the size of itself and requests the popup to resize to match
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue