Compare commits
33 commits
f7bdd84ae4
...
3daac73eff
| Author | SHA1 | Date | |
|---|---|---|---|
| 3daac73eff | |||
| f84e98536c | |||
| ae8be3a1eb | |||
| 74e1e1baaf | |||
| 0d184816cc | |||
| 03f3769373 | |||
| f9ff7496f3 | |||
| ba0b06da3c | |||
| 2134eedc67 | |||
| ac9caf8c2a | |||
| afff77bbfe | |||
| b4a8fd65e6 | |||
| 0c91735d11 | |||
|
|
cca48bc29e | ||
|
|
80b370d230 | ||
|
|
bce86dc7c9 | ||
|
|
904b7b95b1 | ||
|
|
ad5ea1621c | ||
|
|
9b8c48a328 | ||
|
|
4657b6a725 | ||
|
|
0d028c2dd2 | ||
|
|
dc4e89596a | ||
|
|
87901c2d48 | ||
|
|
bb10afd849 | ||
|
|
f0f68933f1 | ||
|
|
758c13723f | ||
|
|
9f71679cef | ||
|
|
4178b149e6 | ||
|
|
fe7fd5b26a | ||
|
|
c9255fe871 | ||
|
|
04a93d304c | ||
|
|
59bebbdffe | ||
|
|
8379ae7b0b |
150 changed files with 942 additions and 567 deletions
97
Cargo.toml
97
Cargo.toml
|
|
@ -1,6 +1,11 @@
|
|||
[package]
|
||||
name = "libcosmic"
|
||||
version = "1.0.0"
|
||||
# Yoda fork: hard-renamed. Every consumer (leyoda/cosmic-files fork + each
|
||||
# leyoda/cosmic-* app) depends directly on `libcosmic-yoda` by path, bypassing
|
||||
# pop-os/libcosmic entirely. No [patch] shenanigans needed — transitive deps
|
||||
# that used to ask for `libcosmic` are replaced by deps on our forks that ask
|
||||
# for `libcosmic-yoda`.
|
||||
name = "libcosmic-yoda"
|
||||
version = "0.1.0-yoda.2"
|
||||
edition = "2024"
|
||||
rust-version = "1.93"
|
||||
|
||||
|
|
@ -9,12 +14,10 @@ name = "cosmic"
|
|||
|
||||
[features]
|
||||
default = [
|
||||
"winit",
|
||||
"tokio",
|
||||
"a11y",
|
||||
"dbus-config",
|
||||
"x11",
|
||||
"iced-wayland",
|
||||
"wayland",
|
||||
"multi-window",
|
||||
]
|
||||
advanced-shaping = ["iced/advanced-shaping"]
|
||||
|
|
@ -35,7 +38,6 @@ animated-image = [
|
|||
autosize = []
|
||||
applet = [
|
||||
"autosize",
|
||||
"winit",
|
||||
"wayland",
|
||||
"tokio",
|
||||
"cosmic-panel-config",
|
||||
|
|
@ -69,7 +71,7 @@ desktop-systemd-scope = ["desktop", "dep:zbus"]
|
|||
# Enables keycode serialization
|
||||
serde-keycode = ["iced_core/serde"]
|
||||
# Prevents multiple separate process instances.
|
||||
single-instance = ["iced_winit/single-instance", "zbus/blocking-api", "ron"]
|
||||
single-instance = ["zbus/blocking-api", "ron"]
|
||||
# smol async runtime
|
||||
smol = ["dep:smol", "iced/smol", "zbus?/async-io", "rfd?/async-std"]
|
||||
tokio = [
|
||||
|
|
@ -81,32 +83,34 @@ tokio = [
|
|||
"cosmic-config/tokio",
|
||||
]
|
||||
# Tokio async runtime
|
||||
# Wayland window support
|
||||
iced-wayland = [
|
||||
# Wayland window support (yoda fork is Wayland-only; always active in default).
|
||||
# We still need iced/winit because pop-os/iced hosts the runtime dispatcher
|
||||
# (`iced_winit as shell`) there — the name is a misnomer, it's the same crate
|
||||
# that provides both the winit path AND the sctk/cctk wayland path.
|
||||
wayland = [
|
||||
"ashpd?/wayland",
|
||||
"autosize",
|
||||
"iced/winit",
|
||||
"iced/wayland",
|
||||
"iced_winit/wayland",
|
||||
"surface-message",
|
||||
]
|
||||
wayland = [
|
||||
"iced-wayland",
|
||||
"iced_runtime/cctk",
|
||||
"iced_winit/cctk",
|
||||
"iced_wgpu/cctk",
|
||||
"iced/cctk",
|
||||
"dep:iced_winit",
|
||||
"dep:cctk",
|
||||
"surface-message",
|
||||
]
|
||||
surface-message = []
|
||||
# multi-window support
|
||||
multi-window = []
|
||||
# Render with wgpu
|
||||
wgpu = ["iced/wgpu", "iced_wgpu"]
|
||||
# X11 window support via winit
|
||||
winit = ["iced/winit", "iced_winit"]
|
||||
winit_debug = ["winit", "debug"]
|
||||
winit_tokio = ["winit", "tokio"]
|
||||
winit_wgpu = ["winit", "wgpu"]
|
||||
# Compat stubs — kept empty so upstream deps (cosmic-files, cosmic-text, …)
|
||||
# that still ask for `winit` / `x11` features resolve cleanly against the
|
||||
# yoda fork. Activating them has no effect: no code is gated on these.
|
||||
winit = []
|
||||
x11 = []
|
||||
# Enables XDG portal integrations
|
||||
xdg-portal = ["ashpd"]
|
||||
qr_code = ["iced/qr_code"]
|
||||
|
|
@ -119,7 +123,6 @@ async-std = [
|
|||
"zbus?/async-io",
|
||||
"iced/async-std",
|
||||
]
|
||||
x11 = ["iced/x11", "iced_winit/x11"]
|
||||
|
||||
[dependencies]
|
||||
apply = "0.3.0"
|
||||
|
|
@ -127,10 +130,10 @@ ashpd = { version = "0.12.3", default-features = false, optional = true }
|
|||
async-fs = { version = "2.2", optional = true }
|
||||
async-std = { workspace = true, optional = true }
|
||||
auto_enums = "0.8.8"
|
||||
cctk = { git = "https://github.com/pop-os/cosmic-protocols", package = "cosmic-client-toolkit", rev = "c253ec1", optional = true }
|
||||
cctk = { path = "../cosmic-protocols/client-toolkit", package = "cosmic-client-toolkit", optional = true }
|
||||
jiff = "0.2"
|
||||
cosmic-config = { path = "cosmic-config" }
|
||||
cosmic-settings-config = { git = "https://github.com/pop-os/cosmic-settings-daemon", optional = true }
|
||||
cosmic-settings-config = { path = "../cosmic-settings-daemon/config", optional = true }
|
||||
# Internationalization
|
||||
i18n-embed = { version = "0.16.0", features = [
|
||||
"fluent-system",
|
||||
|
|
@ -174,11 +177,11 @@ ron = { workspace = true, optional = true }
|
|||
# Enable DBus feature on Linux targets
|
||||
[target.'cfg(target_os = "linux")'.dependencies]
|
||||
cosmic-config = { path = "cosmic-config", features = ["dbus"] }
|
||||
cosmic-settings-daemon = { git = "https://github.com/pop-os/dbus-settings-bindings" }
|
||||
zbus.workspace = true
|
||||
cosmic-settings-daemon = { path = "../dbus-settings-bindings/cosmic-settings-daemon" }
|
||||
zbus = { version = "5.14.0", default-features = false }
|
||||
|
||||
[target.'cfg(all(unix, not(target_os = "macos")))'.dependencies]
|
||||
freedesktop-icons = { package = "cosmic-freedesktop-icons", git = "https://github.com/pop-os/freedesktop-icons" }
|
||||
freedesktop-icons = { package = "cosmic-freedesktop-icons", path = "../cosmic-freedesktop-icons" }
|
||||
freedesktop-desktop-entry = { version = "0.8.1", optional = true }
|
||||
shlex = { version = "1.3.0", optional = true }
|
||||
|
||||
|
|
@ -224,28 +227,58 @@ optional = true
|
|||
|
||||
[dependencies.iced_tiny_skia]
|
||||
path = "./iced/tiny_skia"
|
||||
# Yoda: drop the x11 default → softbuffer no longer pulls tiny-xlib/x11-dl/etc.
|
||||
default-features = false
|
||||
features = ["wayland"]
|
||||
|
||||
[dependencies.iced_winit]
|
||||
path = "./iced/winit"
|
||||
optional = true
|
||||
# Yoda: drop the x11 default → winit won't pull winit-x11/tiny-xlib/x11-dl.
|
||||
# Keep wayland + wayland-dlopen (default behaviour minus x11).
|
||||
default-features = false
|
||||
features = ["wayland", "wayland-dlopen"]
|
||||
|
||||
[dependencies.iced_wgpu]
|
||||
path = "./iced/wgpu"
|
||||
optional = true
|
||||
|
||||
[dependencies.cosmic-panel-config]
|
||||
git = "https://github.com/pop-os/cosmic-panel"
|
||||
# path = "../cosmic-panel/cosmic-panel-config"
|
||||
path = "../cosmic-panel/cosmic-panel-config"
|
||||
optional = true
|
||||
|
||||
[patch.'https://github.com/pop-os/freedesktop-icons']
|
||||
cosmic-freedesktop-icons = { path = "../cosmic-freedesktop-icons" }
|
||||
|
||||
[patch.'https://github.com/pop-os/softbuffer']
|
||||
softbuffer = { path = "../softbuffer" }
|
||||
|
||||
[patch.'https://github.com/pop-os/smithay-clipboard']
|
||||
smithay-clipboard = { path = "../smithay-clipboard" }
|
||||
|
||||
[patch.'https://github.com/pop-os/winit.git']
|
||||
dpi = { path = "../winit/dpi" }
|
||||
winit = { path = "../winit/winit" }
|
||||
winit-android = { path = "../winit/winit-android" }
|
||||
winit-appkit = { path = "../winit/winit-appkit" }
|
||||
winit-common = { path = "../winit/winit-common" }
|
||||
winit-core = { path = "../winit/winit-core" }
|
||||
winit-orbital = { path = "../winit/winit-orbital" }
|
||||
winit-uikit = { path = "../winit/winit-uikit" }
|
||||
winit-wayland = { path = "../winit/winit-wayland" }
|
||||
winit-web = { path = "../winit/winit-web" }
|
||||
winit-win32 = { path = "../winit/winit-win32" }
|
||||
winit-x11 = { path = "../winit/winit-x11" }
|
||||
|
||||
[workspace]
|
||||
members = [
|
||||
"cosmic-config",
|
||||
"cosmic-config-derive",
|
||||
"cosmic-theme",
|
||||
"examples/*",
|
||||
]
|
||||
exclude = ["iced"]
|
||||
# examples/* excluded — many depend on the removed winit/x11 features.
|
||||
# They will be revisited and adapted in a later phase.
|
||||
exclude = ["iced", "examples"]
|
||||
|
||||
[workspace.dependencies]
|
||||
async-std = "1.13"
|
||||
|
|
@ -258,5 +291,13 @@ tracing = "0.1"
|
|||
tokio = "1.52"
|
||||
zbus = {version = "5.15", default-features = false}
|
||||
|
||||
# Speed up snapshot diffing in cosmic-theme tests. Cargo silently ignores
|
||||
# [profile.*] blocks in non-root manifests, so this lives at the
|
||||
# workspace root.
|
||||
[profile.dev.package.insta]
|
||||
opt-level = 3
|
||||
[profile.dev.package.similar]
|
||||
opt-level = 3
|
||||
|
||||
[dev-dependencies]
|
||||
tempfile = "3.27.0"
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@ macro = ["cosmic-config-derive"]
|
|||
subscription = ["iced_futures"]
|
||||
|
||||
[dependencies]
|
||||
cosmic-settings-daemon = { git = "https://github.com/pop-os/dbus-settings-bindings", optional = true }
|
||||
zbus = { workspace = true, default-features = false, optional = true }
|
||||
cosmic-settings-daemon = { path = "../../dbus-settings-bindings/cosmic-settings-daemon", optional = true }
|
||||
zbus = { version = "5.14.0", default-features = false, optional = true }
|
||||
atomicwrites = { git = "https://github.com/jackpot51/rust-atomicwrites" }
|
||||
calloop = { version = "0.14.4", optional = true }
|
||||
notify = "8.2.0"
|
||||
|
|
|
|||
|
|
@ -34,6 +34,3 @@ thiserror.workspace = true
|
|||
[dev-dependencies]
|
||||
insta = "1.47.2"
|
||||
|
||||
[profile.dev.package]
|
||||
insta.opt-level = 3
|
||||
similar.opt-level = 3
|
||||
|
|
|
|||
|
|
@ -955,6 +955,12 @@ impl ThemeBuilder {
|
|||
}
|
||||
|
||||
#[allow(clippy::too_many_lines)]
|
||||
// The component_hovered/pressed_overlay vars are seeded once near the
|
||||
// top of this fn and then reassigned inside each container block
|
||||
// (primary, secondary, …) before being read again. The initial seed
|
||||
// is therefore overwritten before any read, which is what the
|
||||
// unused_assignments lint flags below.
|
||||
#[allow(unused_assignments)]
|
||||
/// build the theme
|
||||
pub fn build(self) -> Theme {
|
||||
let Self {
|
||||
|
|
|
|||
|
|
@ -1,12 +1,13 @@
|
|||
use crate::composite::over;
|
||||
use crate::steps::steps;
|
||||
use crate::{Component, Theme};
|
||||
use palette::rgb::Rgba;
|
||||
use palette::{Darken, IntoColor, Lighten, Srgba, WithAlpha};
|
||||
use std::fs::{self, File};
|
||||
use std::io::{self, Write};
|
||||
use std::num::NonZeroUsize;
|
||||
use std::path::Path;
|
||||
use crate::{Component, Theme, composite::over, steps::steps};
|
||||
use configparser::ini::Ini;
|
||||
use palette::{Darken, IntoColor, Lighten, Srgba, WithAlpha, rgb::Rgba};
|
||||
use std::{
|
||||
fs::{self, File},
|
||||
io::{self, Write},
|
||||
num::NonZeroUsize,
|
||||
path::Path,
|
||||
process::Command,
|
||||
};
|
||||
|
||||
use super::{OutputError, to_rgba};
|
||||
|
||||
|
|
@ -218,6 +219,50 @@ impl Theme {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
/// Apply the preferred GTK client-side decoration button layout.
|
||||
///
|
||||
/// This writes the GTK 3/4 `settings.ini` value used by GTK header bars and
|
||||
/// also best-effort updates GNOME's `button-layout` GSettings key for apps
|
||||
/// that still consult it.
|
||||
///
|
||||
/// # Errors
|
||||
///
|
||||
/// Returns an `OutputError` if the GTK settings files cannot be written.
|
||||
#[cold]
|
||||
pub fn apply_gtk_decoration_layout(buttons_at_start: bool) -> Result<(), OutputError> {
|
||||
let Some(config_dir) = dirs::config_dir() else {
|
||||
return Err(OutputError::MissingConfigDir);
|
||||
};
|
||||
|
||||
let layout = if buttons_at_start {
|
||||
"close,minimize,maximize:"
|
||||
} else {
|
||||
":minimize,maximize,close"
|
||||
};
|
||||
|
||||
for gtk_version in ["gtk-3.0", "gtk-4.0"] {
|
||||
let gtk_dir = config_dir.join(gtk_version);
|
||||
fs::create_dir_all(>k_dir).map_err(OutputError::Io)?;
|
||||
Self::write_gtk_settings_key(
|
||||
>k_dir.join("settings.ini"),
|
||||
"gtk-decoration-layout",
|
||||
layout,
|
||||
)?;
|
||||
}
|
||||
|
||||
// best-effort: gsettings is absent on non-GNOME systems
|
||||
let _ = Command::new("gsettings")
|
||||
.args([
|
||||
"set",
|
||||
"org.gnome.desktop.wm.preferences",
|
||||
"button-layout",
|
||||
layout,
|
||||
])
|
||||
.status();
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Reset the applied gtk css
|
||||
///
|
||||
/// # Errors
|
||||
|
|
@ -257,6 +302,20 @@ impl Theme {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
#[cold]
|
||||
fn write_gtk_settings_key(path: &Path, key: &str, value: &str) -> Result<(), OutputError> {
|
||||
let mut ini = Ini::new_cs();
|
||||
|
||||
if path.exists() {
|
||||
let file_content = fs::read_to_string(path).map_err(OutputError::Io)?;
|
||||
ini.read(file_content).map_err(OutputError::Ini)?;
|
||||
}
|
||||
|
||||
ini.setstr("Settings", key, Some(value));
|
||||
ini.pretty_write(path, &super::qt_settings_ini_style())
|
||||
.map_err(OutputError::Io)
|
||||
}
|
||||
|
||||
fn is_cosmic_css(path: &Path, cosmic_css: &Path) -> io::Result<Option<bool>> {
|
||||
if !path.exists() {
|
||||
return Ok(None);
|
||||
|
|
|
|||
|
|
@ -266,6 +266,14 @@ impl From<Theme> for VsTheme {
|
|||
}
|
||||
|
||||
impl Theme {
|
||||
/// Write this theme to VS Code's `settings.json` as a
|
||||
/// `workbench.colorCustomizations` entry, and enable
|
||||
/// `window.autoDetectColorScheme` so VS Code follows the system theme.
|
||||
///
|
||||
/// # Errors
|
||||
///
|
||||
/// Returns an `OutputError` if the user config dir is missing, the
|
||||
/// settings file cannot be read/written, or its JSON is invalid.
|
||||
#[cold]
|
||||
pub fn apply_vs_code(self) -> Result<(), OutputError> {
|
||||
let vs_theme = VsTheme::from(self);
|
||||
|
|
@ -291,6 +299,13 @@ impl Theme {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
/// Remove the `workbench.colorCustomizations` entry previously written
|
||||
/// by [`Theme::apply_vs_code`] from VS Code's `settings.json`.
|
||||
///
|
||||
/// # Errors
|
||||
///
|
||||
/// Returns an `OutputError` if the user config dir is missing, the
|
||||
/// settings file cannot be read/written, or its JSON is invalid.
|
||||
#[cold]
|
||||
pub fn reset_vs_code() -> Result<(), OutputError> {
|
||||
let mut config_dir = dirs::config_dir().ok_or(OutputError::MissingConfigDir)?;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ edition = "2021"
|
|||
[dependencies]
|
||||
open = "5.3.3"
|
||||
|
||||
[dependencies.libcosmic]
|
||||
[dependencies.libcosmic-yoda]
|
||||
path = "../../"
|
||||
features = [
|
||||
"debug",
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ tracing = "0.1"
|
|||
env_logger = "0.10.2"
|
||||
log = "0.4.29"
|
||||
|
||||
[dependencies.libcosmic]
|
||||
[dependencies.libcosmic-yoda]
|
||||
path = "../../"
|
||||
default-features = false
|
||||
features = ["applet-token"]
|
||||
|
|
|
|||
|
|
@ -123,8 +123,6 @@ impl cosmic::Application for Window {
|
|||
},
|
||||
Some(Box::new(move |state: &Window| {
|
||||
let content_list = list_column()
|
||||
.padding(5)
|
||||
.spacing(0)
|
||||
.add(settings::item(
|
||||
"Example row",
|
||||
cosmic::widget::container(
|
||||
|
|
|
|||
|
|
@ -5,12 +5,12 @@ edition = "2021"
|
|||
|
||||
[features]
|
||||
default = ["wayland"]
|
||||
wayland = ["libcosmic/wayland"]
|
||||
wayland = ["libcosmic-yoda/wayland"]
|
||||
|
||||
[dependencies]
|
||||
env_logger = "0.11"
|
||||
|
||||
[dependencies.libcosmic]
|
||||
[dependencies.libcosmic-yoda]
|
||||
path = "../../"
|
||||
features = [
|
||||
"debug",
|
||||
|
|
|
|||
|
|
@ -8,6 +8,6 @@ edition = "2024"
|
|||
[dependencies]
|
||||
jiff = "0.2"
|
||||
|
||||
[dependencies.libcosmic]
|
||||
[dependencies.libcosmic-yoda]
|
||||
path = "../../"
|
||||
features = ["debug", "winit", "tokio", "xdg-portal", "wgpu"]
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ tracing = "0.1.44"
|
|||
tracing-subscriber = "0.3.22"
|
||||
tracing-log = "0.2.0"
|
||||
|
||||
[dependencies.libcosmic]
|
||||
[dependencies.libcosmic-yoda]
|
||||
path = "../../"
|
||||
features = [
|
||||
"debug",
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ publish = false
|
|||
[dependencies]
|
||||
apply = "0.3.0"
|
||||
fraction = "0.15.3"
|
||||
libcosmic = { path = "../..", features = [
|
||||
libcosmic-yoda = { path = "../..", features = [
|
||||
"debug",
|
||||
"winit",
|
||||
"tokio",
|
||||
|
|
|
|||
|
|
@ -7,6 +7,6 @@ edition = "2021"
|
|||
tracing = "0.1.44"
|
||||
tracing-subscriber = "0.3.22"
|
||||
|
||||
[dependencies.libcosmic]
|
||||
[dependencies.libcosmic-yoda]
|
||||
path = "../../"
|
||||
features = ["debug", "winit", "wgpu", "tokio"]
|
||||
|
|
|
|||
|
|
@ -8,6 +8,6 @@ tracing = "0.1.44"
|
|||
tracing-subscriber = "0.3.22"
|
||||
tracing-log = "0.2.0"
|
||||
|
||||
[dependencies.libcosmic]
|
||||
[dependencies.libcosmic-yoda]
|
||||
path = "../../"
|
||||
features = ["debug", "winit", "tokio", "xdg-portal", "wgpu"]
|
||||
|
|
|
|||
|
|
@ -6,4 +6,4 @@ edition = "2021"
|
|||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
libcosmic = { path = "../..", features = ["debug", "winit", "tokio", "single-instance", "wgpu", "wayland"] }
|
||||
libcosmic-yoda = { path = "../..", features = ["debug", "winit", "tokio", "single-instance", "wgpu", "wayland"] }
|
||||
|
|
|
|||
|
|
@ -8,6 +8,6 @@ tracing = "0.1.44"
|
|||
tracing-subscriber = "0.3.22"
|
||||
tracing-log = "0.2.0"
|
||||
|
||||
[dependencies.libcosmic]
|
||||
[dependencies.libcosmic-yoda]
|
||||
path = "../../"
|
||||
features = ["debug", "winit", "tokio", "xdg-portal", "wgpu"]
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@ edition = "2021"
|
|||
|
||||
[features]
|
||||
default = ["xdg-portal"]
|
||||
rfd = ["libcosmic/rfd"]
|
||||
xdg-portal = ["libcosmic/xdg-portal"]
|
||||
rfd = ["libcosmic-yoda/rfd"]
|
||||
xdg-portal = ["libcosmic-yoda/xdg-portal"]
|
||||
|
||||
[dependencies]
|
||||
apply = "0.3.0"
|
||||
|
|
@ -15,6 +15,6 @@ tracing = "0.1.44"
|
|||
tracing-subscriber = "0.3.22"
|
||||
url = "2.5.8"
|
||||
|
||||
[dependencies.libcosmic]
|
||||
[dependencies.libcosmic-yoda]
|
||||
features = ["debug", "winit", "wgpu", "wayland", "tokio"]
|
||||
path = "../../"
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ edition = "2021"
|
|||
[dependencies]
|
||||
fraction = "0.15.3"
|
||||
|
||||
[dependencies.libcosmic]
|
||||
[dependencies.libcosmic-yoda]
|
||||
features = ["debug", "wgpu", "winit", "desktop", "tokio"]
|
||||
path = "../.."
|
||||
default-features = false
|
||||
|
|
|
|||
|
|
@ -5,6 +5,6 @@ edition = "2024"
|
|||
|
||||
[dependencies]
|
||||
|
||||
[dependencies.libcosmic]
|
||||
[dependencies.libcosmic-yoda]
|
||||
path = "../../"
|
||||
features = ["debug", "winit", "wgpu", "tokio", "xdg-portal"]
|
||||
|
|
|
|||
|
|
@ -9,6 +9,6 @@ tracing-subscriber = "0.3.22"
|
|||
tracing-log = "0.2.0"
|
||||
chrono = "*"
|
||||
|
||||
[dependencies.libcosmic]
|
||||
[dependencies.libcosmic-yoda]
|
||||
features = ["debug", "wgpu", "winit", "desktop", "tokio"]
|
||||
path = "../.."
|
||||
|
|
|
|||
|
|
@ -8,6 +8,6 @@ tracing = "0.1.44"
|
|||
tracing-subscriber = "0.3.22"
|
||||
tracing-log = "0.2.0"
|
||||
|
||||
[dependencies.libcosmic]
|
||||
[dependencies.libcosmic-yoda]
|
||||
path = "../../"
|
||||
features = ["debug", "winit", "wgpu", "tokio", "xdg-portal"]
|
||||
|
|
|
|||
2
iced
2
iced
|
|
@ -1 +1 @@
|
|||
Subproject commit 98fb6a0fba98cfdb6c04f33ccf0be6abad7fcfff
|
||||
Subproject commit d9fe129f7316cea3ef6d2576e9421a305759b8bf
|
||||
6
justfile
6
justfile
|
|
@ -23,6 +23,12 @@ check-json: (check '--message-format=json')
|
|||
clean:
|
||||
cargo clean
|
||||
|
||||
# Generate documentation
|
||||
doc:
|
||||
env RUSTDOCFLAGS="--cfg docsrs" cargo +nightly-2026-04-27 doc --no-deps --verbose \
|
||||
-p cosmic-client-toolkit -p cosmic-protocols -p libcosmic \
|
||||
--features tokio,winit,wayland,desktop,single-instance,applet,xdg-portal,multi-window
|
||||
|
||||
# Also remove .cargo and vendored dependencies
|
||||
clean-dist: clean
|
||||
rm -rf .cargo vendor vendor.tar target
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
// Copyright 2023 System76 <info@system76.com>
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
#[cfg(feature = "winit")]
|
||||
use crate::app;
|
||||
#[cfg(feature = "single-instance")]
|
||||
use crate::dbus_activation;
|
||||
|
|
@ -9,7 +8,6 @@ use crate::dbus_activation;
|
|||
pub const fn app<M>(message: M) -> Action<M> {
|
||||
Action::App(message)
|
||||
}
|
||||
#[cfg(feature = "winit")]
|
||||
pub const fn cosmic<M>(message: app::Action) -> Action<M> {
|
||||
Action::Cosmic(message)
|
||||
}
|
||||
|
|
@ -23,7 +21,6 @@ pub const fn none<M>() -> Action<M> {
|
|||
pub enum Action<M> {
|
||||
/// Messages from the application, for the application.
|
||||
App(M),
|
||||
#[cfg(feature = "winit")]
|
||||
/// Internal messages to be handled by libcosmic.
|
||||
Cosmic(app::Action),
|
||||
#[cfg(feature = "single-instance")]
|
||||
|
|
|
|||
|
|
@ -100,9 +100,10 @@ impl<T: Application> Cosmic<T>
|
|||
where
|
||||
T::Message: Send + 'static,
|
||||
{
|
||||
pub fn init(
|
||||
(mut core, flags): (Core, T::Flags),
|
||||
) -> (Self, iced::Task<crate::Action<T::Message>>) {
|
||||
pub fn init((core, flags): (Core, T::Flags)) -> (Self, iced::Task<crate::Action<T::Message>>) {
|
||||
#[cfg(all(feature = "dbus-config", target_os = "linux"))]
|
||||
let mut core = core;
|
||||
|
||||
#[cfg(all(feature = "dbus-config", target_os = "linux"))]
|
||||
{
|
||||
use iced_futures::futures::executor::block_on;
|
||||
|
|
@ -364,7 +365,6 @@ where
|
|||
crate::surface::Action::Task(f) => {
|
||||
f().map(|sm| crate::Action::Cosmic(Action::Surface(sm)))
|
||||
}
|
||||
_ => iced::Task::none(),
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "surface-message"))]
|
||||
|
|
@ -408,7 +408,7 @@ where
|
|||
f64::from(self.app.core().scale_factor())
|
||||
}
|
||||
|
||||
pub fn style(&self, theme: &Theme) -> theme::Style {
|
||||
pub fn style(&self, _theme: &Theme) -> theme::Style {
|
||||
if let Some(style) = self.app.style() {
|
||||
style
|
||||
} else if self.app.core().window.is_maximized {
|
||||
|
|
@ -480,12 +480,11 @@ where
|
|||
.into_iter()
|
||||
.filter(cosmic_config::Error::is_err)
|
||||
{
|
||||
if let cosmic_config::Error::GetKey(_, err) = &why {
|
||||
if err.kind() == std::io::ErrorKind::NotFound {
|
||||
if let cosmic_config::Error::GetKey(_, err) = &why
|
||||
&& err.kind() == std::io::ErrorKind::NotFound {
|
||||
// No system default config installed; don't error
|
||||
continue;
|
||||
}
|
||||
}
|
||||
tracing::error!(?why, "cosmic toolkit config update error");
|
||||
}
|
||||
|
||||
|
|
@ -621,15 +620,15 @@ impl<T: Application> Cosmic<T> {
|
|||
#[allow(clippy::too_many_lines)]
|
||||
fn cosmic_update(&mut self, message: Action) -> iced::Task<crate::Action<T::Message>> {
|
||||
match message {
|
||||
Action::WindowMaximized(id, maximized) => {
|
||||
Action::WindowMaximized(_id, _maximized) => {
|
||||
#[cfg(not(all(feature = "wayland", target_os = "linux")))]
|
||||
if self
|
||||
.app
|
||||
.core()
|
||||
.main_window_id()
|
||||
.is_some_and(|main_id| main_id == id)
|
||||
.is_some_and(|main_id| main_id == _id)
|
||||
{
|
||||
self.app.core_mut().window.sharp_corners = maximized;
|
||||
self.app.core_mut().window.sharp_corners = _maximized;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ pub fn run<App: Application>(settings: Settings, flags: App::Flags) -> iced::Res
|
|||
crate::malloc::limit_mmap_threshold(threshold);
|
||||
}
|
||||
|
||||
let default_font = settings.default_font;
|
||||
let _default_font = settings.default_font;
|
||||
let (settings, (mut core, flags), window_settings) = iced_settings::<App>(settings, flags);
|
||||
#[cfg(not(feature = "multi-window"))]
|
||||
{
|
||||
|
|
@ -284,7 +284,7 @@ where
|
|||
// app = app.window(window_settings);
|
||||
core.main_window = Some(iced_core::window::Id::RESERVED);
|
||||
}
|
||||
let mut app = iced::daemon(
|
||||
let app = iced::daemon(
|
||||
BootData(Rc::new(RefCell::new(Some(BootDataInner::<App> {
|
||||
flags,
|
||||
core,
|
||||
|
|
|
|||
|
|
@ -1,14 +1,13 @@
|
|||
//! Distribute content horizontally.
|
||||
use crate::iced;
|
||||
use iced::core::alignment::{self, Alignment};
|
||||
use iced::core::event::{self, Event};
|
||||
use iced::core::event::Event;
|
||||
use iced::core::layout::{self, Layout};
|
||||
use iced::core::widget::{Operation, Tree};
|
||||
use iced::core::{
|
||||
Clipboard, Element, Length, Padding, Pixels, Rectangle, Shell, Size, Vector, Widget, mouse,
|
||||
overlay, renderer, widget,
|
||||
};
|
||||
use iced::touch;
|
||||
|
||||
/// A container that distributes its contents horizontally.
|
||||
///
|
||||
|
|
|
|||
|
|
@ -27,12 +27,10 @@ pub fn set_title<M>(id: window::Id, title: String) -> iced::Task<crate::Action<M
|
|||
iced::Task::none()
|
||||
}
|
||||
|
||||
#[cfg(feature = "winit")]
|
||||
pub fn set_scaling_factor<M: Send + 'static>(factor: f32) -> iced::Task<crate::Action<M>> {
|
||||
iced::Task::done(crate::app::Action::ScaleFactor(factor)).map(crate::Action::Cosmic)
|
||||
}
|
||||
|
||||
#[cfg(feature = "winit")]
|
||||
pub fn set_theme<M: Send + 'static>(theme: crate::Theme) -> iced::Task<crate::Action<M>> {
|
||||
iced::Task::done(crate::app::Action::AppThemeChange(theme)).map(crate::Action::Cosmic)
|
||||
}
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue