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",
"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]]

View file

@ -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"] }

View file

@ -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

View file

@ -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<FluentLanguageLoader> = Lazy::new(|| {
pub static LANGUAGE_LOADER: LazyLock<FluentLanguageLoader> = LazyLock::new(|| {
let loader: FluentLanguageLoader = fluent_language_loader!();
loader

View file

@ -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<Mutex<Option<UnboundedReceiver<WaylandUpdate>>>> =
Lazy::new(|| Mutex::new(None));
pub static WAYLAND_RX: LazyLock<Mutex<Option<UnboundedReceiver<WaylandUpdate>>>> =
LazyLock::new(|| Mutex::new(None));
pub fn wayland_subscription() -> iced::Subscription<WaylandUpdate> {
Subscription::run_with_id(

View file

@ -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

View file

@ -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<id::Toggler> = Lazy::new(id::Toggler::unique);
static FILTER_TOGGLE: Lazy<id::Toggler> = Lazy::new(id::Toggler::unique);
static HC_TOGGLE: Lazy<id::Toggler> = Lazy::new(id::Toggler::unique);
static MAGNIFIER_TOGGLE: Lazy<id::Toggler> = Lazy::new(id::Toggler::unique);
static INVERT_COLORS_TOGGLE: Lazy<id::Toggler> = Lazy::new(id::Toggler::unique);
static READER_TOGGLE: LazyLock<id::Toggler> = LazyLock::new(id::Toggler::unique);
static FILTER_TOGGLE: LazyLock<id::Toggler> = LazyLock::new(id::Toggler::unique);
static HC_TOGGLE: LazyLock<id::Toggler> = LazyLock::new(id::Toggler::unique);
static MAGNIFIER_TOGGLE: LazyLock<id::Toggler> = LazyLock::new(id::Toggler::unique);
static INVERT_COLORS_TOGGLE: LazyLock<id::Toggler> = LazyLock::new(id::Toggler::unique);
pub fn run() -> cosmic::iced::Result {
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::{
self as thread, AccessibilityEvent, AccessibilityRequest,
};
use once_cell::sync::Lazy;
use std::sync::LazyLock;
use tokio::sync::Mutex;
pub static WAYLAND_RX: Lazy<Mutex<Option<tokio::sync::mpsc::Receiver<AccessibilityEvent>>>> =
Lazy::new(|| Mutex::new(None));
pub static WAYLAND_RX: LazyLock<Mutex<Option<tokio::sync::mpsc::Receiver<AccessibilityEvent>>>> =
LazyLock::new(|| Mutex::new(None));
#[derive(Debug, Clone)]
pub enum WaylandUpdate {

View file

@ -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<FluentLanguageLoader> = Lazy::new(|| {
pub static LANGUAGE_LOADER: LazyLock<FluentLanguageLoader> = LazyLock::new(|| {
let loader: FluentLanguageLoader = fluent_language_loader!();
loader

View file

@ -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<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_NEXT: &str = "media-skip-forward-symbolic";

View file

@ -1,18 +1,18 @@
// Copyright 2023 System76 <info@system76.com>
// 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<FluentLanguageLoader> = Lazy::new(|| {
pub static LANGUAGE_LOADER: LazyLock<FluentLanguageLoader> = LazyLock::new(|| {
let loader: FluentLanguageLoader = fluent_language_loader!();
loader

View file

@ -1,7 +1,7 @@
// Copyright 2023 System76 <info@system76.com>
// 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<Mutex<Option<(mpsc::Receiver<Message>, mpsc::Sender<Message>)>>> =
Lazy::new(|| Mutex::new(None));
pub static FROM_PULSE: LazyLock<Mutex<Option<(mpsc::Receiver<Message>, mpsc::Sender<Message>)>>> =
LazyLock::new(|| Mutex::new(None));
pub fn connect() -> iced::Subscription<Event> {
struct SomeWorker;

View file

@ -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

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, 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::<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)]
struct GPUData {

View file

@ -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<FluentLanguageLoader> = Lazy::new(|| {
pub static LANGUAGE_LOADER: LazyLock<FluentLanguageLoader> = LazyLock::new(|| {
let loader: FluentLanguageLoader = fluent_language_loader!();
loader

View file

@ -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

View file

@ -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<id::Toggler> = Lazy::new(id::Toggler::unique);
static BLUETOOTH_ENABLED: LazyLock<id::Toggler> = LazyLock::new(id::Toggler::unique);
#[inline]
pub fn run() -> cosmic::iced::Result {

View file

@ -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<FluentLanguageLoader> = Lazy::new(|| {
pub static LANGUAGE_LOADER: LazyLock<FluentLanguageLoader> = LazyLock::new(|| {
let loader: FluentLanguageLoader = fluent_language_loader!();
loader

View file

@ -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"

View file

@ -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<FluentLanguageLoader> = Lazy::new(|| {
pub static LANGUAGE_LOADER: LazyLock<FluentLanguageLoader> = LazyLock::new(|| {
let loader: FluentLanguageLoader = fluent_language_loader!();
loader
.load_fallback_language(&Localizations)

View file

@ -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

View file

@ -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<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 {
localize();

View file

@ -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<FluentLanguageLoader> = Lazy::new(|| {
pub static LANGUAGE_LOADER: LazyLock<FluentLanguageLoader> = LazyLock::new(|| {
let loader: FluentLanguageLoader = fluent_language_loader!();
loader

View file

@ -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<NewConnectionState> for AccessPoint {
}
}
static WIFI: Lazy<id::Toggler> = Lazy::new(id::Toggler::unique);
static AIRPLANE_MODE: Lazy<id::Toggler> = Lazy::new(id::Toggler::unique);
static WIFI: LazyLock<id::Toggler> = LazyLock::new(id::Toggler::unique);
static AIRPLANE_MODE: LazyLock<id::Toggler> = LazyLock::new(id::Toggler::unique);
#[derive(Default)]
struct CosmicNetworkApplet {

View file

@ -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<FluentLanguageLoader> = Lazy::new(|| {
pub static LANGUAGE_LOADER: LazyLock<FluentLanguageLoader> = LazyLock::new(|| {
let loader: FluentLanguageLoader = fluent_language_loader!();
loader

View file

@ -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::<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 {
core: cosmic::app::Core,

View file

@ -1,18 +1,18 @@
// Copyright 2023 System76 <info@system76.com>
// 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<FluentLanguageLoader> = Lazy::new(|| {
pub static LANGUAGE_LOADER: LazyLock<FluentLanguageLoader> = LazyLock::new(|| {
let loader: FluentLanguageLoader = fluent_language_loader!();
loader

View file

@ -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

View file

@ -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<cosmic::widget::Id> =
Lazy::new(|| cosmic::widget::Id::new("subsurface"));
static SUBSURFACE_ID: LazyLock<cosmic::widget::Id> =
LazyLock::new(|| cosmic::widget::Id::new("subsurface"));
pub fn run() -> cosmic::iced::Result {
localize::localize();

View file

@ -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<FluentLanguageLoader> = Lazy::new(|| {
pub static LANGUAGE_LOADER: LazyLock<FluentLanguageLoader> = LazyLock::new(|| {
let loader: FluentLanguageLoader = fluent_language_loader!();
loader

View file

@ -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

View file

@ -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<FluentLanguageLoader> = Lazy::new(|| {
pub static LANGUAGE_LOADER: LazyLock<FluentLanguageLoader> = LazyLock::new(|| {
let loader: FluentLanguageLoader = fluent_language_loader!();
loader

View file

@ -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<Mutex<Option<mpsc::Receiver<TilingState>>>> =
Lazy::new(|| Mutex::new(None));
pub static WAYLAND_RX: LazyLock<Mutex<Option<mpsc::Receiver<TilingState>>>> =
LazyLock::new(|| Mutex::new(None));
#[derive(Debug, Clone)]
pub enum WorkspacesUpdate {

View file

@ -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

View file

@ -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<FluentLanguageLoader> = Lazy::new(|| {
pub static LANGUAGE_LOADER: LazyLock<FluentLanguageLoader> = LazyLock::new(|| {
let loader: FluentLanguageLoader = fluent_language_loader!();
loader

View file

@ -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<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,
/// to avoid conflict with icu

View file

@ -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

View file

@ -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<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 {
cosmic::applet::run::<IcedWorkspacesApplet>(())

View file

@ -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<FluentLanguageLoader> = Lazy::new(|| {
pub static LANGUAGE_LOADER: LazyLock<FluentLanguageLoader> = LazyLock::new(|| {
let loader: FluentLanguageLoader = fluent_language_loader!();
loader

View file

@ -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<Mutex<Option<mpsc::Receiver<Vec<Workspace>>>>> =
Lazy::new(|| Mutex::new(None));
pub static WAYLAND_RX: LazyLock<Mutex<Option<mpsc::Receiver<Vec<Workspace>>>>> =
LazyLock::new(|| Mutex::new(None));
#[derive(Debug, Clone)]
pub enum WorkspacesUpdate {

View file

@ -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

View file

@ -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<Id> = Lazy::new(|| Id::new("autosize-main"));
static AUTOSIZE_MAIN_ID: LazyLock<Id> = LazyLock::new(|| Id::new("autosize-main"));
#[derive(Debug, Clone, Default)]
struct Desktop {