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;
|
2023-08-02 11:54:07 +02:00
|
|
|
use std::cell::RefCell;
|
|
|
|
|
|
|
|
|
|
thread_local! {
|
|
|
|
|
/// The fallback icon theme to search if no icon theme was specified.
|
2023-09-01 07:26:00 +02:00
|
|
|
pub(crate) static DEFAULT: RefCell<Cow<'static, str>> = RefCell::new("Cosmic".into());
|
2023-08-02 11:54:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// The fallback icon theme to search if no icon theme was specified.
|
|
|
|
|
#[must_use]
|
|
|
|
|
pub fn default() -> String {
|
2023-09-01 07:26:00 +02:00
|
|
|
DEFAULT.with(|theme| theme.borrow().to_string())
|
2023-08-02 11:54:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// Set the fallback icon theme to search when loading system icons.
|
2023-09-01 07:26:00 +02:00
|
|
|
pub fn set_default(name: impl Into<Cow<'static, str>>) {
|
|
|
|
|
DEFAULT.with(|theme| *theme.borrow_mut() = name.into());
|
2023-08-02 11:54:07 +02:00
|
|
|
}
|