chore: use std::sync::LazyLock

Removes `once_cell` as a direct dependency.
This commit is contained in:
Vukašin Vojinović 2025-08-12 19:59:56 +02:00 committed by Michael Murphy
parent 467716c167
commit c3fafd3910
42 changed files with 77 additions and 106 deletions

12
Cargo.lock generated
View file

@ -1042,7 +1042,6 @@ dependencies = [
"itertools", "itertools",
"libcosmic", "libcosmic",
"memmap2 0.9.5", "memmap2 0.9.5",
"once_cell",
"rand 0.9.1", "rand 0.9.1",
"rust-embed", "rust-embed",
"rustix 1.0.7", "rustix 1.0.7",
@ -1076,7 +1075,6 @@ dependencies = [
"i18n-embed", "i18n-embed",
"i18n-embed-fl", "i18n-embed-fl",
"libcosmic", "libcosmic",
"once_cell",
"rust-embed", "rust-embed",
"tokio", "tokio",
"tracing", "tracing",
@ -1119,7 +1117,6 @@ dependencies = [
"i18n-embed", "i18n-embed",
"i18n-embed-fl", "i18n-embed-fl",
"libcosmic", "libcosmic",
"once_cell",
"rust-embed", "rust-embed",
"tokio", "tokio",
"tracing", "tracing",
@ -1140,7 +1137,6 @@ dependencies = [
"i18n-embed", "i18n-embed",
"i18n-embed-fl", "i18n-embed-fl",
"libcosmic", "libcosmic",
"once_cell",
"rand 0.9.1", "rand 0.9.1",
"rust-embed", "rust-embed",
"tokio", "tokio",
@ -1158,7 +1154,6 @@ dependencies = [
"i18n-embed-fl", "i18n-embed-fl",
"libcosmic", "libcosmic",
"libpulse-binding", "libpulse-binding",
"once_cell",
"rust-embed", "rust-embed",
"serde", "serde",
"tokio", "tokio",
@ -1178,7 +1173,6 @@ dependencies = [
"image", "image",
"libcosmic", "libcosmic",
"memmap2 0.9.5", "memmap2 0.9.5",
"once_cell",
"rust-embed", "rust-embed",
"rustix 1.0.7", "rustix 1.0.7",
"tokio", "tokio",
@ -1241,7 +1235,6 @@ dependencies = [
"i18n-embed-fl", "i18n-embed-fl",
"libcosmic", "libcosmic",
"logind-zbus", "logind-zbus",
"once_cell",
"rust-embed", "rust-embed",
"rustix 1.0.7", "rustix 1.0.7",
"tokio", "tokio",
@ -1277,7 +1270,6 @@ dependencies = [
"i18n-embed", "i18n-embed",
"i18n-embed-fl", "i18n-embed-fl",
"libcosmic", "libcosmic",
"once_cell",
"rust-embed", "rust-embed",
"tokio", "tokio",
"tracing", "tracing",
@ -1299,7 +1291,6 @@ dependencies = [
"icu", "icu",
"libcosmic", "libcosmic",
"logind-zbus", "logind-zbus",
"once_cell",
"rust-embed", "rust-embed",
"serde", "serde",
"timedate-zbus", "timedate-zbus",
@ -1321,7 +1312,6 @@ dependencies = [
"i18n-embed", "i18n-embed",
"i18n-embed-fl", "i18n-embed-fl",
"libcosmic", "libcosmic",
"once_cell",
"rust-embed", "rust-embed",
"tokio", "tokio",
"tracing", "tracing",
@ -1478,7 +1468,6 @@ version = "0.1.0"
dependencies = [ dependencies = [
"cosmic-config", "cosmic-config",
"libcosmic", "libcosmic",
"once_cell",
"serde", "serde",
"tracing", "tracing",
"tracing-log", "tracing-log",
@ -1609,7 +1598,6 @@ source = "git+https://github.com/pop-os/cosmic-time#bbb9fb829b25e0bc2bbb382c2554
dependencies = [ dependencies = [
"float-cmp", "float-cmp",
"libcosmic", "libcosmic",
"once_cell",
] ]
[[package]] [[package]]

View file

@ -32,12 +32,8 @@ cosmic-protocols = { git = "https://github.com/pop-os/cosmic-protocols", default
], rev = "1425bd4" } ], rev = "1425bd4" }
cosmic-settings-subscriptions = { git = "https://github.com/pop-os/cosmic-settings-subscriptions" } 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 = [ cosmic-time = { git = "https://github.com/pop-os/cosmic-time", default-features = false }
"once_cell", # cosmic-time = { path = "../cosmic-time", default-features = false ] }
] }
# cosmic-time = { path = "../cosmic-time", default-features = false, features = [
# "once_cell",
# ] }
futures = "0.3" futures = "0.3"
futures-util = "0.3" futures-util = "0.3"
@ -56,7 +52,6 @@ libcosmic = { git = "https://github.com/pop-os/libcosmic", default-features = fa
"desktop-systemd-scope", "desktop-systemd-scope",
"winit", "winit",
] } ] }
once_cell = "1"
rust-embed = "8.5" rust-embed = "8.5"
rust-embed-utils = "8.5.0" rust-embed-utils = "8.5.0"
rustix = { version = "1.0", features = ["fs", "process"] } rustix = { version = "1.0", features = ["fs", "process"] }

View file

@ -16,7 +16,6 @@ image = { version = "0.25.5", default-features = false }
itertools = "0.14.0" itertools = "0.14.0"
libcosmic.workspace = true libcosmic.workspace = true
memmap2 = "0.9.5" memmap2 = "0.9.5"
once_cell = "1.20"
rand = "0.9.0" rand = "0.9.0"
rust-embed.workspace = true rust-embed.workspace = true
rustix.workspace = true rustix.workspace = true

View file

@ -5,14 +5,14 @@ use i18n_embed::{
fluent::{fluent_language_loader, FluentLanguageLoader}, fluent::{fluent_language_loader, FluentLanguageLoader},
DefaultLocalizer, LanguageLoader, Localizer, DefaultLocalizer, LanguageLoader, Localizer,
}; };
use once_cell::sync::Lazy;
use rust_embed::RustEmbed; use rust_embed::RustEmbed;
use std::sync::LazyLock;
#[derive(RustEmbed)] #[derive(RustEmbed)]
#[folder = "i18n/"] #[folder = "i18n/"]
struct Localizations; struct Localizations;
pub static LANGUAGE_LOADER: Lazy<FluentLanguageLoader> = Lazy::new(|| { pub static LANGUAGE_LOADER: LazyLock<FluentLanguageLoader> = LazyLock::new(|| {
let loader: FluentLanguageLoader = fluent_language_loader!(); let loader: FluentLanguageLoader = fluent_language_loader!();
loader loader

View file

@ -21,14 +21,14 @@ use futures::{
channel::mpsc::{unbounded, UnboundedReceiver}, channel::mpsc::{unbounded, UnboundedReceiver},
SinkExt, StreamExt, SinkExt, StreamExt,
}; };
use once_cell::sync::Lazy;
use std::fmt::Debug; use std::fmt::Debug;
use std::sync::LazyLock;
use tokio::sync::Mutex; use tokio::sync::Mutex;
use crate::wayland_handler::wayland_handler; use crate::wayland_handler::wayland_handler;
pub static WAYLAND_RX: Lazy<Mutex<Option<UnboundedReceiver<WaylandUpdate>>>> = pub static WAYLAND_RX: LazyLock<Mutex<Option<UnboundedReceiver<WaylandUpdate>>>> =
Lazy::new(|| Mutex::new(None)); LazyLock::new(|| Mutex::new(None));
pub fn wayland_subscription() -> iced::Subscription<WaylandUpdate> { pub fn wayland_subscription() -> iced::Subscription<WaylandUpdate> {
Subscription::run_with_id( Subscription::run_with_id(

View file

@ -17,7 +17,6 @@ i18n-embed-fl.workspace = true
i18n-embed.workspace = true i18n-embed.workspace = true
libcosmic.workspace = true libcosmic.workspace = true
rust-embed.workspace = true rust-embed.workspace = true
once_cell = "1"
tokio.workspace = true tokio.workspace = true
tracing-log.workspace = true tracing-log.workspace = true
tracing-subscriber.workspace = true tracing-subscriber.workspace = true

View file

@ -28,14 +28,15 @@ use cosmic_settings_subscriptions::{
accessibility::{self, DBusRequest, DBusUpdate}, accessibility::{self, DBusRequest, DBusUpdate},
cosmic_a11y_manager::{AccessibilityEvent, AccessibilityRequest, ColorFilter}, 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; use tokio::sync::mpsc::UnboundedSender;
static READER_TOGGLE: Lazy<id::Toggler> = Lazy::new(id::Toggler::unique); static READER_TOGGLE: LazyLock<id::Toggler> = LazyLock::new(id::Toggler::unique);
static FILTER_TOGGLE: Lazy<id::Toggler> = Lazy::new(id::Toggler::unique); static FILTER_TOGGLE: LazyLock<id::Toggler> = LazyLock::new(id::Toggler::unique);
static HC_TOGGLE: Lazy<id::Toggler> = Lazy::new(id::Toggler::unique); static HC_TOGGLE: LazyLock<id::Toggler> = LazyLock::new(id::Toggler::unique);
static MAGNIFIER_TOGGLE: Lazy<id::Toggler> = Lazy::new(id::Toggler::unique); static MAGNIFIER_TOGGLE: LazyLock<id::Toggler> = LazyLock::new(id::Toggler::unique);
static INVERT_COLORS_TOGGLE: Lazy<id::Toggler> = Lazy::new(id::Toggler::unique); static INVERT_COLORS_TOGGLE: LazyLock<id::Toggler> = LazyLock::new(id::Toggler::unique);
pub fn run() -> cosmic::iced::Result { pub fn run() -> cosmic::iced::Result {
cosmic::applet::run::<CosmicA11yApplet>(()) cosmic::applet::run::<CosmicA11yApplet>(())

View file

@ -12,11 +12,11 @@ use cosmic_protocols::a11y::v1::client::cosmic_a11y_manager_v1::Filter;
use cosmic_settings_subscriptions::cosmic_a11y_manager::{ use cosmic_settings_subscriptions::cosmic_a11y_manager::{
self as thread, AccessibilityEvent, AccessibilityRequest, self as thread, AccessibilityEvent, AccessibilityRequest,
}; };
use once_cell::sync::Lazy; use std::sync::LazyLock;
use tokio::sync::Mutex; use tokio::sync::Mutex;
pub static WAYLAND_RX: Lazy<Mutex<Option<tokio::sync::mpsc::Receiver<AccessibilityEvent>>>> = pub static WAYLAND_RX: LazyLock<Mutex<Option<tokio::sync::mpsc::Receiver<AccessibilityEvent>>>> =
Lazy::new(|| Mutex::new(None)); LazyLock::new(|| Mutex::new(None));
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub enum WaylandUpdate { pub enum WaylandUpdate {

View file

@ -5,14 +5,14 @@ use i18n_embed::{
fluent::{fluent_language_loader, FluentLanguageLoader}, fluent::{fluent_language_loader, FluentLanguageLoader},
DefaultLocalizer, LanguageLoader, Localizer, DefaultLocalizer, LanguageLoader, Localizer,
}; };
use once_cell::sync::Lazy;
use rust_embed::RustEmbed; use rust_embed::RustEmbed;
use std::sync::LazyLock;
#[derive(RustEmbed)] #[derive(RustEmbed)]
#[folder = "i18n/"] #[folder = "i18n/"]
struct Localizations; struct Localizations;
pub static LANGUAGE_LOADER: Lazy<FluentLanguageLoader> = Lazy::new(|| { pub static LANGUAGE_LOADER: LazyLock<FluentLanguageLoader> = LazyLock::new(|| {
let loader: FluentLanguageLoader = fluent_language_loader!(); let loader: FluentLanguageLoader = fluent_language_loader!();
loader loader

View file

@ -4,6 +4,7 @@
mod localize; mod localize;
mod mouse_area; mod mouse_area;
use std::sync::LazyLock;
use std::time::Duration; use std::time::Duration;
use crate::{localize::localize, pulse::DeviceInfo}; use crate::{localize::localize, pulse::DeviceInfo};
@ -28,7 +29,7 @@ use cosmic::{
Element, Renderer, Task, Theme, Element, Renderer, Task, Theme,
}; };
use cosmic_settings_subscriptions::pulse as sub_pulse; 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::{ use iced::{
platform_specific::shell::wayland::commands::popup::{destroy_popup, get_popup}, platform_specific::shell::wayland::commands::popup::{destroy_popup, get_popup},
widget::container, widget::container,
@ -47,7 +48,7 @@ static FULL_VOLUME: f64 = Volume::NORMAL.0 as f64;
// Max volume is 150% volume. // Max volume is 150% volume.
static MAX_VOLUME: f64 = FULL_VOLUME + (FULL_VOLUME * 0.5); static MAX_VOLUME: f64 = FULL_VOLUME + (FULL_VOLUME * 0.5);
static SHOW_MEDIA_CONTROLS: Lazy<id::Toggler> = Lazy::new(id::Toggler::unique); static SHOW_MEDIA_CONTROLS: LazyLock<id::Toggler> = LazyLock::new(id::Toggler::unique);
const GO_BACK: &str = "media-skip-backward-symbolic"; const GO_BACK: &str = "media-skip-backward-symbolic";
const GO_NEXT: &str = "media-skip-forward-symbolic"; const GO_NEXT: &str = "media-skip-forward-symbolic";

View file

@ -1,18 +1,18 @@
// 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
use cosmic_time::once_cell::sync::Lazy;
use i18n_embed::{ use i18n_embed::{
fluent::{fluent_language_loader, FluentLanguageLoader}, fluent::{fluent_language_loader, FluentLanguageLoader},
DefaultLocalizer, LanguageLoader, Localizer, DefaultLocalizer, LanguageLoader, Localizer,
}; };
use rust_embed::RustEmbed; use rust_embed::RustEmbed;
use std::sync::LazyLock;
#[derive(RustEmbed)] #[derive(RustEmbed)]
#[folder = "i18n/"] #[folder = "i18n/"]
struct Localizations; struct Localizations;
pub static LANGUAGE_LOADER: Lazy<FluentLanguageLoader> = Lazy::new(|| { pub static LANGUAGE_LOADER: LazyLock<FluentLanguageLoader> = LazyLock::new(|| {
let loader: FluentLanguageLoader = fluent_language_loader!(); let loader: FluentLanguageLoader = fluent_language_loader!();
loader loader

View file

@ -1,7 +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
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; extern crate libpulse_binding as pulse;
@ -9,7 +9,6 @@ use cosmic::{
iced::{self, stream, Subscription}, iced::{self, stream, Subscription},
iced_futures::futures::{self, SinkExt}, iced_futures::futures::{self, SinkExt},
}; };
use cosmic_time::once_cell::sync::Lazy;
use libpulse_binding::{ use libpulse_binding::{
callbacks::ListResult, callbacks::ListResult,
@ -25,8 +24,8 @@ use libpulse_binding::{
use tokio::sync::{mpsc, Mutex}; use tokio::sync::{mpsc, Mutex};
pub static FROM_PULSE: Lazy<Mutex<Option<(mpsc::Receiver<Message>, mpsc::Sender<Message>)>>> = pub static FROM_PULSE: LazyLock<Mutex<Option<(mpsc::Receiver<Message>, mpsc::Sender<Message>)>>> =
Lazy::new(|| Mutex::new(None)); LazyLock::new(|| Mutex::new(None));
pub fn connect() -> iced::Subscription<Event> { pub fn connect() -> iced::Subscription<Event> {
struct SomeWorker; struct SomeWorker;

View file

@ -13,7 +13,6 @@ futures.workspace = true
i18n-embed-fl.workspace = true i18n-embed-fl.workspace = true
i18n-embed.workspace = true i18n-embed.workspace = true
libcosmic.workspace = true libcosmic.workspace = true
once_cell = "1.20.3"
rust-embed.workspace = true rust-embed.workspace = true
tokio.workspace = true tokio.workspace = true
tracing-log.workspace = true tracing-log.workspace = true

View file

@ -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, sync::LazyLock, time::Duration};
use std::{collections::HashMap, path::PathBuf, time::Duration};
use tokio::sync::mpsc::UnboundedSender; use tokio::sync::mpsc::UnboundedSender;
// XXX improve // XXX improve
@ -65,7 +64,7 @@ pub fn run() -> cosmic::iced::Result {
cosmic::applet::run::<CosmicBatteryApplet>(()) cosmic::applet::run::<CosmicBatteryApplet>(())
} }
static MAX_CHARGE: Lazy<id::Toggler> = Lazy::new(id::Toggler::unique); static MAX_CHARGE: LazyLock<id::Toggler> = LazyLock::new(id::Toggler::unique);
#[derive(Clone, Default)] #[derive(Clone, Default)]
struct GPUData { struct GPUData {

View file

@ -5,14 +5,14 @@ use i18n_embed::{
fluent::{fluent_language_loader, FluentLanguageLoader}, fluent::{fluent_language_loader, FluentLanguageLoader},
DefaultLocalizer, LanguageLoader, Localizer, DefaultLocalizer, LanguageLoader, Localizer,
}; };
use once_cell::sync::Lazy;
use rust_embed::RustEmbed; use rust_embed::RustEmbed;
use std::sync::LazyLock;
#[derive(RustEmbed)] #[derive(RustEmbed)]
#[folder = "i18n/"] #[folder = "i18n/"]
struct Localizations; struct Localizations;
pub static LANGUAGE_LOADER: Lazy<FluentLanguageLoader> = Lazy::new(|| { pub static LANGUAGE_LOADER: LazyLock<FluentLanguageLoader> = LazyLock::new(|| {
let loader: FluentLanguageLoader = fluent_language_loader!(); let loader: FluentLanguageLoader = fluent_language_loader!();
loader loader

View file

@ -12,7 +12,6 @@ futures.workspace = true
i18n-embed-fl.workspace = true i18n-embed-fl.workspace = true
i18n-embed.workspace = true i18n-embed.workspace = true
libcosmic.workspace = true libcosmic.workspace = true
once_cell = "1.20.3"
rand = "0.9" rand = "0.9"
rust-embed.workspace = true rust-embed.workspace = true
tokio.workspace = true tokio.workspace = true

View file

@ -23,9 +23,9 @@ use cosmic::{
widget::{button, divider, icon, text}, widget::{button, divider, icon, text},
Element, Task, 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 futures::FutureExt;
use std::{collections::HashMap, time::Duration}; use std::{collections::HashMap, sync::LazyLock, time::Duration};
use tokio::sync::mpsc::Sender; use tokio::sync::mpsc::Sender;
use crate::{ use crate::{
@ -33,7 +33,7 @@ use crate::{
config, fl, config, fl,
}; };
static BLUETOOTH_ENABLED: Lazy<id::Toggler> = Lazy::new(id::Toggler::unique); static BLUETOOTH_ENABLED: LazyLock<id::Toggler> = LazyLock::new(id::Toggler::unique);
#[inline] #[inline]
pub fn run() -> cosmic::iced::Result { pub fn run() -> cosmic::iced::Result {

View file

@ -5,14 +5,14 @@ use i18n_embed::{
fluent::{fluent_language_loader, FluentLanguageLoader}, fluent::{fluent_language_loader, FluentLanguageLoader},
DefaultLocalizer, LanguageLoader, Localizer, DefaultLocalizer, LanguageLoader, Localizer,
}; };
use once_cell::sync::Lazy;
use rust_embed::RustEmbed; use rust_embed::RustEmbed;
use std::sync::LazyLock;
#[derive(RustEmbed)] #[derive(RustEmbed)]
#[folder = "i18n/"] #[folder = "i18n/"]
struct Localizations; struct Localizations;
pub static LANGUAGE_LOADER: Lazy<FluentLanguageLoader> = Lazy::new(|| { pub static LANGUAGE_LOADER: LazyLock<FluentLanguageLoader> = LazyLock::new(|| {
let loader: FluentLanguageLoader = fluent_language_loader!(); let loader: FluentLanguageLoader = fluent_language_loader!();
loader loader

View file

@ -17,5 +17,4 @@ tracing-log.workspace = true
tracing-subscriber.workspace = true tracing-subscriber.workspace = true
tracing.workspace = true tracing.workspace = true
serde = { version = "1.0.217", features = ["derive"] } serde = { version = "1.0.217", features = ["derive"] }
once_cell = "1.20.3"
xkb-data = "0.2" xkb-data = "0.2"

View file

@ -6,14 +6,14 @@ use i18n_embed::{
DefaultLocalizer, LanguageLoader, Localizer, DefaultLocalizer, LanguageLoader, Localizer,
}; };
use once_cell::sync::Lazy;
use rust_embed::RustEmbed; use rust_embed::RustEmbed;
use std::sync::LazyLock;
#[derive(RustEmbed)] #[derive(RustEmbed)]
#[folder = "i18n/"] #[folder = "i18n/"]
struct Localizations; struct Localizations;
pub static LANGUAGE_LOADER: Lazy<FluentLanguageLoader> = Lazy::new(|| { pub static LANGUAGE_LOADER: LazyLock<FluentLanguageLoader> = LazyLock::new(|| {
let loader: FluentLanguageLoader = fluent_language_loader!(); let loader: FluentLanguageLoader = fluent_language_loader!();
loader loader
.load_fallback_language(&Localizations) .load_fallback_language(&Localizations)

View file

@ -11,7 +11,6 @@ i18n-embed.workspace = true
image = { version = "0.25.5", default-features = false } image = { version = "0.25.5", default-features = false }
libcosmic.workspace = true libcosmic.workspace = true
memmap2 = "0.9.5" memmap2 = "0.9.5"
once_cell = "1"
rust-embed.workspace = true rust-embed.workspace = true
rustix.workspace = true rustix.workspace = true
tokio.workspace = true tokio.workspace = true

View file

@ -33,12 +33,12 @@ use cosmic::{
use cosmic::iced_widget::{Column, Row}; use cosmic::iced_widget::{Column, Row};
use cosmic::{widget::tooltip, Element}; use cosmic::{widget::tooltip, Element};
use once_cell::sync::Lazy; use std::sync::LazyLock;
use wayland_subscription::{ use wayland_subscription::{
ToplevelRequest, ToplevelUpdate, WaylandImage, WaylandRequest, WaylandUpdate, ToplevelRequest, ToplevelUpdate, WaylandImage, WaylandRequest, WaylandUpdate,
}; };
static AUTOSIZE_MAIN_ID: Lazy<WidgetId> = Lazy::new(|| WidgetId::new("autosize-main")); static AUTOSIZE_MAIN_ID: LazyLock<WidgetId> = LazyLock::new(|| WidgetId::new("autosize-main"));
pub fn run() -> cosmic::iced::Result { pub fn run() -> cosmic::iced::Result {
localize(); localize();

View file

@ -5,14 +5,14 @@ use i18n_embed::{
fluent::{fluent_language_loader, FluentLanguageLoader}, fluent::{fluent_language_loader, FluentLanguageLoader},
DefaultLocalizer, LanguageLoader, Localizer, DefaultLocalizer, LanguageLoader, Localizer,
}; };
use once_cell::sync::Lazy;
use rust_embed::RustEmbed; use rust_embed::RustEmbed;
use std::sync::LazyLock;
#[derive(RustEmbed)] #[derive(RustEmbed)]
#[folder = "i18n/"] #[folder = "i18n/"]
struct Localizations; struct Localizations;
pub static LANGUAGE_LOADER: Lazy<FluentLanguageLoader> = Lazy::new(|| { pub static LANGUAGE_LOADER: LazyLock<FluentLanguageLoader> = LazyLock::new(|| {
let loader: FluentLanguageLoader = fluent_language_loader!(); let loader: FluentLanguageLoader = fluent_language_loader!();
loader loader

View file

@ -1,4 +1,5 @@
use std::collections::HashSet; use std::collections::HashSet;
use std::sync::LazyLock;
use cosmic::{ use cosmic::{
app, app,
@ -26,7 +27,7 @@ use cosmic::{
use cosmic_dbus_networkmanager::interface::enums::{ use cosmic_dbus_networkmanager::interface::enums::{
ActiveConnectionState, DeviceState, NmConnectivityState, 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 futures::channel::mpsc::UnboundedSender;
use zbus::Connection; use zbus::Connection;
@ -90,8 +91,8 @@ impl From<NewConnectionState> for AccessPoint {
} }
} }
static WIFI: Lazy<id::Toggler> = Lazy::new(id::Toggler::unique); static WIFI: LazyLock<id::Toggler> = LazyLock::new(id::Toggler::unique);
static AIRPLANE_MODE: Lazy<id::Toggler> = Lazy::new(id::Toggler::unique); static AIRPLANE_MODE: LazyLock<id::Toggler> = LazyLock::new(id::Toggler::unique);
#[derive(Default)] #[derive(Default)]
struct CosmicNetworkApplet { struct CosmicNetworkApplet {

View file

@ -1,17 +1,17 @@
// SPDX-License-Identifier: MPL-2.0-only // SPDX-License-Identifier: MPL-2.0-only
use cosmic_time::once_cell::sync::Lazy;
use i18n_embed::{ use i18n_embed::{
fluent::{fluent_language_loader, FluentLanguageLoader}, fluent::{fluent_language_loader, FluentLanguageLoader},
DefaultLocalizer, LanguageLoader, Localizer, DefaultLocalizer, LanguageLoader, Localizer,
}; };
use rust_embed::RustEmbed; use rust_embed::RustEmbed;
use std::sync::LazyLock;
#[derive(RustEmbed)] #[derive(RustEmbed)]
#[folder = "i18n/"] #[folder = "i18n/"]
struct Localizations; struct Localizations;
pub static LANGUAGE_LOADER: Lazy<FluentLanguageLoader> = Lazy::new(|| { pub static LANGUAGE_LOADER: LazyLock<FluentLanguageLoader> = LazyLock::new(|| {
let loader: FluentLanguageLoader = fluent_language_loader!(); let loader: FluentLanguageLoader = fluent_language_loader!();
loader loader

View file

@ -27,8 +27,8 @@ use cosmic::iced_futures::futures::executor::block_on;
use cosmic_notifications_config::NotificationsConfig; use cosmic_notifications_config::NotificationsConfig;
use cosmic_notifications_util::{ActionId, Image, Notification}; use cosmic_notifications_util::{ActionId, Image, Notification};
use cosmic_time::{anim, chain, id, once_cell::sync::Lazy, Instant, Timeline}; use cosmic_time::{anim, chain, id, Instant, Timeline};
use std::{borrow::Cow, collections::HashMap, path::PathBuf}; use std::{borrow::Cow, collections::HashMap, path::PathBuf, sync::LazyLock};
use subscriptions::notifications::{self, NotificationsAppletProxy}; use subscriptions::notifications::{self, NotificationsAppletProxy};
use tokio::sync::mpsc::Sender; use tokio::sync::mpsc::Sender;
use tracing::info; use tracing::info;
@ -38,7 +38,7 @@ pub fn run() -> cosmic::iced::Result {
cosmic::applet::run::<Notifications>(()) cosmic::applet::run::<Notifications>(())
} }
static DO_NOT_DISTURB: Lazy<id::Toggler> = Lazy::new(id::Toggler::unique); static DO_NOT_DISTURB: LazyLock<id::Toggler> = LazyLock::new(id::Toggler::unique);
struct Notifications { struct Notifications {
core: cosmic::app::Core, core: cosmic::app::Core,

View file

@ -1,18 +1,18 @@
// 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
use cosmic_time::once_cell::sync::Lazy;
use i18n_embed::{ use i18n_embed::{
fluent::{fluent_language_loader, FluentLanguageLoader}, fluent::{fluent_language_loader, FluentLanguageLoader},
DefaultLocalizer, LanguageLoader, Localizer, DefaultLocalizer, LanguageLoader, Localizer,
}; };
use rust_embed::RustEmbed; use rust_embed::RustEmbed;
use std::sync::LazyLock;
#[derive(RustEmbed)] #[derive(RustEmbed)]
#[folder = "i18n/"] #[folder = "i18n/"]
struct Localizations; struct Localizations;
pub static LANGUAGE_LOADER: Lazy<FluentLanguageLoader> = Lazy::new(|| { pub static LANGUAGE_LOADER: LazyLock<FluentLanguageLoader> = LazyLock::new(|| {
let loader: FluentLanguageLoader = fluent_language_loader!(); let loader: FluentLanguageLoader = fluent_language_loader!();
loader loader

View file

@ -9,7 +9,6 @@ i18n-embed-fl.workspace = true
i18n-embed.workspace = true i18n-embed.workspace = true
libcosmic.workspace = true libcosmic.workspace = true
logind-zbus = "5.3.2" logind-zbus = "5.3.2"
once_cell = "1.20.3"
rust-embed.workspace = true rust-embed.workspace = true
rustix.workspace = true rustix.workspace = true
tokio.workspace = true tokio.workspace = true

View file

@ -22,7 +22,7 @@ use cosmic::{
widget::{autosize, button, divider, icon, layer_container::layer_container, text, Space}, widget::{autosize, button, divider, icon, layer_container::layer_container, text, Space},
Element, Task, Element, Task,
}; };
use once_cell::sync::Lazy; use std::sync::LazyLock;
use logind_zbus::{ use logind_zbus::{
manager::ManagerProxy, manager::ManagerProxy,
@ -39,8 +39,8 @@ pub mod session_manager;
use crate::{cosmic_session::CosmicSessionProxy, session_manager::SessionManagerProxy}; use crate::{cosmic_session::CosmicSessionProxy, session_manager::SessionManagerProxy};
static SUBSURFACE_ID: Lazy<cosmic::widget::Id> = static SUBSURFACE_ID: LazyLock<cosmic::widget::Id> =
Lazy::new(|| cosmic::widget::Id::new("subsurface")); LazyLock::new(|| cosmic::widget::Id::new("subsurface"));
pub fn run() -> cosmic::iced::Result { pub fn run() -> cosmic::iced::Result {
localize::localize(); localize::localize();

View file

@ -5,14 +5,14 @@ use i18n_embed::{
fluent::{fluent_language_loader, FluentLanguageLoader}, fluent::{fluent_language_loader, FluentLanguageLoader},
DefaultLocalizer, LanguageLoader, Localizer, DefaultLocalizer, LanguageLoader, Localizer,
}; };
use once_cell::sync::Lazy;
use rust_embed::RustEmbed; use rust_embed::RustEmbed;
use std::sync::LazyLock;
#[derive(RustEmbed)] #[derive(RustEmbed)]
#[folder = "i18n/"] #[folder = "i18n/"]
struct Localizations; struct Localizations;
pub static LANGUAGE_LOADER: Lazy<FluentLanguageLoader> = Lazy::new(|| { pub static LANGUAGE_LOADER: LazyLock<FluentLanguageLoader> = LazyLock::new(|| {
let loader: FluentLanguageLoader = fluent_language_loader!(); let loader: FluentLanguageLoader = fluent_language_loader!();
loader loader

View file

@ -13,7 +13,6 @@ cosmic-protocols.workspace = true
cosmic-time.workspace = true cosmic-time.workspace = true
i18n-embed-fl.workspace = true i18n-embed-fl.workspace = true
i18n-embed.workspace = true i18n-embed.workspace = true
once_cell = "1"
rust-embed.workspace = true rust-embed.workspace = true
tokio.workspace = true tokio.workspace = true
tracing-log.workspace = true tracing-log.workspace = true

View file

@ -5,14 +5,14 @@ use i18n_embed::{
fluent::{fluent_language_loader, FluentLanguageLoader}, fluent::{fluent_language_loader, FluentLanguageLoader},
DefaultLocalizer, LanguageLoader, Localizer, DefaultLocalizer, LanguageLoader, Localizer,
}; };
use once_cell::sync::Lazy;
use rust_embed::RustEmbed; use rust_embed::RustEmbed;
use std::sync::LazyLock;
#[derive(RustEmbed)] #[derive(RustEmbed)]
#[folder = "i18n/"] #[folder = "i18n/"]
struct Localizations; struct Localizations;
pub static LANGUAGE_LOADER: Lazy<FluentLanguageLoader> = Lazy::new(|| { pub static LANGUAGE_LOADER: LazyLock<FluentLanguageLoader> = LazyLock::new(|| {
let loader: FluentLanguageLoader = fluent_language_loader!(); let loader: FluentLanguageLoader = fluent_language_loader!();
loader loader

View file

@ -9,11 +9,11 @@ use cosmic::iced::{
stream, Subscription, stream, Subscription,
}; };
use cosmic_protocols::workspace::v2::client::zcosmic_workspace_handle_v2::TilingState; use cosmic_protocols::workspace::v2::client::zcosmic_workspace_handle_v2::TilingState;
use once_cell::sync::Lazy; use std::sync::LazyLock;
use tokio::sync::Mutex; use tokio::sync::Mutex;
pub static WAYLAND_RX: Lazy<Mutex<Option<mpsc::Receiver<TilingState>>>> = pub static WAYLAND_RX: LazyLock<Mutex<Option<mpsc::Receiver<TilingState>>>> =
Lazy::new(|| Mutex::new(None)); LazyLock::new(|| Mutex::new(None));
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub enum WorkspacesUpdate { pub enum WorkspacesUpdate {

View file

@ -12,7 +12,6 @@ chrono-tz = "0.10"
i18n-embed-fl.workspace = true i18n-embed-fl.workspace = true
i18n-embed.workspace = true i18n-embed.workspace = true
libcosmic.workspace = true libcosmic.workspace = true
once_cell.workspace = true
rust-embed.workspace = true rust-embed.workspace = true
tokio.workspace = true tokio.workspace = true
tracing-log.workspace = true tracing-log.workspace = true

View file

@ -5,14 +5,14 @@ use i18n_embed::{
fluent::{fluent_language_loader, FluentLanguageLoader}, fluent::{fluent_language_loader, FluentLanguageLoader},
DefaultLocalizer, LanguageLoader, Localizer, DefaultLocalizer, LanguageLoader, Localizer,
}; };
use once_cell::sync::Lazy;
use rust_embed::RustEmbed; use rust_embed::RustEmbed;
use std::sync::LazyLock;
#[derive(RustEmbed)] #[derive(RustEmbed)]
#[folder = "i18n/"] #[folder = "i18n/"]
struct Localizations; struct Localizations;
pub static LANGUAGE_LOADER: Lazy<FluentLanguageLoader> = Lazy::new(|| { pub static LANGUAGE_LOADER: LazyLock<FluentLanguageLoader> = LazyLock::new(|| {
let loader: FluentLanguageLoader = fluent_language_loader!(); let loader: FluentLanguageLoader = fluent_language_loader!();
loader loader

View file

@ -26,7 +26,7 @@ use cosmic::{
Element, Task, Element, Task,
}; };
use logind_zbus::manager::ManagerProxy; use logind_zbus::manager::ManagerProxy;
use once_cell::sync::Lazy; use std::sync::LazyLock;
use timedate_zbus::TimeDateProxy; use timedate_zbus::TimeDateProxy;
use tokio::{sync::watch, time}; use tokio::{sync::watch, time};
@ -47,7 +47,7 @@ use cosmic::applet::token::subscription::{
activation_token_subscription, TokenRequest, TokenUpdate, activation_token_subscription, TokenRequest, TokenUpdate,
}; };
static AUTOSIZE_MAIN_ID: Lazy<Id> = Lazy::new(|| Id::new("autosize-main")); static AUTOSIZE_MAIN_ID: LazyLock<Id> = LazyLock::new(|| Id::new("autosize-main"));
/// In order to keep the understandable, the chrono types are not globals, /// In order to keep the understandable, the chrono types are not globals,
/// to avoid conflict with icu /// to avoid conflict with icu

View file

@ -12,7 +12,6 @@ cosmic-protocols.workspace = true
tracing.workspace = true tracing.workspace = true
tracing-subscriber.workspace = true tracing-subscriber.workspace = true
tracing-log.workspace = true tracing-log.workspace = true
once_cell = "1.20"
futures.workspace = true futures.workspace = true
anyhow.workspace = true anyhow.workspace = true
tokio.workspace = true tokio.workspace = true

View file

@ -27,8 +27,6 @@ use cosmic::{
Element, Task, Theme, Element, Task, Theme,
}; };
use once_cell::sync::Lazy;
use crate::{ use crate::{
config, config,
wayland::WorkspaceEvent, wayland::WorkspaceEvent,
@ -37,10 +35,11 @@ use crate::{
use std::{ use std::{
process::Command as ShellCommand, process::Command as ShellCommand,
sync::LazyLock,
time::{Duration, Instant}, time::{Duration, Instant},
}; };
static AUTOSIZE_MAIN_ID: Lazy<Id> = Lazy::new(|| Id::new("autosize-main")); static AUTOSIZE_MAIN_ID: LazyLock<Id> = LazyLock::new(|| Id::new("autosize-main"));
pub fn run() -> cosmic::iced::Result { pub fn run() -> cosmic::iced::Result {
cosmic::applet::run::<IcedWorkspacesApplet>(()) cosmic::applet::run::<IcedWorkspacesApplet>(())

View file

@ -5,14 +5,14 @@ use i18n_embed::{
fluent::{fluent_language_loader, FluentLanguageLoader}, fluent::{fluent_language_loader, FluentLanguageLoader},
DefaultLocalizer, LanguageLoader, Localizer, DefaultLocalizer, LanguageLoader, Localizer,
}; };
use once_cell::sync::Lazy;
use rust_embed::RustEmbed; use rust_embed::RustEmbed;
use std::sync::LazyLock;
#[derive(RustEmbed)] #[derive(RustEmbed)]
#[folder = "i18n/"] #[folder = "i18n/"]
struct Localizations; struct Localizations;
pub static LANGUAGE_LOADER: Lazy<FluentLanguageLoader> = Lazy::new(|| { pub static LANGUAGE_LOADER: LazyLock<FluentLanguageLoader> = LazyLock::new(|| {
let loader: FluentLanguageLoader = fluent_language_loader!(); let loader: FluentLanguageLoader = fluent_language_loader!();
loader loader

View file

@ -8,11 +8,11 @@ use cosmic::iced::{
futures::{channel::mpsc, SinkExt, StreamExt}, futures::{channel::mpsc, SinkExt, StreamExt},
stream, Subscription, stream, Subscription,
}; };
use once_cell::sync::Lazy; use std::sync::LazyLock;
use tokio::sync::Mutex; use tokio::sync::Mutex;
pub static WAYLAND_RX: Lazy<Mutex<Option<mpsc::Receiver<Vec<Workspace>>>>> = pub static WAYLAND_RX: LazyLock<Mutex<Option<mpsc::Receiver<Vec<Workspace>>>>> =
Lazy::new(|| Mutex::new(None)); LazyLock::new(|| Mutex::new(None));
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub enum WorkspacesUpdate { pub enum WorkspacesUpdate {

View file

@ -10,5 +10,4 @@ tracing.workspace = true
tracing-subscriber.workspace = true tracing-subscriber.workspace = true
tracing-log.workspace = true tracing-log.workspace = true
cosmic-config.workspace = true cosmic-config.workspace = true
once_cell.workspace = true
serde.workspace = true serde.workspace = true

View file

@ -16,12 +16,11 @@ use cosmic::{
Task, Task,
}; };
use cosmic_config::{Config, CosmicConfigEntry}; use cosmic_config::{Config, CosmicConfigEntry};
use once_cell::sync::Lazy; use std::{env, fs, process::Command, sync::LazyLock};
use std::{env, fs, process::Command};
mod config; mod config;
static AUTOSIZE_MAIN_ID: Lazy<Id> = Lazy::new(|| Id::new("autosize-main")); static AUTOSIZE_MAIN_ID: LazyLock<Id> = LazyLock::new(|| Id::new("autosize-main"));
#[derive(Debug, Clone, Default)] #[derive(Debug, Clone, Default)]
struct Desktop { struct Desktop {