feat: applet button theme helper
This commit is contained in:
parent
a36552cba8
commit
dc4edb2a4d
3 changed files with 17 additions and 5 deletions
|
|
@ -6,4 +6,4 @@ edition = "2021"
|
||||||
publish = false
|
publish = false
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
libcosmic = { path = "../..", default-features = false, features = ["wayland"] }
|
libcosmic = { path = "../..", default-features = false, features = ["wayland", "tokio"] }
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
use cosmic::{
|
use cosmic::{
|
||||||
iced::{sctk_settings::InitialSurface, Application},
|
iced::{wayland::InitialSurface, Application},
|
||||||
settings,
|
settings,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,35 @@
|
||||||
use cosmic_panel_config::{PanelAnchor, PanelSize};
|
use cosmic_panel_config::{PanelAnchor, PanelSize};
|
||||||
use iced::{
|
use iced::{
|
||||||
alignment::{Horizontal, Vertical},
|
alignment::{Horizontal, Vertical},
|
||||||
sctk_settings::InitialSurface,
|
wayland::InitialSurface,
|
||||||
widget::{self, Container},
|
widget::{self, Container},
|
||||||
Color, Element, Length, Rectangle, Settings,
|
Color, Element, Length, Rectangle, Settings,
|
||||||
};
|
};
|
||||||
|
use iced_core::BorderRadius;
|
||||||
use iced_native::command::platform_specific::wayland::{
|
use iced_native::command::platform_specific::wayland::{
|
||||||
popup::{SctkPopupSettings, SctkPositioner},
|
popup::{SctkPopupSettings, SctkPositioner},
|
||||||
window::SctkWindowSettings,
|
window::SctkWindowSettings,
|
||||||
};
|
};
|
||||||
use iced_style::container::Appearance;
|
use iced_style::{button::StyleSheet, container::Appearance};
|
||||||
use sctk::reexports::protocols::xdg::shell::client::xdg_positioner::{Anchor, Gravity};
|
use sctk::reexports::protocols::xdg::shell::client::xdg_positioner::{Anchor, Gravity};
|
||||||
|
|
||||||
use crate::Renderer;
|
use crate::{theme::Button, Renderer};
|
||||||
|
|
||||||
pub use cosmic_panel_config;
|
pub use cosmic_panel_config;
|
||||||
|
|
||||||
const APPLET_PADDING: u32 = 8;
|
const APPLET_PADDING: u32 = 8;
|
||||||
|
|
||||||
|
pub const APPLET_BUTTON_THEME: Button = Button::Custom {
|
||||||
|
active: |t| iced_style::button::Appearance {
|
||||||
|
border_radius: BorderRadius::from(0.0),
|
||||||
|
..t.active(&Button::Text)
|
||||||
|
},
|
||||||
|
hover: |t| iced_style::button::Appearance {
|
||||||
|
border_radius: BorderRadius::from(0.0),
|
||||||
|
..t.hovered(&Button::Text)
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct CosmicAppletHelper {
|
pub struct CosmicAppletHelper {
|
||||||
pub size: Size,
|
pub size: Size,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue