2023-08-02 11:54:07 +02:00
|
|
|
// Copyright 2023 System76 <info@system76.com>
|
|
|
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
|
|
|
|
2023-08-15 10:51:59 +02:00
|
|
|
//! Select the preferred icon theme.
|
|
|
|
|
|
2023-09-01 07:26:00 +02:00
|
|
|
use std::borrow::Cow;
|
2024-08-02 20:00:16 +02:00
|
|
|
use std::sync::Mutex;
|
2023-08-02 11:54:07 +02:00
|
|
|
|
2024-03-19 16:09:52 -04:00
|
|
|
pub const COSMIC: &str = "Cosmic";
|
|
|
|
|
|
2024-08-02 20:00:16 +02:00
|
|
|
pub(crate) static DEFAULT: Mutex<Cow<'static, str>> = Mutex::new(Cow::Borrowed(COSMIC));
|
2023-08-02 11:54:07 +02:00
|
|
|
|
|
|
|
|
/// The fallback icon theme to search if no icon theme was specified.
|
|
|
|
|
#[must_use]
|
2024-08-02 20:00:16 +02:00
|
|
|
#[allow(clippy::missing_panics_doc)]
|
2025-03-21 03:17:59 +01:00
|
|
|
#[inline]
|
2023-08-02 11:54:07 +02:00
|
|
|
pub fn default() -> String {
|
2024-08-02 20:00:16 +02:00
|
|
|
DEFAULT.lock().unwrap().to_string()
|
2023-08-02 11:54:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// Set the fallback icon theme to search when loading system icons.
|
2024-08-02 20:00:16 +02:00
|
|
|
#[allow(clippy::missing_panics_doc)]
|
2025-03-21 03:17:59 +01:00
|
|
|
#[cold]
|
2023-09-01 07:26:00 +02:00
|
|
|
pub fn set_default(name: impl Into<Cow<'static, str>>) {
|
2024-08-02 20:00:16 +02:00
|
|
|
*DEFAULT.lock().unwrap() = name.into();
|
2023-08-02 11:54:07 +02:00
|
|
|
}
|