Make pages requiring OS features configurable

This commit is contained in:
Jeremy Soller 2024-10-23 12:39:49 -06:00
parent 2a5f48bb13
commit 6463983745
14 changed files with 258 additions and 112 deletions

53
Cargo.lock generated
View file

@ -2321,8 +2321,7 @@ checksum = "dd2e7510819d6fbf51a5545c8f922716ecfb14df168a3242f7d33e0239efe6a1"
[[package]] [[package]]
name = "fast_image_resize" name = "fast_image_resize"
version = "5.0.0" version = "5.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://github.com/jackpot51/fast_image_resize.git#c48fdca44951e1cfb212eec47fc6d444647a00d3"
checksum = "a66a61fbfc84ef99a839499cf9e5a7c2951d2da874ea00f29ee938bc50d1b396"
dependencies = [ dependencies = [
"bytemuck", "bytemuck",
"cfg-if", "cfg-if",
@ -6841,7 +6840,7 @@ dependencies = [
"memchr", "memchr",
"ntapi", "ntapi",
"rayon", "rayon",
"windows 0.57.0", "windows 0.54.0",
] ]
[[package]] [[package]]
@ -7961,18 +7960,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9252e5725dbed82865af151df558e754e4a3c2c30818359eb17465f1346a1b49" checksum = "9252e5725dbed82865af151df558e754e4a3c2c30818359eb17465f1346a1b49"
dependencies = [ dependencies = [
"windows-core 0.54.0", "windows-core 0.54.0",
"windows-implement 0.53.0", "windows-implement",
"windows-interface 0.53.0", "windows-interface",
"windows-targets 0.52.6",
]
[[package]]
name = "windows"
version = "0.57.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "12342cb4d8e3b046f3d80effd474a7a02447231330ef77d71daa6fbc40681143"
dependencies = [
"windows-core 0.57.0",
"windows-targets 0.52.6", "windows-targets 0.52.6",
] ]
@ -7995,18 +7984,6 @@ dependencies = [
"windows-targets 0.52.6", "windows-targets 0.52.6",
] ]
[[package]]
name = "windows-core"
version = "0.57.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d2ed2439a290666cd67ecce2b0ffaad89c2a56b976b736e6ece670297897832d"
dependencies = [
"windows-implement 0.57.0",
"windows-interface 0.57.0",
"windows-result",
"windows-targets 0.52.6",
]
[[package]] [[package]]
name = "windows-implement" name = "windows-implement"
version = "0.53.0" version = "0.53.0"
@ -8018,17 +7995,6 @@ dependencies = [
"syn 2.0.82", "syn 2.0.82",
] ]
[[package]]
name = "windows-implement"
version = "0.57.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9107ddc059d5b6fbfbffdfa7a7fe3e22a226def0b2608f72e9d552763d3e1ad7"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.82",
]
[[package]] [[package]]
name = "windows-interface" name = "windows-interface"
version = "0.53.0" version = "0.53.0"
@ -8040,17 +8006,6 @@ dependencies = [
"syn 2.0.82", "syn 2.0.82",
] ]
[[package]]
name = "windows-interface"
version = "0.57.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "29bee4b38ea3cde66011baa44dba677c432a78593e202392d1e9070cf2a7fca7"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.82",
]
[[package]] [[package]]
name = "windows-result" name = "windows-result"
version = "0.1.2" version = "0.1.2"

View file

@ -11,12 +11,11 @@ cosmic-randr = { git = "https://github.com/pop-os/cosmic-randr" }
tokio = { version = "1.40.0", features = ["macros"] } tokio = { version = "1.40.0", features = ["macros"] }
[workspace.dependencies.libcosmic] [workspace.dependencies.libcosmic]
features = ["multi-window", "winit", "tokio", "xdg-portal"] features = ["multi-window", "winit", "tokio"]
git = "https://github.com/pop-os/libcosmic" git = "https://github.com/pop-os/libcosmic"
[workspace.dependencies.cosmic-config] [workspace.dependencies.cosmic-config]
git = "https://github.com/pop-os/libcosmic" git = "https://github.com/pop-os/libcosmic"
features = ["dbus"]
[workspace.dependencies.cosmic-bg-config] [workspace.dependencies.cosmic-bg-config]
git = "https://github.com/pop-os/cosmic-bg" git = "https://github.com/pop-os/cosmic-bg"

View file

@ -7,21 +7,21 @@ license = "GPL-3.0-only"
[dependencies] [dependencies]
anyhow = "1.0" anyhow = "1.0"
as-result = "0.2.1" as-result = "0.2.1"
ashpd = { version = "0.9", default-features = false, features = ["tokio"] } ashpd = { version = "0.9", default-features = false, features = ["tokio"], optional = true }
async-channel = "2.3.1" async-channel = "2.3.1"
chrono = "0.4.38" chrono = "0.4.38"
clap = { version = "4.5.17", features = ["derive"] } clap = { version = "4.5.17", features = ["derive"] }
color-eyre = "0.6.3" color-eyre = "0.6.3"
cosmic-bg-config.workspace = true cosmic-bg-config.workspace = true
cosmic-comp-config.workspace = true cosmic-comp-config = { workspace = true, optional = true }
cosmic-config.workspace = true cosmic-config.workspace = true
cosmic-dbus-networkmanager = { git = "https://github.com/pop-os/dbus-settings-bindings" } cosmic-dbus-networkmanager = { git = "https://github.com/pop-os/dbus-settings-bindings", optional = true }
cosmic-panel-config.workspace = true cosmic-panel-config = { workspace = true, optional = true }
cosmic-randr-shell.workspace = true cosmic-randr-shell.workspace = true
cosmic-randr.workspace = true cosmic-randr = { workspace = true, optional = true }
cosmic-settings-config = { git = "https://github.com/pop-os/cosmic-settings-daemon" } cosmic-settings-config = { git = "https://github.com/pop-os/cosmic-settings-daemon", optional = true }
cosmic-settings-page = { path = "../page" } cosmic-settings-page = { path = "../page" }
cosmic-settings-system = { path = "../pages/system" } cosmic-settings-system = { path = "../pages/system", optional = true }
cosmic-settings-wallpaper = { path = "../pages/wallpapers" } cosmic-settings-wallpaper = { path = "../pages/wallpapers" }
derivative = "2.2.0" derivative = "2.2.0"
derive_setters = "0.1.6" derive_setters = "0.1.6"
@ -31,7 +31,7 @@ eyre = "0.6.12"
freedesktop-desktop-entry = "0.7.5" freedesktop-desktop-entry = "0.7.5"
futures = "0.3.30" futures = "0.3.30"
hostname-validator = "1.1.1" hostname-validator = "1.1.1"
hostname1-zbus = { git = "https://github.com/pop-os/dbus-settings-bindings" } hostname1-zbus = { git = "https://github.com/pop-os/dbus-settings-bindings", optional = true }
i18n-embed-fl = "0.9.1" i18n-embed-fl = "0.9.1"
image = "0.25" image = "0.25"
indexmap = "2.5.0" indexmap = "2.5.0"
@ -50,22 +50,24 @@ slotmap = "1.0.7"
static_init = "1.0.3" static_init = "1.0.3"
sunrise = "1.0.1" sunrise = "1.0.1"
tachyonix = "0.3.1" tachyonix = "0.3.1"
timedate-zbus = { git = "https://github.com/pop-os/dbus-settings-bindings" } timedate-zbus = { git = "https://github.com/pop-os/dbus-settings-bindings", optional = true }
tokio.workspace = true tokio = { workspace = true, features = ["fs", "io-util", "sync"] }
tracing = "0.1.40" tracing = "0.1.40"
tracing-subscriber = "0.3.18" tracing-subscriber = "0.3.18"
udev = "0.9.0" udev = { version = "0.9.0", optional = true }
upower_dbus = { git = "https://github.com/pop-os/dbus-settings-bindings" } upower_dbus = { git = "https://github.com/pop-os/dbus-settings-bindings", optional = true }
bluez-zbus = { git = "https://github.com/pop-os/dbus-settings-bindings" } bluez-zbus = { git = "https://github.com/pop-os/dbus-settings-bindings", optional = true }
url = "2.5.2" url = "2.5.2"
xkb-data = "0.2.1" xkb-data = "0.2.1"
zbus = { version = "4.4.0", features = ["tokio"] } zbus = { version = "4.4.0", features = ["tokio"], optional = true }
ustr = "1.0.0" ustr = "1.0.0"
fontdb = "0.16.2" fontdb = "0.16.2"
[dependencies.cosmic-settings-subscriptions] [dependencies.cosmic-settings-subscriptions]
git = "https://github.com/pop-os/cosmic-settings-subscriptions" git = "https://github.com/pop-os/cosmic-settings-subscriptions"
#TODO: only select features as needed
features = ["network_manager", "pipewire", "pulse"] features = ["network_manager", "pipewire", "pulse"]
optional = true
[dependencies.icu] [dependencies.icu]
version = "1.5.0" version = "1.5.0"
@ -76,10 +78,46 @@ version = "0.15.0"
features = ["fluent-system", "desktop-requester"] features = ["fluent-system", "desktop-requester"]
[features] [features]
default = ["wayland", "dbus-config", "single-instance", "a11y", "wgpu"] default = [
wayland = ["libcosmic/wayland"] "a11y",
dbus-config = ["libcosmic/dbus-config"] "dbus-config",
single-instance = ["libcosmic/single-instance"] "linux",
"single-instance",
"wgpu",
]
# Default features for Linux
linux = [
"page-about",
"page-bluetooth",
"page-date",
"page-input",
"page-networking",
"page-power",
"page-sound",
"page-window-management",
"page-workspaces",
"xdg-portal",
"wayland",
]
# Pages
page-about = ["dep:cosmic-settings-system", "dep:hostname1-zbus", "dep:zbus"]
page-bluetooth = ["dep:bluez-zbus", "dep:zbus"]
page-date = ["dep:timedate-zbus", "dep:zbus"]
page-input = ["dep:cosmic-comp-config", "dep:cosmic-settings-config", "dep:udev"]
page-networking = ["ashpd", "dep:cosmic-dbus-networkmanager", "dep:cosmic-settings-subscriptions", "dep:zbus"]
page-power = ["dep:upower_dbus", "dep:zbus"]
page-sound = ["dep:cosmic-settings-subscriptions"]
page-window-management = ["dep:cosmic-settings-config"]
page-workspaces = ["dep:cosmic-comp-config"]
# Other features
a11y = ["libcosmic/a11y"] a11y = ["libcosmic/a11y"]
wgpu = ["libcosmic/wgpu"] ashpd = ["dep:ashpd"]
dbus-config = ["libcosmic/dbus-config", "cosmic-config/dbus"]
single-instance = ["libcosmic/single-instance"]
test = [] test = []
wayland = ["libcosmic/wayland", "dep:cosmic-panel-config", "dep:cosmic-randr"]
wgpu = ["libcosmic/wgpu"]
xdg-portal = ["libcosmic/xdg-portal"]

View file

@ -2,9 +2,18 @@
// SPDX-License-Identifier: GPL-3.0-only // SPDX-License-Identifier: GPL-3.0-only
use crate::config::Config; use crate::config::Config;
#[cfg(feature = "page-bluetooth")]
use crate::pages::bluetooth;
use crate::pages::desktop::{self, appearance}; use crate::pages::desktop::{self, appearance};
use crate::pages::input::{self}; #[cfg(feature = "page-input")]
use crate::pages::{self, bluetooth, display, networking, power, sound, system, time}; use crate::pages::input;
#[cfg(feature = "page-networking")]
use crate::pages::networking;
#[cfg(feature = "page-power")]
use crate::pages::power;
#[cfg(feature = "page-sound")]
use crate::pages::sound;
use crate::pages::{self, display, system, time};
use crate::subscription::desktop_files; use crate::subscription::desktop_files;
use crate::widget::{page_title, search_header}; use crate::widget::{page_title, search_header};
use crate::PageCommands; use crate::PageCommands;
@ -29,6 +38,7 @@ use cosmic::{
}, },
Element, Element,
}; };
#[cfg(feature = "wayland")]
use cosmic_panel_config::CosmicPanelConfig; use cosmic_panel_config::CosmicPanelConfig;
use cosmic_settings_page::{self as page, section}; use cosmic_settings_page::{self as page, section};
#[cfg(feature = "wayland")] #[cfg(feature = "wayland")]
@ -59,35 +69,50 @@ pub struct SettingsApp {
impl SettingsApp { impl SettingsApp {
fn subtask_to_page(&self, cmd: &PageCommands) -> Option<Entity> { fn subtask_to_page(&self, cmd: &PageCommands) -> Option<Entity> {
match cmd { match cmd {
#[cfg(feature = "page-about")]
PageCommands::About => self.pages.page_id::<system::about::Page>(), PageCommands::About => self.pages.page_id::<system::about::Page>(),
PageCommands::Appearance => self.pages.page_id::<desktop::appearance::Page>(), PageCommands::Appearance => self.pages.page_id::<desktop::appearance::Page>(),
#[cfg(feature = "page-bluetooth")]
PageCommands::Bluetooth => self.pages.page_id::<bluetooth::Page>(), PageCommands::Bluetooth => self.pages.page_id::<bluetooth::Page>(),
#[cfg(feature = "page-date")]
PageCommands::DateTime => self.pages.page_id::<time::date::Page>(), PageCommands::DateTime => self.pages.page_id::<time::date::Page>(),
PageCommands::Desktop => self.pages.page_id::<desktop::Page>(), PageCommands::Desktop => self.pages.page_id::<desktop::Page>(),
PageCommands::Displays => self.pages.page_id::<display::Page>(), PageCommands::Displays => self.pages.page_id::<display::Page>(),
#[cfg(feature = "wayland")] #[cfg(feature = "wayland")]
PageCommands::Dock => self.pages.page_id::<desktop::dock::Page>(), PageCommands::Dock => self.pages.page_id::<desktop::dock::Page>(),
PageCommands::Firmware => self.pages.page_id::<system::firmware::Page>(), PageCommands::Firmware => self.pages.page_id::<system::firmware::Page>(),
#[cfg(feature = "page-input")]
PageCommands::Input => self.pages.page_id::<input::Page>(), PageCommands::Input => self.pages.page_id::<input::Page>(),
#[cfg(feature = "page-input")]
PageCommands::Keyboard => self.pages.page_id::<input::keyboard::Page>(), PageCommands::Keyboard => self.pages.page_id::<input::keyboard::Page>(),
#[cfg(feature = "page-input")]
PageCommands::Mouse => self.pages.page_id::<input::mouse::Page>(), PageCommands::Mouse => self.pages.page_id::<input::mouse::Page>(),
#[cfg(feature = "page-networking")]
PageCommands::Network => self.pages.page_id::<networking::Page>(), PageCommands::Network => self.pages.page_id::<networking::Page>(),
#[cfg(feature = "wayland")] #[cfg(feature = "wayland")]
PageCommands::Panel => self.pages.page_id::<desktop::panel::Page>(), PageCommands::Panel => self.pages.page_id::<desktop::panel::Page>(),
#[cfg(feature = "page-power")]
PageCommands::Power => self.pages.page_id::<power::Page>(), PageCommands::Power => self.pages.page_id::<power::Page>(),
PageCommands::RegionLanguage => self.pages.page_id::<time::region::Page>(), PageCommands::RegionLanguage => self.pages.page_id::<time::region::Page>(),
#[cfg(feature = "page-sound")]
PageCommands::Sound => self.pages.page_id::<sound::Page>(), PageCommands::Sound => self.pages.page_id::<sound::Page>(),
PageCommands::System => self.pages.page_id::<system::Page>(), PageCommands::System => self.pages.page_id::<system::Page>(),
PageCommands::Time => self.pages.page_id::<time::Page>(), PageCommands::Time => self.pages.page_id::<time::Page>(),
#[cfg(feature = "page-input")]
PageCommands::Touchpad => self.pages.page_id::<input::touchpad::Page>(), PageCommands::Touchpad => self.pages.page_id::<input::touchpad::Page>(),
PageCommands::Users => self.pages.page_id::<system::users::Page>(), PageCommands::Users => self.pages.page_id::<system::users::Page>(),
#[cfg(feature = "page-networking")]
PageCommands::Vpn => self.pages.page_id::<networking::vpn::Page>(), PageCommands::Vpn => self.pages.page_id::<networking::vpn::Page>(),
PageCommands::Wallpaper => self.pages.page_id::<desktop::wallpaper::Page>(), PageCommands::Wallpaper => self.pages.page_id::<desktop::wallpaper::Page>(),
#[cfg(feature = "page-window-management")]
PageCommands::WindowManagement => { PageCommands::WindowManagement => {
self.pages.page_id::<desktop::window_management::Page>() self.pages.page_id::<desktop::window_management::Page>()
} }
#[cfg(feature = "page-networking")]
PageCommands::Wired => self.pages.page_id::<networking::wired::Page>(), PageCommands::Wired => self.pages.page_id::<networking::wired::Page>(),
#[cfg(feature = "page-networking")]
PageCommands::Wireless => self.pages.page_id::<networking::wifi::Page>(), PageCommands::Wireless => self.pages.page_id::<networking::wifi::Page>(),
#[cfg(feature = "page-workspaces")]
PageCommands::Workspaces => self.pages.page_id::<desktop::workspaces::Page>(), PageCommands::Workspaces => self.pages.page_id::<desktop::workspaces::Page>(),
} }
} }
@ -153,12 +178,17 @@ impl cosmic::Application for SettingsApp {
search_selections: Vec::default(), search_selections: Vec::default(),
}; };
#[cfg(feature = "page-networking")]
app.insert_page::<networking::Page>(); app.insert_page::<networking::Page>();
#[cfg(feature = "page-bluetooth")]
app.insert_page::<bluetooth::Page>(); app.insert_page::<bluetooth::Page>();
let desktop_id = app.insert_page::<desktop::Page>().id(); let desktop_id = app.insert_page::<desktop::Page>().id();
app.insert_page::<display::Page>(); app.insert_page::<display::Page>();
#[cfg(feature = "page-sound")]
app.insert_page::<sound::Page>(); app.insert_page::<sound::Page>();
#[cfg(feature = "page-power")]
app.insert_page::<power::Page>(); app.insert_page::<power::Page>();
#[cfg(feature = "page-input")]
app.insert_page::<input::Page>(); app.insert_page::<input::Page>();
app.insert_page::<time::Page>(); app.insert_page::<time::Page>();
app.insert_page::<system::Page>(); app.insert_page::<system::Page>();
@ -244,6 +274,7 @@ impl cosmic::Application for SettingsApp {
futures::future::pending::<()>().await; futures::future::pending::<()>().await;
}), }),
), ),
#[cfg(feature = "ashpd")]
crate::subscription::daytime().map(|daytime| { crate::subscription::daytime().map(|daytime| {
Message::PageMessage(pages::Message::Appearance(appearance::Message::Daytime( Message::PageMessage(pages::Message::Appearance(appearance::Message::Daytime(
daytime, daytime,
@ -323,6 +354,7 @@ impl cosmic::Application for SettingsApp {
} }
Message::PageMessage(message) => match message { Message::PageMessage(message) => match message {
#[cfg(feature = "page-about")]
crate::pages::Message::About(message) => { crate::pages::Message::About(message) => {
page::update!(self.pages, message, system::about::Page); page::update!(self.pages, message, system::about::Page);
} }
@ -333,12 +365,14 @@ impl cosmic::Application for SettingsApp {
} }
} }
#[cfg(feature = "page-bluetooth")]
crate::pages::Message::Bluetooth(message) => { crate::pages::Message::Bluetooth(message) => {
if let Some(page) = self.pages.page_mut::<bluetooth::Page>() { if let Some(page) = self.pages.page_mut::<bluetooth::Page>() {
return page.update(message).map(Into::into); return page.update(message).map(Into::into);
} }
} }
#[cfg(feature = "page-date")]
crate::pages::Message::DateAndTime(message) => { crate::pages::Message::DateAndTime(message) => {
if let Some(page) = self.pages.page_mut::<time::date::Page>() { if let Some(page) = self.pages.page_mut::<time::date::Page>() {
return page.update(message).map(Into::into); return page.update(message).map(Into::into);
@ -355,6 +389,7 @@ impl cosmic::Application for SettingsApp {
} }
} }
#[cfg(feature = "page-workspaces")]
crate::pages::Message::DesktopWorkspaces(message) => { crate::pages::Message::DesktopWorkspaces(message) => {
page::update!(self.pages, message, desktop::workspaces::Page); page::update!(self.pages, message, desktop::workspaces::Page);
} }
@ -379,24 +414,28 @@ impl cosmic::Application for SettingsApp {
} }
} }
#[cfg(feature = "page-input")]
crate::pages::Message::Input(message) => { crate::pages::Message::Input(message) => {
if let Some(page) = self.pages.page_mut::<input::Page>() { if let Some(page) = self.pages.page_mut::<input::Page>() {
return page.update(message).map(Into::into); return page.update(message).map(Into::into);
} }
} }
#[cfg(feature = "page-input")]
crate::pages::Message::Keyboard(message) => { crate::pages::Message::Keyboard(message) => {
if let Some(page) = self.pages.page_mut::<input::keyboard::Page>() { if let Some(page) = self.pages.page_mut::<input::keyboard::Page>() {
return page.update(message).map(Into::into); return page.update(message).map(Into::into);
} }
} }
#[cfg(feature = "page-input")]
crate::pages::Message::KeyboardShortcuts(message) => { crate::pages::Message::KeyboardShortcuts(message) => {
if let Some(page) = self.pages.page_mut::<input::keyboard::shortcuts::Page>() { if let Some(page) = self.pages.page_mut::<input::keyboard::shortcuts::Page>() {
return page.update(message).map(Into::into); return page.update(message).map(Into::into);
} }
} }
#[cfg(feature = "page-input")]
crate::pages::Message::CustomShortcuts(message) => { crate::pages::Message::CustomShortcuts(message) => {
if let Some(page) = self if let Some(page) = self
.pages .pages
@ -406,6 +445,7 @@ impl cosmic::Application for SettingsApp {
} }
} }
#[cfg(feature = "page-input")]
crate::pages::Message::ManageWindowShortcuts(message) => { crate::pages::Message::ManageWindowShortcuts(message) => {
if let Some(page) = self if let Some(page) = self
.pages .pages
@ -415,6 +455,7 @@ impl cosmic::Application for SettingsApp {
} }
} }
#[cfg(feature = "page-input")]
crate::pages::Message::MoveWindowShortcuts(message) => { crate::pages::Message::MoveWindowShortcuts(message) => {
if let Some(page) = self if let Some(page) = self
.pages .pages
@ -424,6 +465,7 @@ impl cosmic::Application for SettingsApp {
} }
} }
#[cfg(feature = "page-input")]
crate::pages::Message::NavShortcuts(message) => { crate::pages::Message::NavShortcuts(message) => {
if let Some(page) = self if let Some(page) = self
.pages .pages
@ -433,12 +475,14 @@ impl cosmic::Application for SettingsApp {
} }
} }
#[cfg(feature = "page-sound")]
crate::pages::Message::Sound(message) => { crate::pages::Message::Sound(message) => {
if let Some(page) = self.pages.page_mut::<sound::Page>() { if let Some(page) = self.pages.page_mut::<sound::Page>() {
return page.update(message).map(Into::into); return page.update(message).map(Into::into);
} }
} }
#[cfg(feature = "page-input")]
crate::pages::Message::SystemShortcuts(message) => { crate::pages::Message::SystemShortcuts(message) => {
if let Some(page) = self if let Some(page) = self
.pages .pages
@ -448,6 +492,7 @@ impl cosmic::Application for SettingsApp {
} }
} }
#[cfg(feature = "page-input")]
crate::pages::Message::TilingShortcuts(message) => { crate::pages::Message::TilingShortcuts(message) => {
if let Some(page) = self if let Some(page) = self
.pages .pages
@ -465,6 +510,7 @@ impl cosmic::Application for SettingsApp {
return self.activate_page(page); return self.activate_page(page);
} }
#[cfg(feature = "page-networking")]
crate::pages::Message::Networking(message) => { crate::pages::Message::Networking(message) => {
if let Some(page) = self.pages.page_mut::<networking::Page>() { if let Some(page) = self.pages.page_mut::<networking::Page>() {
return page.update(message).map(Into::into); return page.update(message).map(Into::into);
@ -485,26 +531,31 @@ impl cosmic::Application for SettingsApp {
} }
} }
#[cfg(feature = "page-power")]
crate::pages::Message::Power(message) => { crate::pages::Message::Power(message) => {
page::update!(self.pages, message, power::Page); page::update!(self.pages, message, power::Page);
} }
#[cfg(feature = "page-networking")]
crate::pages::Message::Vpn(message) => { crate::pages::Message::Vpn(message) => {
if let Some(page) = self.pages.page_mut::<networking::vpn::Page>() { if let Some(page) = self.pages.page_mut::<networking::vpn::Page>() {
return page.update(message).map(Into::into); return page.update(message).map(Into::into);
} }
} }
#[cfg(feature = "page-networking")]
crate::pages::Message::WiFi(message) => { crate::pages::Message::WiFi(message) => {
if let Some(page) = self.pages.page_mut::<networking::wifi::Page>() { if let Some(page) = self.pages.page_mut::<networking::wifi::Page>() {
return page.update(message).map(Into::into); return page.update(message).map(Into::into);
} }
} }
#[cfg(feature = "page-window-management")]
crate::pages::Message::WindowManagement(message) => { crate::pages::Message::WindowManagement(message) => {
page::update!(self.pages, message, desktop::window_management::Page); page::update!(self.pages, message, desktop::window_management::Page);
} }
#[cfg(feature = "page-networking")]
crate::pages::Message::Wired(message) => { crate::pages::Message::Wired(message) => {
if let Some(page) = self.pages.page_mut::<networking::wired::Page>() { if let Some(page) = self.pages.page_mut::<networking::wired::Page>() {
return page.update(message).map(Into::into); return page.update(message).map(Into::into);

View file

@ -39,58 +39,73 @@ pub struct Args {
#[derive(Subcommand, Debug, Serialize, Deserialize, Clone)] #[derive(Subcommand, Debug, Serialize, Deserialize, Clone)]
pub enum PageCommands { pub enum PageCommands {
/// About settings page /// About settings page
#[cfg(feature = "page-about")]
About, About,
/// Appearance settings page /// Appearance settings page
Appearance, Appearance,
/// Bluetooth settings page /// Bluetooth settings page
#[cfg(feature = "page-bluetooth")]
Bluetooth, Bluetooth,
/// Date & Time settings page /// Date & Time settings page
#[cfg(feature = "page-date")]
DateTime, DateTime,
/// Desktop settings page /// Desktop settings page
Desktop, Desktop,
/// Displays settings page /// Displays settings page
Displays, Displays,
#[cfg(feature = "wayland")]
/// Dock settings page /// Dock settings page
#[cfg(feature = "wayland")]
Dock, Dock,
/// Firmware settings page /// Firmware settings page
Firmware, Firmware,
/// Input Devices settings page /// Input Devices settings page
#[cfg(feature = "page-input")]
Input, Input,
/// Keyboard settings page /// Keyboard settings page
#[cfg(feature = "page-input")]
Keyboard, Keyboard,
/// Mouse settings page /// Mouse settings page
#[cfg(feature = "page-input")]
Mouse, Mouse,
/// Network settings page /// Network settings page
#[cfg(feature = "page-networking")]
Network, Network,
#[cfg(feature = "wayland")]
/// Panel settings page /// Panel settings page
#[cfg(feature = "wayland")]
Panel, Panel,
/// Power settings page /// Power settings page
#[cfg(feature = "page-power")]
Power, Power,
/// Region & Language settings page /// Region & Language settings page
RegionLanguage, RegionLanguage,
/// Sound settings page /// Sound settings page
#[cfg(feature = "page-sound")]
Sound, Sound,
/// System & Accounts settings page /// System & Accounts settings page
System, System,
/// Time & Language settings page /// Time & Language settings page
Time, Time,
/// Touchpad settings page /// Touchpad settings page
#[cfg(feature = "page-input")]
Touchpad, Touchpad,
/// Users settings page /// Users settings page
Users, Users,
/// VPN settings page /// VPN settings page
#[cfg(feature = "page-networking")]
Vpn, Vpn,
/// Wallpaper settings page /// Wallpaper settings page
Wallpaper, Wallpaper,
/// Window management settings page /// Window management settings page
#[cfg(feature = "page-window-management")]
WindowManagement, WindowManagement,
/// Wired settings page /// Wired settings page
#[cfg(feature = "page-networking")]
Wired, Wired,
/// WiFi settings page /// WiFi settings page
#[cfg(feature = "page-networking")]
Wireless, Wireless,
/// Workspaces settings page /// Workspaces settings page
#[cfg(feature = "page-workspaces")]
Workspaces, Workspaces,
} }

View file

@ -7,6 +7,8 @@ pub mod icon_themes;
use std::borrow::Cow; use std::borrow::Cow;
use std::sync::Arc; use std::sync::Arc;
//TODO: use embedded cosmic-files for portability
#[cfg(feature = "ashpd")]
use ashpd::desktop::file_chooser::{FileFilter, SelectedFiles}; use ashpd::desktop::file_chooser::{FileFilter, SelectedFiles};
use cosmic::config::CosmicTk; use cosmic::config::CosmicTk;
use cosmic::cosmic_config::{Config, ConfigSet, CosmicConfigEntry}; use cosmic::cosmic_config::{Config, ConfigSet, CosmicConfigEntry};
@ -23,6 +25,7 @@ use cosmic::widget::{
scrollable, settings, spin_button, text, ColorPickerModel, scrollable, settings, spin_button, text, ColorPickerModel,
}; };
use cosmic::{Apply, Element, Task}; use cosmic::{Apply, Element, Task};
#[cfg(feature = "wayland")]
use cosmic_panel_config::CosmicPanelConfig; use cosmic_panel_config::CosmicPanelConfig;
use cosmic_settings_page::Section; use cosmic_settings_page::Section;
use cosmic_settings_page::{self as page, section}; use cosmic_settings_page::{self as page, section};
@ -270,16 +273,22 @@ pub enum Message {
DisplaySystemFont, DisplaySystemFont,
Entered((IconThemes, IconHandles)), Entered((IconThemes, IconHandles)),
IconsAndToolkit, IconsAndToolkit,
#[cfg(feature = "ashpd")]
ExportError, ExportError,
#[cfg(feature = "ashpd")]
ExportFile(Arc<SelectedFiles>), ExportFile(Arc<SelectedFiles>),
#[cfg(feature = "ashpd")]
ExportSuccess, ExportSuccess,
FontConfig(font_config::Message), FontConfig(font_config::Message),
FontSearch(String), FontSearch(String),
FontSelect(bool, Arc<str>), FontSelect(bool, Arc<str>),
GapSize(spin_button::Message), GapSize(spin_button::Message),
IconTheme(usize), IconTheme(usize),
#[cfg(feature = "ashpd")]
ImportError, ImportError,
#[cfg(feature = "ashpd")]
ImportFile(Arc<SelectedFiles>), ImportFile(Arc<SelectedFiles>),
#[cfg(feature = "ashpd")]
ImportSuccess(Box<ThemeBuilder>), ImportSuccess(Box<ThemeBuilder>),
InterfaceText(ColorPickerUpdate), InterfaceText(ColorPickerUpdate),
Left, Left,
@ -287,7 +296,9 @@ pub enum Message {
PaletteAccent(cosmic::iced::Color), PaletteAccent(cosmic::iced::Color),
Reset, Reset,
Roundness(Roundness), Roundness(Roundness),
#[cfg(feature = "ashpd")]
StartExport, StartExport,
#[cfg(feature = "ashpd")]
StartImport, StartImport,
UseDefaultWindowHint(bool), UseDefaultWindowHint(bool),
WindowHintSize(spin_button::Message), WindowHintSize(spin_button::Message),
@ -729,6 +740,7 @@ impl Page {
self.theme_config_write("corner_radii", radii); self.theme_config_write("corner_radii", radii);
} }
#[cfg(feature = "wayland")]
tokio::task::spawn(async move { tokio::task::spawn(async move {
Self::update_panel_radii(r); Self::update_panel_radii(r);
}); });
@ -756,6 +768,7 @@ impl Page {
self.theme_config_write("spacing", spacing); self.theme_config_write("spacing", spacing);
} }
#[cfg(feature = "wayland")]
tokio::task::spawn(async move { tokio::task::spawn(async move {
Self::update_panel_spacing(density); Self::update_panel_spacing(density);
}); });
@ -847,6 +860,7 @@ impl Page {
} }
let r = self.roundness; let r = self.roundness;
#[cfg(feature = "wayland")]
tokio::task::spawn(async move { tokio::task::spawn(async move {
Self::update_panel_radii(r); Self::update_panel_radii(r);
Self::update_panel_spacing(Density::Standard); Self::update_panel_spacing(Density::Standard);
@ -855,6 +869,7 @@ impl Page {
self.reload_theme_mode(); self.reload_theme_mode();
} }
#[cfg(feature = "ashpd")]
Message::StartImport => { Message::StartImport => {
tasks.push(cosmic::command::future(async move { tasks.push(cosmic::command::future(async move {
let res = SelectedFiles::open_file() let res = SelectedFiles::open_file()
@ -874,6 +889,7 @@ impl Page {
})); }));
} }
#[cfg(feature = "ashpd")]
Message::StartExport => { Message::StartExport => {
let is_dark = self.theme_mode.is_dark; let is_dark = self.theme_mode.is_dark;
let name = format!("{}.ron", if is_dark { fl!("dark") } else { fl!("light") }); let name = format!("{}.ron", if is_dark { fl!("dark") } else { fl!("light") });
@ -896,6 +912,7 @@ impl Page {
})); }));
} }
#[cfg(feature = "ashpd")]
Message::ImportFile(f) => { Message::ImportFile(f) => {
let path_res = f let path_res = f
.uris() .uris()
@ -919,6 +936,7 @@ impl Page {
})); }));
} }
#[cfg(feature = "ashpd")]
Message::ExportFile(f) => { Message::ExportFile(f) => {
let path_res = f let path_res = f
.uris() .uris()
@ -954,12 +972,15 @@ impl Page {
} }
// TODO: error message toast? // TODO: error message toast?
#[cfg(feature = "ashpd")]
Message::ExportError | Message::ImportError => return Task::none(), Message::ExportError | Message::ImportError => return Task::none(),
#[cfg(feature = "ashpd")]
Message::ExportSuccess => { Message::ExportSuccess => {
tracing::trace!("Export successful"); tracing::trace!("Export successful");
} }
#[cfg(feature = "ashpd")]
Message::ImportSuccess(builder) => { Message::ImportSuccess(builder) => {
tracing::trace!("Import successful"); tracing::trace!("Import successful");
self.theme_builder = *builder; self.theme_builder = *builder;
@ -1282,6 +1303,7 @@ impl Page {
} }
// TODO: cache panel and dock configs so that they needn't be re-read // TODO: cache panel and dock configs so that they needn't be re-read
#[cfg(feature = "wayland")]
fn update_panel_radii(roundness: Roundness) { fn update_panel_radii(roundness: Roundness) {
let panel_config_helper = CosmicPanelConfig::cosmic_config("Panel").ok(); let panel_config_helper = CosmicPanelConfig::cosmic_config("Panel").ok();
let dock_config_helper = CosmicPanelConfig::cosmic_config("Dock").ok(); let dock_config_helper = CosmicPanelConfig::cosmic_config("Dock").ok();
@ -1327,6 +1349,7 @@ impl Page {
}; };
} }
#[cfg(feature = "wayland")]
fn update_panel_spacing(density: Density) { fn update_panel_spacing(density: Density) {
let panel_config_helper = CosmicPanelConfig::cosmic_config("Panel").ok(); let panel_config_helper = CosmicPanelConfig::cosmic_config("Panel").ok();
let dock_config_helper = CosmicPanelConfig::cosmic_config("Dock").ok(); let dock_config_helper = CosmicPanelConfig::cosmic_config("Dock").ok();
@ -1382,6 +1405,7 @@ impl page::Page<crate::pages::Message> for Page {
]) ])
} }
#[cfg(feature = "ashpd")]
fn header_view(&self) -> Option<Element<'_, crate::pages::Message>> { fn header_view(&self) -> Option<Element<'_, crate::pages::Message>> {
let content = row::with_capacity(2) let content = row::with_capacity(2)
.spacing(self.theme_builder.spacing.space_xxs) .spacing(self.theme_builder.spacing.space_xxs)

View file

@ -7,7 +7,9 @@ pub mod dock;
#[cfg(feature = "wayland")] #[cfg(feature = "wayland")]
pub mod panel; pub mod panel;
pub mod wallpaper; pub mod wallpaper;
#[cfg(feature = "page-window-management")]
pub mod window_management; pub mod window_management;
#[cfg(feature = "page-workspaces")]
pub mod workspaces; pub mod workspaces;
use cosmic_settings_page as page; use cosmic_settings_page as page;
@ -24,10 +26,11 @@ impl page::Page<crate::pages::Message> for Page {
} }
impl page::AutoBind<crate::pages::Message> for Page { impl page::AutoBind<crate::pages::Message> for Page {
fn sub_pages(page: page::Insert<crate::pages::Message>) -> page::Insert<crate::pages::Message> { fn sub_pages(
let mut page = page mut page: page::Insert<crate::pages::Message>,
.sub_page::<wallpaper::Page>() ) -> page::Insert<crate::pages::Message> {
.sub_page::<appearance::Page>(); page = page.sub_page::<wallpaper::Page>();
page = page.sub_page::<appearance::Page>();
#[cfg(feature = "wayland")] #[cfg(feature = "wayland")]
{ {
@ -35,8 +38,17 @@ impl page::AutoBind<crate::pages::Message> for Page {
page = page.sub_page::<dock::Page>(); page = page.sub_page::<dock::Page>();
} }
page.sub_page::<window_management::Page>() #[cfg(feature = "page-window-management")]
.sub_page::<workspaces::Page>() {
page = page.sub_page::<window_management::Page>();
}
#[cfg(feature = "page-workspaces")]
{
page = page.sub_page::<workspaces::Page>();
}
page
} }
} }

View file

@ -14,14 +14,13 @@ use std::{
sync::Arc, sync::Arc,
}; };
#[cfg(feature = "xdg-portal")]
use cosmic::dialog::file_chooser;
use cosmic::iced::{Color, Length}; use cosmic::iced::{Color, Length};
use cosmic::{ use cosmic::widget::{
dialog::file_chooser, button, dropdown, list_column, row,
widget::{ segmented_button::{self, SingleSelectModel},
button, dropdown, list_column, row, settings, tab_bar, text, toggler,
segmented_button::{self, SingleSelectModel},
settings, tab_bar, text, toggler,
},
}; };
use cosmic::{iced_core::alignment, iced_runtime::core::image::Handle as ImageHandle}; use cosmic::{iced_core::alignment, iced_runtime::core::image::Handle as ImageHandle};
use cosmic::{iced_core::Alignment, widget::icon}; use cosmic::{iced_core::Alignment, widget::icon};
@ -68,8 +67,10 @@ pub struct InitUpdate {
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub enum Message { pub enum Message {
/// Adds a new wallpaper folder. /// Adds a new wallpaper folder.
#[cfg(feature = "xdg-portal")]
AddFolder(Arc<Result<Url, file_chooser::Error>>), AddFolder(Arc<Result<Url, file_chooser::Error>>),
/// Adds a new image file the system wallpaper folder. /// Adds a new image file the system wallpaper folder.
#[cfg(feature = "xdg-portal")]
AddFile(Arc<Result<Url, file_chooser::Error>>), AddFile(Arc<Result<Url, file_chooser::Error>>),
/// Cache currently displayed image. /// Cache currently displayed image.
CacheDisplayImage, CacheDisplayImage,
@ -576,6 +577,7 @@ impl Page {
} }
Category::AddFolder => { Category::AddFolder => {
#[cfg(feature = "xdg-portal")]
return cosmic::command::future(async { return cosmic::command::future(async {
let dialog_result = file_chooser::open::Dialog::new() let dialog_result = file_chooser::open::Dialog::new()
.title(fl!("wallpaper", "folder-dialog")) .title(fl!("wallpaper", "folder-dialog"))
@ -770,6 +772,7 @@ impl Page {
} }
Message::ImageAddDialog => { Message::ImageAddDialog => {
#[cfg(feature = "xdg-portal")]
return cosmic::Task::future(async { return cosmic::Task::future(async {
let dialog_result = file_chooser::open::Dialog::new() let dialog_result = file_chooser::open::Dialog::new()
.title(fl!("wallpaper", "image-dialog")) .title(fl!("wallpaper", "image-dialog"))
@ -847,6 +850,7 @@ impl Page {
} }
} }
#[cfg(feature = "xdg-portal")]
Message::AddFolder(result) => { Message::AddFolder(result) => {
let path = match dialog_response(result) { let path = match dialog_response(result) {
DialogResponse::Path(path) => path, DialogResponse::Path(path) => path,
@ -883,6 +887,7 @@ impl Page {
} }
} }
#[cfg(feature = "xdg-portal")]
Message::AddFile(result) => { Message::AddFile(result) => {
let path = match dialog_response(result) { let path = match dialog_response(result) {
DialogResponse::Path(path) => path, DialogResponse::Path(path) => path,
@ -1348,6 +1353,7 @@ enum DialogResponse {
Path(PathBuf), Path(PathBuf),
} }
#[cfg(feature = "xdg-portal")]
fn dialog_response(result: Arc<Result<Url, file_chooser::Error>>) -> DialogResponse { fn dialog_response(result: Arc<Result<Url, file_chooser::Error>>) -> DialogResponse {
let Some(result) = Arc::into_inner(result) else { let Some(result) = Arc::into_inner(result) else {
return DialogResponse::Error(String::from("Arc::into_inner returned None")); return DialogResponse::Error(String::from("Arc::into_inner returned None"));

View file

@ -241,27 +241,30 @@ impl page::Page<crate::pages::Message> for Page {
task.abort(); task.abort();
} }
// Spawns a background service to monitor for display state changes. #[cfg(feature = "wayland")]
// This must be spawned onto its own thread because `*mut wayland_sys::client::wl_display` is not Send-able. {
let runtime = tokio::runtime::Handle::current(); // Spawns a background service to monitor for display state changes.
self.background_service = Some(tokio::task::spawn_blocking(move || { // This must be spawned onto its own thread because `*mut wayland_sys::client::wl_display` is not Send-able.
runtime.block_on(async move { let runtime = tokio::runtime::Handle::current();
let (tx, mut rx) = tachyonix::channel(5); self.background_service = Some(tokio::task::spawn_blocking(move || {
let Ok((mut context, mut event_queue)) = cosmic_randr::connect(tx) else { runtime.block_on(async move {
return; let (tx, mut rx) = tachyonix::channel(5);
}; let Ok((mut context, mut event_queue)) = cosmic_randr::connect(tx) else {
return;
};
while context.dispatch(&mut event_queue).await.is_ok() { while context.dispatch(&mut event_queue).await.is_ok() {
while let Ok(message) = rx.try_recv() { while let Ok(message) = rx.try_recv() {
if let cosmic_randr::Message::ManagerDone = message { if let cosmic_randr::Message::ManagerDone = message {
let _ = sender let _ = sender
.send(pages::Message::Displays(Message::Refresh)) .send(pages::Message::Displays(Message::Refresh))
.await; .await;
}
} }
} }
} });
}); }));
})); }
cosmic::command::future(on_enter()) cosmic::command::future(on_enter())
} }

View file

@ -3,25 +3,35 @@
use cosmic_settings_page::Entity; use cosmic_settings_page::Entity;
#[cfg(feature = "page-bluetooth")]
pub mod bluetooth; pub mod bluetooth;
pub mod desktop; pub mod desktop;
pub mod display; pub mod display;
#[cfg(feature = "page-input")]
pub mod input; pub mod input;
#[cfg(feature = "page-networking")]
pub mod networking; pub mod networking;
#[cfg(feature = "page-power")]
pub mod power; pub mod power;
#[cfg(feature = "page-sound")]
pub mod sound; pub mod sound;
pub mod system; pub mod system;
pub mod time; pub mod time;
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub enum Message { pub enum Message {
#[cfg(feature = "page-about")]
About(system::about::Message), About(system::about::Message),
Appearance(desktop::appearance::Message), Appearance(desktop::appearance::Message),
#[cfg(feature = "page-bluetooth")]
Bluetooth(bluetooth::Message), Bluetooth(bluetooth::Message),
#[cfg(feature = "page-input")]
CustomShortcuts(input::keyboard::shortcuts::custom::Message), CustomShortcuts(input::keyboard::shortcuts::custom::Message),
#[cfg(feature = "page-date")]
DateAndTime(time::date::Message), DateAndTime(time::date::Message),
Desktop(desktop::Message), Desktop(desktop::Message),
DesktopWallpaper(desktop::wallpaper::Message), DesktopWallpaper(desktop::wallpaper::Message),
#[cfg(feature = "page-workspaces")]
DesktopWorkspaces(desktop::workspaces::Message), DesktopWorkspaces(desktop::workspaces::Message),
Displays(display::Message), Displays(display::Message),
#[cfg(feature = "wayland")] #[cfg(feature = "wayland")]
@ -32,25 +42,40 @@ pub enum Message {
id: String, id: String,
message: Vec<u8>, message: Vec<u8>,
}, },
#[cfg(feature = "page-input")]
Input(input::Message), Input(input::Message),
#[cfg(feature = "page-input")]
Keyboard(input::keyboard::Message), Keyboard(input::keyboard::Message),
#[cfg(feature = "page-input")]
KeyboardShortcuts(input::keyboard::shortcuts::Message), KeyboardShortcuts(input::keyboard::shortcuts::Message),
#[cfg(feature = "page-input")]
ManageWindowShortcuts(input::keyboard::shortcuts::ShortcutMessage), ManageWindowShortcuts(input::keyboard::shortcuts::ShortcutMessage),
#[cfg(feature = "page-input")]
MoveWindowShortcuts(input::keyboard::shortcuts::ShortcutMessage), MoveWindowShortcuts(input::keyboard::shortcuts::ShortcutMessage),
#[cfg(feature = "page-input")]
NavShortcuts(input::keyboard::shortcuts::ShortcutMessage), NavShortcuts(input::keyboard::shortcuts::ShortcutMessage),
#[cfg(feature = "page-networking")]
Networking(networking::Message), Networking(networking::Message),
Page(Entity), Page(Entity),
#[cfg(feature = "wayland")] #[cfg(feature = "wayland")]
Panel(desktop::panel::Message), Panel(desktop::panel::Message),
#[cfg(feature = "wayland")] #[cfg(feature = "wayland")]
PanelApplet(desktop::panel::applets_inner::Message), PanelApplet(desktop::panel::applets_inner::Message),
#[cfg(feature = "page-power")]
Power(power::Message), Power(power::Message),
#[cfg(feature = "page-sound")]
Sound(sound::Message), Sound(sound::Message),
#[cfg(feature = "page-input")]
SystemShortcuts(input::keyboard::shortcuts::ShortcutMessage), SystemShortcuts(input::keyboard::shortcuts::ShortcutMessage),
#[cfg(feature = "page-input")]
TilingShortcuts(input::keyboard::shortcuts::ShortcutMessage), TilingShortcuts(input::keyboard::shortcuts::ShortcutMessage),
#[cfg(feature = "page-networking")]
Vpn(networking::vpn::Message), Vpn(networking::vpn::Message),
#[cfg(feature = "page-networking")]
WiFi(networking::wifi::Message), WiFi(networking::wifi::Message),
#[cfg(feature = "page-window-management")]
WindowManagement(desktop::window_management::Message), WindowManagement(desktop::window_management::Message),
#[cfg(feature = "page-networking")]
Wired(networking::wired::Message), Wired(networking::wired::Message),
} }

View file

@ -1,6 +1,7 @@
// Copyright 2023 System76 <info@system76.com> // Copyright 2023 System76 <info@system76.com>
// SPDX-License-Identifier: GPL-3.0-only // SPDX-License-Identifier: GPL-3.0-only
#[cfg(feature = "page-about")]
pub mod about; pub mod about;
pub mod firmware; pub mod firmware;
pub mod users; pub mod users;
@ -17,9 +18,15 @@ impl page::Page<crate::pages::Message> for Page {
} }
impl page::AutoBind<crate::pages::Message> for Page { impl page::AutoBind<crate::pages::Message> for Page {
fn sub_pages(page: page::Insert<crate::pages::Message>) -> page::Insert<crate::pages::Message> { fn sub_pages(
page.sub_page::<users::Page>() mut page: page::Insert<crate::pages::Message>,
.sub_page::<about::Page>() ) -> page::Insert<crate::pages::Message> {
.sub_page::<firmware::Page>() page = page.sub_page::<users::Page>();
#[cfg(feature = "page-about")]
{
page = page.sub_page::<about::Page>();
}
page = page.sub_page::<firmware::Page>();
page
} }
} }

View file

@ -3,6 +3,7 @@
use cosmic_settings_page as page; use cosmic_settings_page as page;
#[cfg(feature = "page-date")]
pub mod date; pub mod date;
pub mod region; pub mod region;
@ -18,7 +19,14 @@ impl page::Page<crate::pages::Message> for Page {
} }
impl page::AutoBind<crate::pages::Message> for Page { impl page::AutoBind<crate::pages::Message> for Page {
fn sub_pages(page: page::Insert<crate::pages::Message>) -> page::Insert<crate::pages::Message> { fn sub_pages(
page.sub_page::<date::Page>().sub_page::<region::Page>() mut page: page::Insert<crate::pages::Message>,
) -> page::Insert<crate::pages::Message> {
#[cfg(feature = "page-date")]
{
page = page.sub_page::<date::Page>();
}
page = page.sub_page::<region::Page>();
page
} }
} }

View file

@ -1,5 +1,7 @@
// TODO: Do not use subscriptions for pages. // TODO: Do not use subscriptions for pages.
mod desktop_files; mod desktop_files;
pub use desktop_files::*; pub use desktop_files::*;
#[cfg(feature = "ashpd")]
mod daytime; mod daytime;
#[cfg(feature = "ashpd")]
pub use daytime::*; pub use daytime::*;

View file

@ -11,7 +11,8 @@ cosmic-config = { workspace = true }
cosmic-randr-shell = { workspace = true } cosmic-randr-shell = { workspace = true }
dirs = "5.0.1" dirs = "5.0.1"
eyre = "0.6.12" eyre = "0.6.12"
fast_image_resize = { version = "5.0.0", features = ["image"] } # Upstream version 5.0.0 has compilation error on Redox's toolchain
fast_image_resize = { git = "https://github.com/jackpot51/fast_image_resize.git", features = ["image"] }
freedesktop-icons = "0.2.6" freedesktop-icons = "0.2.6"
futures-lite = "2.3.0" futures-lite = "2.3.0"
futures-util = "0.3.30" futures-util = "0.3.30"