Skip to content

Commit 04ebf7f

Browse files
committed
feat: app icon on settings window, smarter updater UI, startup status
1 parent 55aaaf7 commit 04ebf7f

3 files changed

Lines changed: 19 additions & 7 deletions

File tree

src/ui/mod.rs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,15 +102,16 @@ impl eframe::App for SettingsApp {
102102
fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) {
103103
// If the main thread asked us to show up, make the window visible and focused.
104104
if SETTINGS_SHOW.swap(false, Ordering::SeqCst) {
105-
ctx.send_viewport_cmd(egui::ViewportCommand::Minimized(false));
105+
ctx.send_viewport_cmd(egui::ViewportCommand::Visible(true));
106106
ctx.send_viewport_cmd(egui::ViewportCommand::Focus);
107107
}
108108

109-
// When the user clicks X, minimize instead of closing.
110-
// The thread stays alive so the next open is instant and reliable.
109+
// When the user clicks X, hide instead of closing.
110+
// The thread stays alive so the next open is instant, and the window
111+
// doesn't linger in the taskbar.
111112
if ctx.input(|i| i.viewport().close_requested()) {
112113
ctx.send_viewport_cmd(egui::ViewportCommand::CancelClose);
113-
ctx.send_viewport_cmd(egui::ViewportCommand::Minimized(true));
114+
ctx.send_viewport_cmd(egui::ViewportCommand::Visible(false));
114115
return;
115116
}
116117

@@ -171,7 +172,11 @@ pub fn open_settings(config_shared: Arc<Mutex<AppConfig>>, cmd_tx: mpsc::Sender<
171172
let icon = {
172173
let rgba = crate::tray::build_icon_rgba(&crate::state::AppState::default());
173174
let size = crate::tray::ICON_SIZE as u32;
174-
std::sync::Arc::new(egui::IconData { rgba, width: size, height: size })
175+
std::sync::Arc::new(egui::IconData {
176+
rgba,
177+
width: size,
178+
height: size,
179+
})
175180
};
176181

177182
let native_options = eframe::NativeOptions {

src/ui/startup_tab.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,10 @@ impl SettingsApp {
3232
self.startup_registered = registered;
3333

3434
let (task_text, task_color) = if registered {
35-
("Task registered: Yes", egui::Color32::from_rgb(80, 200, 100))
35+
(
36+
"Task registered: Yes",
37+
egui::Color32::from_rgb(80, 200, 100),
38+
)
3639
} else {
3740
("Task registered: No", egui::Color32::from_rgb(220, 100, 80))
3841
};

src/ui/updater_tab.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,11 @@ impl SettingsApp {
135135
ui.weak(format!(
136136
"Auto-checks every {} hour{}.",
137137
self.config.updater.check_interval_h,
138-
if self.config.updater.check_interval_h == 1 { "" } else { "s" }
138+
if self.config.updater.check_interval_h == 1 {
139+
""
140+
} else {
141+
"s"
142+
}
139143
));
140144
}
141145

0 commit comments

Comments
 (0)