Add cosmic-comp-config feature
This commit is contained in:
parent
7c9f04adcc
commit
9d56b0d551
4 changed files with 51 additions and 36 deletions
|
|
@ -112,6 +112,7 @@ gettext = ["dep:gettext-rs"]
|
||||||
|
|
||||||
# Default features for Linux
|
# Default features for Linux
|
||||||
linux = [
|
linux = [
|
||||||
|
"cosmic-comp-config",
|
||||||
"page-accessibility",
|
"page-accessibility",
|
||||||
"page-about",
|
"page-about",
|
||||||
"page-bluetooth",
|
"page-bluetooth",
|
||||||
|
|
@ -133,9 +134,9 @@ linux = [
|
||||||
|
|
||||||
# Pages
|
# Pages
|
||||||
page-accessibility = [
|
page-accessibility = [
|
||||||
|
"cosmic-comp-config",
|
||||||
"dep:sctk",
|
"dep:sctk",
|
||||||
"dep:cosmic-protocols",
|
"dep:cosmic-protocols",
|
||||||
"dep:cosmic-comp-config",
|
|
||||||
"dep:cosmic-settings-config",
|
"dep:cosmic-settings-config",
|
||||||
"dep:cosmic-settings-daemon-config",
|
"dep:cosmic-settings-daemon-config",
|
||||||
"dep:cosmic-settings-accessibility-subscription",
|
"dep:cosmic-settings-accessibility-subscription",
|
||||||
|
|
@ -151,14 +152,14 @@ page-date = ["dep:timedate-zbus", "dep:zbus"]
|
||||||
page-default-apps = ["dep:cosmic-settings-config", "dep:mime-apps"]
|
page-default-apps = ["dep:cosmic-settings-config", "dep:mime-apps"]
|
||||||
page-display = ["dep:udev"]
|
page-display = ["dep:udev"]
|
||||||
page-input = [
|
page-input = [
|
||||||
|
"cosmic-comp-config",
|
||||||
"gettext",
|
"gettext",
|
||||||
"dep:cosmic-comp-config",
|
|
||||||
"dep:cosmic-settings-config",
|
"dep:cosmic-settings-config",
|
||||||
"dep:udev",
|
"dep:udev",
|
||||||
"dep:xkeysym",
|
"dep:xkeysym",
|
||||||
"wayland",
|
"wayland",
|
||||||
]
|
]
|
||||||
page-legacy-applications = ["dep:cosmic-comp-config"]
|
page-legacy-applications = ["cosmic-comp-config", "dep:cosmic-randr"]
|
||||||
page-networking = [
|
page-networking = [
|
||||||
"dep:cosmic-settings-network-manager-subscription",
|
"dep:cosmic-settings-network-manager-subscription",
|
||||||
"xdg-portal",
|
"xdg-portal",
|
||||||
|
|
@ -170,15 +171,20 @@ page-power = ["dep:upower_dbus", "dep:zbus"]
|
||||||
page-region = ["gettext", "dep:locales-rs", "dep:locale1", "dep:zbus"]
|
page-region = ["gettext", "dep:locales-rs", "dep:locale1", "dep:zbus"]
|
||||||
page-sound = ["dep:cosmic-settings-sound-subscription"]
|
page-sound = ["dep:cosmic-settings-sound-subscription"]
|
||||||
page-users = ["xdg-portal", "dep:accounts-zbus", "dep:zbus", "dep:zbus_polkit"]
|
page-users = ["xdg-portal", "dep:accounts-zbus", "dep:zbus", "dep:zbus_polkit"]
|
||||||
page-window-management = ["dep:cosmic-settings-config"]
|
page-window-management = ["cosmic-comp-config", "dep:cosmic-settings-config"]
|
||||||
page-workspaces = ["dep:cosmic-comp-config"]
|
page-workspaces = ["cosmic-comp-config"]
|
||||||
|
|
||||||
# Other features
|
# Other features
|
||||||
a11y = ["libcosmic/a11y"]
|
a11y = ["libcosmic/a11y"]
|
||||||
ashpd = ["dep:ashpd"]
|
ashpd = ["dep:ashpd"]
|
||||||
|
cosmic-comp-config = ["dep:cosmic-comp-config"]
|
||||||
dbus-config = ["libcosmic/dbus-config", "cosmic-config/dbus"]
|
dbus-config = ["libcosmic/dbus-config", "cosmic-config/dbus"]
|
||||||
single-instance = ["libcosmic/single-instance"]
|
single-instance = ["libcosmic/single-instance"]
|
||||||
test = []
|
test = []
|
||||||
wayland = ["libcosmic/wayland", "dep:cosmic-panel-config", "dep:cosmic-randr"]
|
wayland = [
|
||||||
|
"libcosmic/wayland",
|
||||||
|
"dep:cosmic-panel-config",
|
||||||
|
"dep:cosmic-randr"
|
||||||
|
]
|
||||||
wgpu = ["libcosmic/wgpu"]
|
wgpu = ["libcosmic/wgpu"]
|
||||||
xdg-portal = ["ashpd", "libcosmic/xdg-portal"]
|
xdg-portal = ["ashpd", "libcosmic/xdg-portal"]
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ use cosmic::{
|
||||||
settings, text_input,
|
settings, text_input,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
#[cfg(any(feature = "page-window-management", feature = "page-accessibility"))]
|
#[cfg(feature = "cosmic-comp-config")]
|
||||||
use cosmic_comp_config::CosmicCompConfig;
|
use cosmic_comp_config::CosmicCompConfig;
|
||||||
#[cfg(feature = "wayland")]
|
#[cfg(feature = "wayland")]
|
||||||
use cosmic_panel_config::CosmicPanelConfig;
|
use cosmic_panel_config::CosmicPanelConfig;
|
||||||
|
|
@ -169,7 +169,7 @@ pub enum Message {
|
||||||
PageMessage(crate::pages::Message),
|
PageMessage(crate::pages::Message),
|
||||||
#[cfg(feature = "wayland")]
|
#[cfg(feature = "wayland")]
|
||||||
PanelConfig(Box<CosmicPanelConfig>),
|
PanelConfig(Box<CosmicPanelConfig>),
|
||||||
#[cfg(any(feature = "page-window-management", feature = "page-accessibility"))]
|
#[cfg(feature = "cosmic-comp-config")]
|
||||||
CompConfig(Box<CosmicCompConfig>),
|
CompConfig(Box<CosmicCompConfig>),
|
||||||
SearchActivate,
|
SearchActivate,
|
||||||
SearchActivateWith(String),
|
SearchActivateWith(String),
|
||||||
|
|
@ -358,7 +358,7 @@ impl cosmic::Application for SettingsApp {
|
||||||
Message::PanelConfig(Box::new(update.config))
|
Message::PanelConfig(Box::new(update.config))
|
||||||
}),
|
}),
|
||||||
page.subscription(self.core()).map(Message::PageMessage),
|
page.subscription(self.core()).map(Message::PageMessage),
|
||||||
#[cfg(any(feature = "page-window-management", feature = "page-accessibility"))]
|
#[cfg(feature = "cosmic-comp-config")]
|
||||||
self.core()
|
self.core()
|
||||||
.watch_config::<CosmicCompConfig>("com.system76.CosmicComp")
|
.watch_config::<CosmicCompConfig>("com.system76.CosmicComp")
|
||||||
.map(|update| {
|
.map(|update| {
|
||||||
|
|
@ -780,7 +780,7 @@ impl cosmic::Application for SettingsApp {
|
||||||
return Task::batch(tasks);
|
return Task::batch(tasks);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(any(feature = "page-window-management", feature = "page-accessibility"))]
|
#[cfg(feature = "cosmic-comp-config")]
|
||||||
Message::CompConfig(comp_config) => {
|
Message::CompConfig(comp_config) => {
|
||||||
let mut tasks = Vec::new();
|
let mut tasks = Vec::new();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -42,11 +42,11 @@ pub struct Content {
|
||||||
tk_config: Option<Config>,
|
tk_config: Option<Config>,
|
||||||
|
|
||||||
comp_config: cosmic_config::Config,
|
comp_config: cosmic_config::Config,
|
||||||
clip_floating: bool,
|
#[cfg(feature = "cosmic-comp-config")]
|
||||||
clip_tiled: bool,
|
appearance_conf: cosmic_comp_config::AppearanceConfig,
|
||||||
shadow_tiled: bool,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "cosmic-comp-config")]
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub enum CornerMessage {
|
pub enum CornerMessage {
|
||||||
ClipFloating(bool),
|
ClipFloating(bool),
|
||||||
|
|
@ -79,6 +79,7 @@ impl From<&theme_manager::Manager> for Content {
|
||||||
fn from(theme_manager: &theme_manager::Manager) -> Self {
|
fn from(theme_manager: &theme_manager::Manager) -> Self {
|
||||||
let theme = theme_manager.theme();
|
let theme = theme_manager.theme();
|
||||||
let comp_config = cosmic_config::Config::new("com.system76.CosmicComp", 1).unwrap();
|
let comp_config = cosmic_config::Config::new("com.system76.CosmicComp", 1).unwrap();
|
||||||
|
#[cfg(feature = "cosmic-comp-config")]
|
||||||
let appearance_conf = comp_config
|
let appearance_conf = comp_config
|
||||||
.get::<cosmic_comp_config::AppearanceConfig>("appearance_settings")
|
.get::<cosmic_comp_config::AppearanceConfig>("appearance_settings")
|
||||||
.unwrap_or_default();
|
.unwrap_or_default();
|
||||||
|
|
@ -129,9 +130,8 @@ impl From<&theme_manager::Manager> for Content {
|
||||||
icon_handles: Vec::new(),
|
icon_handles: Vec::new(),
|
||||||
tk_config: CosmicTk::config().ok(),
|
tk_config: CosmicTk::config().ok(),
|
||||||
comp_config,
|
comp_config,
|
||||||
clip_floating: appearance_conf.clip_floating_windows,
|
#[cfg(feature = "cosmic-comp-config")]
|
||||||
clip_tiled: appearance_conf.clip_tiled_windows,
|
appearance_conf,
|
||||||
shadow_tiled: appearance_conf.shadow_tiled_windows,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -257,6 +257,7 @@ impl Content {
|
||||||
Task::none()
|
Task::none()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "cosmic-comp-config")]
|
||||||
pub fn update_shadow_and_corners(
|
pub fn update_shadow_and_corners(
|
||||||
&mut self,
|
&mut self,
|
||||||
message: CornerMessage,
|
message: CornerMessage,
|
||||||
|
|
@ -264,22 +265,20 @@ impl Content {
|
||||||
) -> Task<app::Message> {
|
) -> Task<app::Message> {
|
||||||
match message {
|
match message {
|
||||||
CornerMessage::ClipFloating(enabled) => {
|
CornerMessage::ClipFloating(enabled) => {
|
||||||
self.clip_floating = enabled;
|
self.appearance_conf.clip_floating_windows = enabled;
|
||||||
}
|
}
|
||||||
CornerMessage::ClipTiled(enabled) => {
|
CornerMessage::ClipTiled(enabled) => {
|
||||||
self.clip_tiled = enabled;
|
self.appearance_conf.clip_tiled_windows = enabled;
|
||||||
}
|
}
|
||||||
CornerMessage::ShadowTiled(enabled) => {
|
CornerMessage::ShadowTiled(enabled) => {
|
||||||
self.shadow_tiled = enabled;
|
self.appearance_conf.shadow_tiled_windows = enabled;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let conf = cosmic_comp_config::AppearanceConfig {
|
if let Err(err) = self
|
||||||
clip_floating_windows: self.clip_floating,
|
.comp_config
|
||||||
clip_tiled_windows: self.clip_tiled,
|
.set("appearance_settings", self.appearance_conf)
|
||||||
shadow_tiled_windows: self.shadow_tiled,
|
{
|
||||||
};
|
|
||||||
if let Err(err) = self.comp_config.set("appearance_settings", conf) {
|
|
||||||
error!(?err, "Failed to set config 'appearance_settings'");
|
error!(?err, "Failed to set config 'appearance_settings'");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -471,6 +470,7 @@ impl Content {
|
||||||
crate::pages::Message::CloseContextDrawer,
|
crate::pages::Message::CloseContextDrawer,
|
||||||
),
|
),
|
||||||
|
|
||||||
|
#[cfg(feature = "cosmic-comp-config")]
|
||||||
ContextView::ShadowAndCorners => context_drawer(
|
ContextView::ShadowAndCorners => context_drawer(
|
||||||
self.shadow_and_corners(),
|
self.shadow_and_corners(),
|
||||||
crate::pages::Message::CloseContextDrawer,
|
crate::pages::Message::CloseContextDrawer,
|
||||||
|
|
@ -527,13 +527,14 @@ impl Content {
|
||||||
.map(crate::pages::Message::Appearance)
|
.map(crate::pages::Message::Appearance)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "cosmic-comp-config")]
|
||||||
pub fn shadow_and_corners(&self) -> Element<'_, crate::pages::Message> {
|
pub fn shadow_and_corners(&self) -> Element<'_, crate::pages::Message> {
|
||||||
let Spacing { space_m, .. } = cosmic::theme::spacing();
|
let Spacing { space_m, .. } = cosmic::theme::spacing();
|
||||||
|
|
||||||
cosmic::iced::widget::column![
|
cosmic::iced::widget::column![
|
||||||
settings::section().title(fl!("shadows-floating")).add(
|
settings::section().title(fl!("shadows-floating")).add(
|
||||||
settings::item::builder(fl!("shadows-floating", "clip"))
|
settings::item::builder(fl!("shadows-floating", "clip"))
|
||||||
.toggler(self.clip_floating, |b| {
|
.toggler(self.appearance_conf.clip_floating_windows, |b| {
|
||||||
Message::DrawerCorners(CornerMessage::ClipFloating(b))
|
Message::DrawerCorners(CornerMessage::ClipFloating(b))
|
||||||
})
|
})
|
||||||
),
|
),
|
||||||
|
|
@ -541,13 +542,13 @@ impl Content {
|
||||||
.title(fl!("shadows-tiling"))
|
.title(fl!("shadows-tiling"))
|
||||||
.add(
|
.add(
|
||||||
settings::item::builder(fl!("shadows-tiling", "clip"))
|
settings::item::builder(fl!("shadows-tiling", "clip"))
|
||||||
.toggler(self.clip_tiled, |b| {
|
.toggler(self.appearance_conf.clip_tiled_windows, |b| {
|
||||||
Message::DrawerCorners(CornerMessage::ClipTiled(b))
|
Message::DrawerCorners(CornerMessage::ClipTiled(b))
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
.add(
|
.add(
|
||||||
settings::item::builder(fl!("shadows-tiling", "shadow"))
|
settings::item::builder(fl!("shadows-tiling", "shadow"))
|
||||||
.toggler(self.shadow_tiled, |b| {
|
.toggler(self.appearance_conf.shadow_tiled_windows, |b| {
|
||||||
Message::DrawerCorners(CornerMessage::ShadowTiled(b))
|
Message::DrawerCorners(CornerMessage::ShadowTiled(b))
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,7 @@ pub enum ContextView {
|
||||||
ApplicationBackground,
|
ApplicationBackground,
|
||||||
ContainerBackground,
|
ContainerBackground,
|
||||||
ControlComponent,
|
ControlComponent,
|
||||||
|
#[cfg(feature = "cosmic-comp-config")]
|
||||||
ShadowAndCorners,
|
ShadowAndCorners,
|
||||||
CustomAccent,
|
CustomAccent,
|
||||||
IconsAndToolkit,
|
IconsAndToolkit,
|
||||||
|
|
@ -126,6 +127,7 @@ pub enum Message {
|
||||||
|
|
||||||
DrawerOpen(ContextView),
|
DrawerOpen(ContextView),
|
||||||
DrawerColor(ColorPickerUpdate),
|
DrawerColor(ColorPickerUpdate),
|
||||||
|
#[cfg(feature = "cosmic-comp-config")]
|
||||||
DrawerCorners(drawer::CornerMessage),
|
DrawerCorners(drawer::CornerMessage),
|
||||||
DrawerFont(drawer::FontMessage),
|
DrawerFont(drawer::FontMessage),
|
||||||
DrawerIcon(drawer::IconMessage),
|
DrawerIcon(drawer::IconMessage),
|
||||||
|
|
@ -265,6 +267,7 @@ impl Page {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "cosmic-comp-config")]
|
||||||
Message::DrawerCorners(message) => {
|
Message::DrawerCorners(message) => {
|
||||||
if let Some(context_view) = self.context_view.as_ref() {
|
if let Some(context_view) = self.context_view.as_ref() {
|
||||||
tasks.push(self.drawer.update_shadow_and_corners(message, context_view));
|
tasks.push(self.drawer.update_shadow_and_corners(message, context_view));
|
||||||
|
|
@ -598,6 +601,7 @@ impl Page {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "wayland")]
|
||||||
pub fn update_dock_padding(roundness: Roundness) {
|
pub fn update_dock_padding(roundness: Roundness) {
|
||||||
let dock_config_helper = CosmicPanelConfig::cosmic_config("Dock").ok();
|
let dock_config_helper = CosmicPanelConfig::cosmic_config("Dock").ok();
|
||||||
|
|
||||||
|
|
@ -855,17 +859,21 @@ pub fn experimental() -> Section<crate::pages::Message> {
|
||||||
Message::DrawerOpen(ContextView::IconsAndToolkit),
|
Message::DrawerOpen(ContextView::IconsAndToolkit),
|
||||||
);
|
);
|
||||||
|
|
||||||
let shadow_and_corners = crate::widget::go_next_item(
|
let mut section = settings::section()
|
||||||
&descriptions[shadow_and_corners_txt],
|
|
||||||
Message::DrawerOpen(ContextView::ShadowAndCorners),
|
|
||||||
);
|
|
||||||
|
|
||||||
settings::section()
|
|
||||||
.title(&*section.title)
|
.title(&*section.title)
|
||||||
.add(system_font)
|
.add(system_font)
|
||||||
.add(mono_font)
|
.add(mono_font)
|
||||||
.add(icons_and_toolkit)
|
.add(icons_and_toolkit);
|
||||||
.add(shadow_and_corners)
|
|
||||||
|
#[cfg(feature = "cosmic-comp-config")]
|
||||||
|
{
|
||||||
|
section = section.add(crate::widget::go_next_item(
|
||||||
|
&descriptions[shadow_and_corners_txt],
|
||||||
|
Message::DrawerOpen(ContextView::ShadowAndCorners),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
section
|
||||||
.apply(Element::from)
|
.apply(Element::from)
|
||||||
.map(crate::pages::Message::Appearance)
|
.map(crate::pages::Message::Appearance)
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue