refactor: introduce thread local THEME variable and distinguish between custom and system theme settings
This commit is contained in:
parent
40efcbbe31
commit
6c57e04e36
8 changed files with 80 additions and 36 deletions
|
|
@ -27,6 +27,7 @@ pub enum ThemeVariant {
|
|||
HighContrastDark,
|
||||
HighContrastLight,
|
||||
Custom,
|
||||
System,
|
||||
}
|
||||
|
||||
impl From<&ThemeType> for ThemeVariant {
|
||||
|
|
@ -37,6 +38,7 @@ impl From<&ThemeType> for ThemeVariant {
|
|||
ThemeType::HighContrastDark => ThemeVariant::HighContrastDark,
|
||||
ThemeType::HighContrastLight => ThemeVariant::HighContrastLight,
|
||||
ThemeType::Custom(_) => ThemeVariant::Custom,
|
||||
ThemeType::System(_) => ThemeVariant::System,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -210,8 +212,9 @@ impl State {
|
|||
ThemeVariant::Light,
|
||||
ThemeVariant::Dark,
|
||||
ThemeVariant::HighContrastLight,
|
||||
ThemeVariant::HighContrastLight,
|
||||
ThemeVariant::HighContrastDark,
|
||||
ThemeVariant::Custom,
|
||||
ThemeVariant::System,
|
||||
]
|
||||
.into_iter()
|
||||
.fold(
|
||||
|
|
|
|||
|
|
@ -193,7 +193,7 @@ impl State {
|
|||
}
|
||||
|
||||
fn view_desktop_wallpaper<'a>(&'a self, window: &'a Window) -> Element<'a, Message> {
|
||||
let mut image_paths: Vec<std::path::PathBuf> = Vec::new();
|
||||
let image_paths: Vec<std::path::PathBuf> = Vec::new();
|
||||
/*
|
||||
//TODO: load image paths, do this asynchronously somehow
|
||||
if let Ok(entries) = std::fs::read_dir("/usr/share/backgrounds") {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
use apply::Apply;
|
||||
use cosmic::iced::widget::{horizontal_space, row, scrollable};
|
||||
use cosmic::iced::widget::{horizontal_space, row};
|
||||
use cosmic::iced::{Alignment, Length};
|
||||
use cosmic::widget::{button, segmented_button, view_switcher};
|
||||
use cosmic::{theme, Element};
|
||||
|
|
@ -60,7 +59,7 @@ impl State {
|
|||
self.pages.remove(id);
|
||||
}
|
||||
|
||||
pub(super) fn view<'a>(&'a self, window: &'a super::Window) -> Element<'a, Message> {
|
||||
pub(super) fn view<'a>(&'a self, _window: &'a super::Window) -> Element<'a, Message> {
|
||||
let tabs = view_switcher::horizontal(&self.pages)
|
||||
.show_close_icon_on_hover(true)
|
||||
.on_activate(Message::Activate)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue