diff --git a/Cargo.lock b/Cargo.lock index 78a90b72..aa1cf48d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1042,7 +1042,6 @@ dependencies = [ "itertools", "libcosmic", "memmap2 0.9.5", - "once_cell", "rand 0.9.1", "rust-embed", "rustix 1.0.7", @@ -1076,7 +1075,6 @@ dependencies = [ "i18n-embed", "i18n-embed-fl", "libcosmic", - "once_cell", "rust-embed", "tokio", "tracing", @@ -1119,7 +1117,6 @@ dependencies = [ "i18n-embed", "i18n-embed-fl", "libcosmic", - "once_cell", "rust-embed", "tokio", "tracing", @@ -1140,7 +1137,6 @@ dependencies = [ "i18n-embed", "i18n-embed-fl", "libcosmic", - "once_cell", "rand 0.9.1", "rust-embed", "tokio", @@ -1158,7 +1154,6 @@ dependencies = [ "i18n-embed-fl", "libcosmic", "libpulse-binding", - "once_cell", "rust-embed", "serde", "tokio", @@ -1178,7 +1173,6 @@ dependencies = [ "image", "libcosmic", "memmap2 0.9.5", - "once_cell", "rust-embed", "rustix 1.0.7", "tokio", @@ -1241,7 +1235,6 @@ dependencies = [ "i18n-embed-fl", "libcosmic", "logind-zbus", - "once_cell", "rust-embed", "rustix 1.0.7", "tokio", @@ -1277,7 +1270,6 @@ dependencies = [ "i18n-embed", "i18n-embed-fl", "libcosmic", - "once_cell", "rust-embed", "tokio", "tracing", @@ -1299,7 +1291,6 @@ dependencies = [ "icu", "libcosmic", "logind-zbus", - "once_cell", "rust-embed", "serde", "timedate-zbus", @@ -1321,7 +1312,6 @@ dependencies = [ "i18n-embed", "i18n-embed-fl", "libcosmic", - "once_cell", "rust-embed", "tokio", "tracing", @@ -1478,7 +1468,6 @@ version = "0.1.0" dependencies = [ "cosmic-config", "libcosmic", - "once_cell", "serde", "tracing", "tracing-log", @@ -1609,7 +1598,6 @@ source = "git+https://github.com/pop-os/cosmic-time#bbb9fb829b25e0bc2bbb382c2554 dependencies = [ "float-cmp", "libcosmic", - "once_cell", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 9d407fd0..afb5558f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -32,12 +32,8 @@ cosmic-protocols = { git = "https://github.com/pop-os/cosmic-protocols", default ], rev = "1425bd4" } cosmic-settings-subscriptions = { git = "https://github.com/pop-os/cosmic-settings-subscriptions" } -cosmic-time = { git = "https://github.com/pop-os/cosmic-time", default-features = false, features = [ - "once_cell", -] } -# cosmic-time = { path = "../cosmic-time", default-features = false, features = [ -# "once_cell", -# ] } +cosmic-time = { git = "https://github.com/pop-os/cosmic-time", default-features = false } +# cosmic-time = { path = "../cosmic-time", default-features = false ] } futures = "0.3" futures-util = "0.3" @@ -56,7 +52,6 @@ libcosmic = { git = "https://github.com/pop-os/libcosmic", default-features = fa "desktop-systemd-scope", "winit", ] } -once_cell = "1" rust-embed = "8.5" rust-embed-utils = "8.5.0" rustix = { version = "1.0", features = ["fs", "process"] } diff --git a/cosmic-app-list/Cargo.toml b/cosmic-app-list/Cargo.toml index c49472be..f094f48c 100644 --- a/cosmic-app-list/Cargo.toml +++ b/cosmic-app-list/Cargo.toml @@ -16,7 +16,6 @@ image = { version = "0.25.5", default-features = false } itertools = "0.14.0" libcosmic.workspace = true memmap2 = "0.9.5" -once_cell = "1.20" rand = "0.9.0" rust-embed.workspace = true rustix.workspace = true diff --git a/cosmic-app-list/src/localize.rs b/cosmic-app-list/src/localize.rs index bf9f05fe..e4cbbb87 100644 --- a/cosmic-app-list/src/localize.rs +++ b/cosmic-app-list/src/localize.rs @@ -5,14 +5,14 @@ use i18n_embed::{ fluent::{fluent_language_loader, FluentLanguageLoader}, DefaultLocalizer, LanguageLoader, Localizer, }; -use once_cell::sync::Lazy; use rust_embed::RustEmbed; +use std::sync::LazyLock; #[derive(RustEmbed)] #[folder = "i18n/"] struct Localizations; -pub static LANGUAGE_LOADER: Lazy = Lazy::new(|| { +pub static LANGUAGE_LOADER: LazyLock = LazyLock::new(|| { let loader: FluentLanguageLoader = fluent_language_loader!(); loader diff --git a/cosmic-app-list/src/wayland_subscription.rs b/cosmic-app-list/src/wayland_subscription.rs index 9431f9d7..3fd8a210 100644 --- a/cosmic-app-list/src/wayland_subscription.rs +++ b/cosmic-app-list/src/wayland_subscription.rs @@ -21,14 +21,14 @@ use futures::{ channel::mpsc::{unbounded, UnboundedReceiver}, SinkExt, StreamExt, }; -use once_cell::sync::Lazy; use std::fmt::Debug; +use std::sync::LazyLock; use tokio::sync::Mutex; use crate::wayland_handler::wayland_handler; -pub static WAYLAND_RX: Lazy>>> = - Lazy::new(|| Mutex::new(None)); +pub static WAYLAND_RX: LazyLock>>> = + LazyLock::new(|| Mutex::new(None)); pub fn wayland_subscription() -> iced::Subscription { Subscription::run_with_id( diff --git a/cosmic-applet-a11y/Cargo.toml b/cosmic-applet-a11y/Cargo.toml index a6c67663..b7e3b3eb 100644 --- a/cosmic-applet-a11y/Cargo.toml +++ b/cosmic-applet-a11y/Cargo.toml @@ -17,7 +17,6 @@ i18n-embed-fl.workspace = true i18n-embed.workspace = true libcosmic.workspace = true rust-embed.workspace = true -once_cell = "1" tokio.workspace = true tracing-log.workspace = true tracing-subscriber.workspace = true diff --git a/cosmic-applet-a11y/src/app.rs b/cosmic-applet-a11y/src/app.rs index 0e18294e..03c65c45 100644 --- a/cosmic-applet-a11y/src/app.rs +++ b/cosmic-applet-a11y/src/app.rs @@ -28,14 +28,15 @@ use cosmic_settings_subscriptions::{ accessibility::{self, DBusRequest, DBusUpdate}, cosmic_a11y_manager::{AccessibilityEvent, AccessibilityRequest, ColorFilter}, }; -use cosmic_time::{anim, chain, id, once_cell::sync::Lazy, Instant, Timeline}; +use cosmic_time::{anim, chain, id, Instant, Timeline}; +use std::sync::LazyLock; use tokio::sync::mpsc::UnboundedSender; -static READER_TOGGLE: Lazy = Lazy::new(id::Toggler::unique); -static FILTER_TOGGLE: Lazy = Lazy::new(id::Toggler::unique); -static HC_TOGGLE: Lazy = Lazy::new(id::Toggler::unique); -static MAGNIFIER_TOGGLE: Lazy = Lazy::new(id::Toggler::unique); -static INVERT_COLORS_TOGGLE: Lazy = Lazy::new(id::Toggler::unique); +static READER_TOGGLE: LazyLock = LazyLock::new(id::Toggler::unique); +static FILTER_TOGGLE: LazyLock = LazyLock::new(id::Toggler::unique); +static HC_TOGGLE: LazyLock = LazyLock::new(id::Toggler::unique); +static MAGNIFIER_TOGGLE: LazyLock = LazyLock::new(id::Toggler::unique); +static INVERT_COLORS_TOGGLE: LazyLock = LazyLock::new(id::Toggler::unique); pub fn run() -> cosmic::iced::Result { cosmic::applet::run::(()) diff --git a/cosmic-applet-a11y/src/backend/wayland/mod.rs b/cosmic-applet-a11y/src/backend/wayland/mod.rs index b26fd09c..6a9cec00 100644 --- a/cosmic-applet-a11y/src/backend/wayland/mod.rs +++ b/cosmic-applet-a11y/src/backend/wayland/mod.rs @@ -12,11 +12,11 @@ use cosmic_protocols::a11y::v1::client::cosmic_a11y_manager_v1::Filter; use cosmic_settings_subscriptions::cosmic_a11y_manager::{ self as thread, AccessibilityEvent, AccessibilityRequest, }; -use once_cell::sync::Lazy; +use std::sync::LazyLock; use tokio::sync::Mutex; -pub static WAYLAND_RX: Lazy>>> = - Lazy::new(|| Mutex::new(None)); +pub static WAYLAND_RX: LazyLock>>> = + LazyLock::new(|| Mutex::new(None)); #[derive(Debug, Clone)] pub enum WaylandUpdate { diff --git a/cosmic-applet-a11y/src/localize.rs b/cosmic-applet-a11y/src/localize.rs index b69ee397..e825f851 100644 --- a/cosmic-applet-a11y/src/localize.rs +++ b/cosmic-applet-a11y/src/localize.rs @@ -5,14 +5,14 @@ use i18n_embed::{ fluent::{fluent_language_loader, FluentLanguageLoader}, DefaultLocalizer, LanguageLoader, Localizer, }; -use once_cell::sync::Lazy; use rust_embed::RustEmbed; +use std::sync::LazyLock; #[derive(RustEmbed)] #[folder = "i18n/"] struct Localizations; -pub static LANGUAGE_LOADER: Lazy = Lazy::new(|| { +pub static LANGUAGE_LOADER: LazyLock = LazyLock::new(|| { let loader: FluentLanguageLoader = fluent_language_loader!(); loader diff --git a/cosmic-applet-audio/src/lib.rs b/cosmic-applet-audio/src/lib.rs index 66118c55..d7695f5d 100644 --- a/cosmic-applet-audio/src/lib.rs +++ b/cosmic-applet-audio/src/lib.rs @@ -4,6 +4,7 @@ mod localize; mod mouse_area; +use std::sync::LazyLock; use std::time::Duration; use crate::{localize::localize, pulse::DeviceInfo}; @@ -28,7 +29,7 @@ use cosmic::{ Element, Renderer, Task, Theme, }; use cosmic_settings_subscriptions::pulse as sub_pulse; -use cosmic_time::{anim, chain, id, once_cell::sync::Lazy, Instant, Timeline}; +use cosmic_time::{anim, chain, id, Instant, Timeline}; use iced::{ platform_specific::shell::wayland::commands::popup::{destroy_popup, get_popup}, widget::container, @@ -47,7 +48,7 @@ static FULL_VOLUME: f64 = Volume::NORMAL.0 as f64; // Max volume is 150% volume. static MAX_VOLUME: f64 = FULL_VOLUME + (FULL_VOLUME * 0.5); -static SHOW_MEDIA_CONTROLS: Lazy = Lazy::new(id::Toggler::unique); +static SHOW_MEDIA_CONTROLS: LazyLock = LazyLock::new(id::Toggler::unique); const GO_BACK: &str = "media-skip-backward-symbolic"; const GO_NEXT: &str = "media-skip-forward-symbolic"; diff --git a/cosmic-applet-audio/src/localize.rs b/cosmic-applet-audio/src/localize.rs index fea2f3ec..e825f851 100644 --- a/cosmic-applet-audio/src/localize.rs +++ b/cosmic-applet-audio/src/localize.rs @@ -1,18 +1,18 @@ // Copyright 2023 System76 // SPDX-License-Identifier: GPL-3.0-only -use cosmic_time::once_cell::sync::Lazy; use i18n_embed::{ fluent::{fluent_language_loader, FluentLanguageLoader}, DefaultLocalizer, LanguageLoader, Localizer, }; use rust_embed::RustEmbed; +use std::sync::LazyLock; #[derive(RustEmbed)] #[folder = "i18n/"] struct Localizations; -pub static LANGUAGE_LOADER: Lazy = Lazy::new(|| { +pub static LANGUAGE_LOADER: LazyLock = LazyLock::new(|| { let loader: FluentLanguageLoader = fluent_language_loader!(); loader diff --git a/cosmic-applet-audio/src/pulse.rs b/cosmic-applet-audio/src/pulse.rs index f0db70ed..c7f779cc 100644 --- a/cosmic-applet-audio/src/pulse.rs +++ b/cosmic-applet-audio/src/pulse.rs @@ -1,7 +1,7 @@ // Copyright 2023 System76 // SPDX-License-Identifier: GPL-3.0-only -use std::{cell::RefCell, mem, rc::Rc, thread, time::Duration}; +use std::{cell::RefCell, mem, rc::Rc, sync::LazyLock, thread, time::Duration}; extern crate libpulse_binding as pulse; @@ -9,7 +9,6 @@ use cosmic::{ iced::{self, stream, Subscription}, iced_futures::futures::{self, SinkExt}, }; -use cosmic_time::once_cell::sync::Lazy; use libpulse_binding::{ callbacks::ListResult, @@ -25,8 +24,8 @@ use libpulse_binding::{ use tokio::sync::{mpsc, Mutex}; -pub static FROM_PULSE: Lazy, mpsc::Sender)>>> = - Lazy::new(|| Mutex::new(None)); +pub static FROM_PULSE: LazyLock, mpsc::Sender)>>> = + LazyLock::new(|| Mutex::new(None)); pub fn connect() -> iced::Subscription { struct SomeWorker; diff --git a/cosmic-applet-battery/Cargo.toml b/cosmic-applet-battery/Cargo.toml index bdb4e961..192d3a4c 100644 --- a/cosmic-applet-battery/Cargo.toml +++ b/cosmic-applet-battery/Cargo.toml @@ -13,7 +13,6 @@ futures.workspace = true i18n-embed-fl.workspace = true i18n-embed.workspace = true libcosmic.workspace = true -once_cell = "1.20.3" rust-embed.workspace = true tokio.workspace = true tracing-log.workspace = true diff --git a/cosmic-applet-battery/src/app.rs b/cosmic-applet-battery/src/app.rs index 758c4073..d17c6dfb 100644 --- a/cosmic-applet-battery/src/app.rs +++ b/cosmic-applet-battery/src/app.rs @@ -39,10 +39,9 @@ use cosmic_settings_subscriptions::{ }, }, }; -use cosmic_time::{anim, chain, id, once_cell::sync::Lazy, Instant, Timeline}; +use cosmic_time::{anim, chain, id, Instant, Timeline}; -use cosmic::widget::text_input; -use std::{collections::HashMap, path::PathBuf, time::Duration}; +use std::{collections::HashMap, path::PathBuf, sync::LazyLock, time::Duration}; use tokio::sync::mpsc::UnboundedSender; // XXX improve @@ -65,7 +64,7 @@ pub fn run() -> cosmic::iced::Result { cosmic::applet::run::(()) } -static MAX_CHARGE: Lazy = Lazy::new(id::Toggler::unique); +static MAX_CHARGE: LazyLock = LazyLock::new(id::Toggler::unique); #[derive(Clone, Default)] struct GPUData { diff --git a/cosmic-applet-battery/src/localize.rs b/cosmic-applet-battery/src/localize.rs index b69ee397..e825f851 100644 --- a/cosmic-applet-battery/src/localize.rs +++ b/cosmic-applet-battery/src/localize.rs @@ -5,14 +5,14 @@ use i18n_embed::{ fluent::{fluent_language_loader, FluentLanguageLoader}, DefaultLocalizer, LanguageLoader, Localizer, }; -use once_cell::sync::Lazy; use rust_embed::RustEmbed; +use std::sync::LazyLock; #[derive(RustEmbed)] #[folder = "i18n/"] struct Localizations; -pub static LANGUAGE_LOADER: Lazy = Lazy::new(|| { +pub static LANGUAGE_LOADER: LazyLock = LazyLock::new(|| { let loader: FluentLanguageLoader = fluent_language_loader!(); loader diff --git a/cosmic-applet-bluetooth/Cargo.toml b/cosmic-applet-bluetooth/Cargo.toml index 99ab1e20..e986155b 100644 --- a/cosmic-applet-bluetooth/Cargo.toml +++ b/cosmic-applet-bluetooth/Cargo.toml @@ -12,7 +12,6 @@ futures.workspace = true i18n-embed-fl.workspace = true i18n-embed.workspace = true libcosmic.workspace = true -once_cell = "1.20.3" rand = "0.9" rust-embed.workspace = true tokio.workspace = true diff --git a/cosmic-applet-bluetooth/src/app.rs b/cosmic-applet-bluetooth/src/app.rs index a3798edd..daa21199 100644 --- a/cosmic-applet-bluetooth/src/app.rs +++ b/cosmic-applet-bluetooth/src/app.rs @@ -23,9 +23,9 @@ use cosmic::{ widget::{button, divider, icon, text}, Element, Task, }; -use cosmic_time::{anim, chain, id, once_cell::sync::Lazy, Instant, Timeline}; +use cosmic_time::{anim, chain, id, Instant, Timeline}; use futures::FutureExt; -use std::{collections::HashMap, time::Duration}; +use std::{collections::HashMap, sync::LazyLock, time::Duration}; use tokio::sync::mpsc::Sender; use crate::{ @@ -33,7 +33,7 @@ use crate::{ config, fl, }; -static BLUETOOTH_ENABLED: Lazy = Lazy::new(id::Toggler::unique); +static BLUETOOTH_ENABLED: LazyLock = LazyLock::new(id::Toggler::unique); #[inline] pub fn run() -> cosmic::iced::Result { diff --git a/cosmic-applet-bluetooth/src/localize.rs b/cosmic-applet-bluetooth/src/localize.rs index 95cd5aac..4e565e4c 100644 --- a/cosmic-applet-bluetooth/src/localize.rs +++ b/cosmic-applet-bluetooth/src/localize.rs @@ -5,14 +5,14 @@ use i18n_embed::{ fluent::{fluent_language_loader, FluentLanguageLoader}, DefaultLocalizer, LanguageLoader, Localizer, }; -use once_cell::sync::Lazy; use rust_embed::RustEmbed; +use std::sync::LazyLock; #[derive(RustEmbed)] #[folder = "i18n/"] struct Localizations; -pub static LANGUAGE_LOADER: Lazy = Lazy::new(|| { +pub static LANGUAGE_LOADER: LazyLock = LazyLock::new(|| { let loader: FluentLanguageLoader = fluent_language_loader!(); loader diff --git a/cosmic-applet-input-sources/Cargo.toml b/cosmic-applet-input-sources/Cargo.toml index 6aefbaf9..3c58ad56 100644 --- a/cosmic-applet-input-sources/Cargo.toml +++ b/cosmic-applet-input-sources/Cargo.toml @@ -17,5 +17,4 @@ tracing-log.workspace = true tracing-subscriber.workspace = true tracing.workspace = true serde = { version = "1.0.217", features = ["derive"] } -once_cell = "1.20.3" xkb-data = "0.2" diff --git a/cosmic-applet-input-sources/src/localize.rs b/cosmic-applet-input-sources/src/localize.rs index 7fef8d61..2fcc1623 100644 --- a/cosmic-applet-input-sources/src/localize.rs +++ b/cosmic-applet-input-sources/src/localize.rs @@ -6,14 +6,14 @@ use i18n_embed::{ DefaultLocalizer, LanguageLoader, Localizer, }; -use once_cell::sync::Lazy; use rust_embed::RustEmbed; +use std::sync::LazyLock; #[derive(RustEmbed)] #[folder = "i18n/"] struct Localizations; -pub static LANGUAGE_LOADER: Lazy = Lazy::new(|| { +pub static LANGUAGE_LOADER: LazyLock = LazyLock::new(|| { let loader: FluentLanguageLoader = fluent_language_loader!(); loader .load_fallback_language(&Localizations) diff --git a/cosmic-applet-minimize/Cargo.toml b/cosmic-applet-minimize/Cargo.toml index b4fb42ee..7e545825 100644 --- a/cosmic-applet-minimize/Cargo.toml +++ b/cosmic-applet-minimize/Cargo.toml @@ -11,7 +11,6 @@ i18n-embed.workspace = true image = { version = "0.25.5", default-features = false } libcosmic.workspace = true memmap2 = "0.9.5" -once_cell = "1" rust-embed.workspace = true rustix.workspace = true tokio.workspace = true diff --git a/cosmic-applet-minimize/src/lib.rs b/cosmic-applet-minimize/src/lib.rs index a409aa78..420e53f3 100644 --- a/cosmic-applet-minimize/src/lib.rs +++ b/cosmic-applet-minimize/src/lib.rs @@ -33,12 +33,12 @@ use cosmic::{ use cosmic::iced_widget::{Column, Row}; use cosmic::{widget::tooltip, Element}; -use once_cell::sync::Lazy; +use std::sync::LazyLock; use wayland_subscription::{ ToplevelRequest, ToplevelUpdate, WaylandImage, WaylandRequest, WaylandUpdate, }; -static AUTOSIZE_MAIN_ID: Lazy = Lazy::new(|| WidgetId::new("autosize-main")); +static AUTOSIZE_MAIN_ID: LazyLock = LazyLock::new(|| WidgetId::new("autosize-main")); pub fn run() -> cosmic::iced::Result { localize(); diff --git a/cosmic-applet-minimize/src/localize.rs b/cosmic-applet-minimize/src/localize.rs index 27e874db..e0f83e8c 100644 --- a/cosmic-applet-minimize/src/localize.rs +++ b/cosmic-applet-minimize/src/localize.rs @@ -5,14 +5,14 @@ use i18n_embed::{ fluent::{fluent_language_loader, FluentLanguageLoader}, DefaultLocalizer, LanguageLoader, Localizer, }; -use once_cell::sync::Lazy; use rust_embed::RustEmbed; +use std::sync::LazyLock; #[derive(RustEmbed)] #[folder = "i18n/"] struct Localizations; -pub static LANGUAGE_LOADER: Lazy = Lazy::new(|| { +pub static LANGUAGE_LOADER: LazyLock = LazyLock::new(|| { let loader: FluentLanguageLoader = fluent_language_loader!(); loader diff --git a/cosmic-applet-network/src/app.rs b/cosmic-applet-network/src/app.rs index de6c9b2b..2ef08a97 100644 --- a/cosmic-applet-network/src/app.rs +++ b/cosmic-applet-network/src/app.rs @@ -1,4 +1,5 @@ use std::collections::HashSet; +use std::sync::LazyLock; use cosmic::{ app, @@ -26,7 +27,7 @@ use cosmic::{ use cosmic_dbus_networkmanager::interface::enums::{ ActiveConnectionState, DeviceState, NmConnectivityState, }; -use cosmic_time::{anim, chain, id, once_cell::sync::Lazy, Instant, Timeline}; +use cosmic_time::{anim, chain, id, Instant, Timeline}; use futures::channel::mpsc::UnboundedSender; use zbus::Connection; @@ -90,8 +91,8 @@ impl From for AccessPoint { } } -static WIFI: Lazy = Lazy::new(id::Toggler::unique); -static AIRPLANE_MODE: Lazy = Lazy::new(id::Toggler::unique); +static WIFI: LazyLock = LazyLock::new(id::Toggler::unique); +static AIRPLANE_MODE: LazyLock = LazyLock::new(id::Toggler::unique); #[derive(Default)] struct CosmicNetworkApplet { diff --git a/cosmic-applet-network/src/localize.rs b/cosmic-applet-network/src/localize.rs index 8f87ca3e..d894ed9d 100644 --- a/cosmic-applet-network/src/localize.rs +++ b/cosmic-applet-network/src/localize.rs @@ -1,17 +1,17 @@ // SPDX-License-Identifier: MPL-2.0-only -use cosmic_time::once_cell::sync::Lazy; use i18n_embed::{ fluent::{fluent_language_loader, FluentLanguageLoader}, DefaultLocalizer, LanguageLoader, Localizer, }; use rust_embed::RustEmbed; +use std::sync::LazyLock; #[derive(RustEmbed)] #[folder = "i18n/"] struct Localizations; -pub static LANGUAGE_LOADER: Lazy = Lazy::new(|| { +pub static LANGUAGE_LOADER: LazyLock = LazyLock::new(|| { let loader: FluentLanguageLoader = fluent_language_loader!(); loader diff --git a/cosmic-applet-notifications/src/lib.rs b/cosmic-applet-notifications/src/lib.rs index c9eddff7..c5cb278d 100644 --- a/cosmic-applet-notifications/src/lib.rs +++ b/cosmic-applet-notifications/src/lib.rs @@ -27,8 +27,8 @@ use cosmic::iced_futures::futures::executor::block_on; use cosmic_notifications_config::NotificationsConfig; use cosmic_notifications_util::{ActionId, Image, Notification}; -use cosmic_time::{anim, chain, id, once_cell::sync::Lazy, Instant, Timeline}; -use std::{borrow::Cow, collections::HashMap, path::PathBuf}; +use cosmic_time::{anim, chain, id, Instant, Timeline}; +use std::{borrow::Cow, collections::HashMap, path::PathBuf, sync::LazyLock}; use subscriptions::notifications::{self, NotificationsAppletProxy}; use tokio::sync::mpsc::Sender; use tracing::info; @@ -38,7 +38,7 @@ pub fn run() -> cosmic::iced::Result { cosmic::applet::run::(()) } -static DO_NOT_DISTURB: Lazy = Lazy::new(id::Toggler::unique); +static DO_NOT_DISTURB: LazyLock = LazyLock::new(id::Toggler::unique); struct Notifications { core: cosmic::app::Core, diff --git a/cosmic-applet-notifications/src/localize.rs b/cosmic-applet-notifications/src/localize.rs index fea2f3ec..e825f851 100644 --- a/cosmic-applet-notifications/src/localize.rs +++ b/cosmic-applet-notifications/src/localize.rs @@ -1,18 +1,18 @@ // Copyright 2023 System76 // SPDX-License-Identifier: GPL-3.0-only -use cosmic_time::once_cell::sync::Lazy; use i18n_embed::{ fluent::{fluent_language_loader, FluentLanguageLoader}, DefaultLocalizer, LanguageLoader, Localizer, }; use rust_embed::RustEmbed; +use std::sync::LazyLock; #[derive(RustEmbed)] #[folder = "i18n/"] struct Localizations; -pub static LANGUAGE_LOADER: Lazy = Lazy::new(|| { +pub static LANGUAGE_LOADER: LazyLock = LazyLock::new(|| { let loader: FluentLanguageLoader = fluent_language_loader!(); loader diff --git a/cosmic-applet-power/Cargo.toml b/cosmic-applet-power/Cargo.toml index 9fc77093..94f6eeca 100644 --- a/cosmic-applet-power/Cargo.toml +++ b/cosmic-applet-power/Cargo.toml @@ -9,7 +9,6 @@ i18n-embed-fl.workspace = true i18n-embed.workspace = true libcosmic.workspace = true logind-zbus = "5.3.2" -once_cell = "1.20.3" rust-embed.workspace = true rustix.workspace = true tokio.workspace = true diff --git a/cosmic-applet-power/src/lib.rs b/cosmic-applet-power/src/lib.rs index ab98d428..645dddd4 100644 --- a/cosmic-applet-power/src/lib.rs +++ b/cosmic-applet-power/src/lib.rs @@ -22,7 +22,7 @@ use cosmic::{ widget::{autosize, button, divider, icon, layer_container::layer_container, text, Space}, Element, Task, }; -use once_cell::sync::Lazy; +use std::sync::LazyLock; use logind_zbus::{ manager::ManagerProxy, @@ -39,8 +39,8 @@ pub mod session_manager; use crate::{cosmic_session::CosmicSessionProxy, session_manager::SessionManagerProxy}; -static SUBSURFACE_ID: Lazy = - Lazy::new(|| cosmic::widget::Id::new("subsurface")); +static SUBSURFACE_ID: LazyLock = + LazyLock::new(|| cosmic::widget::Id::new("subsurface")); pub fn run() -> cosmic::iced::Result { localize::localize(); diff --git a/cosmic-applet-power/src/localize.rs b/cosmic-applet-power/src/localize.rs index b69ee397..e825f851 100644 --- a/cosmic-applet-power/src/localize.rs +++ b/cosmic-applet-power/src/localize.rs @@ -5,14 +5,14 @@ use i18n_embed::{ fluent::{fluent_language_loader, FluentLanguageLoader}, DefaultLocalizer, LanguageLoader, Localizer, }; -use once_cell::sync::Lazy; use rust_embed::RustEmbed; +use std::sync::LazyLock; #[derive(RustEmbed)] #[folder = "i18n/"] struct Localizations; -pub static LANGUAGE_LOADER: Lazy = Lazy::new(|| { +pub static LANGUAGE_LOADER: LazyLock = LazyLock::new(|| { let loader: FluentLanguageLoader = fluent_language_loader!(); loader diff --git a/cosmic-applet-tiling/Cargo.toml b/cosmic-applet-tiling/Cargo.toml index f21778dc..7eb728b3 100644 --- a/cosmic-applet-tiling/Cargo.toml +++ b/cosmic-applet-tiling/Cargo.toml @@ -13,7 +13,6 @@ cosmic-protocols.workspace = true cosmic-time.workspace = true i18n-embed-fl.workspace = true i18n-embed.workspace = true -once_cell = "1" rust-embed.workspace = true tokio.workspace = true tracing-log.workspace = true diff --git a/cosmic-applet-tiling/src/localize.rs b/cosmic-applet-tiling/src/localize.rs index b69ee397..e825f851 100644 --- a/cosmic-applet-tiling/src/localize.rs +++ b/cosmic-applet-tiling/src/localize.rs @@ -5,14 +5,14 @@ use i18n_embed::{ fluent::{fluent_language_loader, FluentLanguageLoader}, DefaultLocalizer, LanguageLoader, Localizer, }; -use once_cell::sync::Lazy; use rust_embed::RustEmbed; +use std::sync::LazyLock; #[derive(RustEmbed)] #[folder = "i18n/"] struct Localizations; -pub static LANGUAGE_LOADER: Lazy = Lazy::new(|| { +pub static LANGUAGE_LOADER: LazyLock = LazyLock::new(|| { let loader: FluentLanguageLoader = fluent_language_loader!(); loader diff --git a/cosmic-applet-tiling/src/wayland_subscription.rs b/cosmic-applet-tiling/src/wayland_subscription.rs index dbc4edb2..023b37e6 100644 --- a/cosmic-applet-tiling/src/wayland_subscription.rs +++ b/cosmic-applet-tiling/src/wayland_subscription.rs @@ -9,11 +9,11 @@ use cosmic::iced::{ stream, Subscription, }; use cosmic_protocols::workspace::v2::client::zcosmic_workspace_handle_v2::TilingState; -use once_cell::sync::Lazy; +use std::sync::LazyLock; use tokio::sync::Mutex; -pub static WAYLAND_RX: Lazy>>> = - Lazy::new(|| Mutex::new(None)); +pub static WAYLAND_RX: LazyLock>>> = + LazyLock::new(|| Mutex::new(None)); #[derive(Debug, Clone)] pub enum WorkspacesUpdate { diff --git a/cosmic-applet-time/Cargo.toml b/cosmic-applet-time/Cargo.toml index fbeec768..ffd27b8e 100644 --- a/cosmic-applet-time/Cargo.toml +++ b/cosmic-applet-time/Cargo.toml @@ -12,7 +12,6 @@ chrono-tz = "0.10" i18n-embed-fl.workspace = true i18n-embed.workspace = true libcosmic.workspace = true -once_cell.workspace = true rust-embed.workspace = true tokio.workspace = true tracing-log.workspace = true diff --git a/cosmic-applet-time/src/localize.rs b/cosmic-applet-time/src/localize.rs index b69ee397..e825f851 100644 --- a/cosmic-applet-time/src/localize.rs +++ b/cosmic-applet-time/src/localize.rs @@ -5,14 +5,14 @@ use i18n_embed::{ fluent::{fluent_language_loader, FluentLanguageLoader}, DefaultLocalizer, LanguageLoader, Localizer, }; -use once_cell::sync::Lazy; use rust_embed::RustEmbed; +use std::sync::LazyLock; #[derive(RustEmbed)] #[folder = "i18n/"] struct Localizations; -pub static LANGUAGE_LOADER: Lazy = Lazy::new(|| { +pub static LANGUAGE_LOADER: LazyLock = LazyLock::new(|| { let loader: FluentLanguageLoader = fluent_language_loader!(); loader diff --git a/cosmic-applet-time/src/window.rs b/cosmic-applet-time/src/window.rs index 7fe294b0..5a4e56fa 100644 --- a/cosmic-applet-time/src/window.rs +++ b/cosmic-applet-time/src/window.rs @@ -26,7 +26,7 @@ use cosmic::{ Element, Task, }; use logind_zbus::manager::ManagerProxy; -use once_cell::sync::Lazy; +use std::sync::LazyLock; use timedate_zbus::TimeDateProxy; use tokio::{sync::watch, time}; @@ -47,7 +47,7 @@ use cosmic::applet::token::subscription::{ activation_token_subscription, TokenRequest, TokenUpdate, }; -static AUTOSIZE_MAIN_ID: Lazy = Lazy::new(|| Id::new("autosize-main")); +static AUTOSIZE_MAIN_ID: LazyLock = LazyLock::new(|| Id::new("autosize-main")); /// In order to keep the understandable, the chrono types are not globals, /// to avoid conflict with icu diff --git a/cosmic-applet-workspaces/Cargo.toml b/cosmic-applet-workspaces/Cargo.toml index 40e1d71a..253789a1 100644 --- a/cosmic-applet-workspaces/Cargo.toml +++ b/cosmic-applet-workspaces/Cargo.toml @@ -12,7 +12,6 @@ cosmic-protocols.workspace = true tracing.workspace = true tracing-subscriber.workspace = true tracing-log.workspace = true -once_cell = "1.20" futures.workspace = true anyhow.workspace = true tokio.workspace = true diff --git a/cosmic-applet-workspaces/src/components/app.rs b/cosmic-applet-workspaces/src/components/app.rs index dcf15f1b..4b99dd0b 100644 --- a/cosmic-applet-workspaces/src/components/app.rs +++ b/cosmic-applet-workspaces/src/components/app.rs @@ -27,8 +27,6 @@ use cosmic::{ Element, Task, Theme, }; -use once_cell::sync::Lazy; - use crate::{ config, wayland::WorkspaceEvent, @@ -37,10 +35,11 @@ use crate::{ use std::{ process::Command as ShellCommand, + sync::LazyLock, time::{Duration, Instant}, }; -static AUTOSIZE_MAIN_ID: Lazy = Lazy::new(|| Id::new("autosize-main")); +static AUTOSIZE_MAIN_ID: LazyLock = LazyLock::new(|| Id::new("autosize-main")); pub fn run() -> cosmic::iced::Result { cosmic::applet::run::(()) diff --git a/cosmic-applet-workspaces/src/localize.rs b/cosmic-applet-workspaces/src/localize.rs index b69ee397..e825f851 100644 --- a/cosmic-applet-workspaces/src/localize.rs +++ b/cosmic-applet-workspaces/src/localize.rs @@ -5,14 +5,14 @@ use i18n_embed::{ fluent::{fluent_language_loader, FluentLanguageLoader}, DefaultLocalizer, LanguageLoader, Localizer, }; -use once_cell::sync::Lazy; use rust_embed::RustEmbed; +use std::sync::LazyLock; #[derive(RustEmbed)] #[folder = "i18n/"] struct Localizations; -pub static LANGUAGE_LOADER: Lazy = Lazy::new(|| { +pub static LANGUAGE_LOADER: LazyLock = LazyLock::new(|| { let loader: FluentLanguageLoader = fluent_language_loader!(); loader diff --git a/cosmic-applet-workspaces/src/wayland_subscription.rs b/cosmic-applet-workspaces/src/wayland_subscription.rs index 8cb05bcf..c4ddd87b 100644 --- a/cosmic-applet-workspaces/src/wayland_subscription.rs +++ b/cosmic-applet-workspaces/src/wayland_subscription.rs @@ -8,11 +8,11 @@ use cosmic::iced::{ futures::{channel::mpsc, SinkExt, StreamExt}, stream, Subscription, }; -use once_cell::sync::Lazy; +use std::sync::LazyLock; use tokio::sync::Mutex; -pub static WAYLAND_RX: Lazy>>>> = - Lazy::new(|| Mutex::new(None)); +pub static WAYLAND_RX: LazyLock>>>> = + LazyLock::new(|| Mutex::new(None)); #[derive(Debug, Clone)] pub enum WorkspacesUpdate { diff --git a/cosmic-panel-button/Cargo.toml b/cosmic-panel-button/Cargo.toml index be3374b3..6352e617 100644 --- a/cosmic-panel-button/Cargo.toml +++ b/cosmic-panel-button/Cargo.toml @@ -10,5 +10,4 @@ tracing.workspace = true tracing-subscriber.workspace = true tracing-log.workspace = true cosmic-config.workspace = true -once_cell.workspace = true serde.workspace = true diff --git a/cosmic-panel-button/src/lib.rs b/cosmic-panel-button/src/lib.rs index 26f95b3e..f084eeba 100644 --- a/cosmic-panel-button/src/lib.rs +++ b/cosmic-panel-button/src/lib.rs @@ -16,12 +16,11 @@ use cosmic::{ Task, }; use cosmic_config::{Config, CosmicConfigEntry}; -use once_cell::sync::Lazy; -use std::{env, fs, process::Command}; +use std::{env, fs, process::Command, sync::LazyLock}; mod config; -static AUTOSIZE_MAIN_ID: Lazy = Lazy::new(|| Id::new("autosize-main")); +static AUTOSIZE_MAIN_ID: LazyLock = LazyLock::new(|| Id::new("autosize-main")); #[derive(Debug, Clone, Default)] struct Desktop {