mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-02-06 00:15:04 +01:00
Merge branch 'bugfix/persistent-theme' into 'main'
Reintroduce persistent dark/light mode See merge request asus-linux/asusctl!180
This commit is contained in:
@@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|||||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
### Changed
|
||||||
|
- Reintroduce persisting dark/light mode in config file
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
- Added ability to change what EPP is linked with each throttle profile
|
- Added ability to change what EPP is linked with each throttle profile
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ impl RogApp {
|
|||||||
// The top panel is often a good place for a menu bar:
|
// The top panel is often a good place for a menu bar:
|
||||||
egui::menu::bar(ui, |ui| {
|
egui::menu::bar(ui, |ui| {
|
||||||
ui.horizontal(|ui| {
|
ui.horizontal(|ui| {
|
||||||
egui::global_dark_light_mode_buttons(ui);
|
self.dark_light_mode_buttons(ui);
|
||||||
egui::warn_if_debug_build(ui);
|
egui::warn_if_debug_build(ui);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -44,4 +44,34 @@ impl RogApp {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn dark_light_mode_buttons(&mut self, ui: &mut egui::Ui) {
|
||||||
|
let load_from_cfg = self.config.dark_mode != ui.ctx().style().visuals.dark_mode;
|
||||||
|
|
||||||
|
if ui
|
||||||
|
.add(egui::SelectableLabel::new(
|
||||||
|
!self.config.dark_mode,
|
||||||
|
"☀ Light",
|
||||||
|
))
|
||||||
|
.clicked()
|
||||||
|
|| (load_from_cfg && !self.config.dark_mode)
|
||||||
|
{
|
||||||
|
ui.ctx().set_visuals(egui::Visuals::light());
|
||||||
|
}
|
||||||
|
if ui
|
||||||
|
.add(egui::SelectableLabel::new(self.config.dark_mode, "🌙 Dark"))
|
||||||
|
.clicked()
|
||||||
|
|| (load_from_cfg && self.config.dark_mode)
|
||||||
|
{
|
||||||
|
ui.ctx().set_visuals(egui::Visuals::dark());
|
||||||
|
}
|
||||||
|
|
||||||
|
let applied_dark_mode = ui.ctx().style().visuals.dark_mode;
|
||||||
|
|
||||||
|
if self.config.dark_mode != applied_dark_mode {
|
||||||
|
self.config.dark_mode = applied_dark_mode;
|
||||||
|
let tmp = self.config.enabled_notifications.clone();
|
||||||
|
self.config.save(&tmp).ok();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user