Skip to content

Commit a3de5b4

Browse files
committed
fix: settings window hides from taskbar without breaking reopen
1 parent 60e4ac2 commit a3de5b4

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

src/ui/mod.rs

Lines changed: 8 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 wants us to show, restore and focus
104104
if SETTINGS_SHOW.swap(false, Ordering::SeqCst) {
105-
ctx.send_viewport_cmd(egui::ViewportCommand::Visible(true));
105+
ctx.send_viewport_cmd(egui::ViewportCommand::Minimized(false));
106106
ctx.send_viewport_cmd(egui::ViewportCommand::Focus);
107107
}
108108

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

@@ -181,7 +182,9 @@ pub fn open_settings(config_shared: Arc<Mutex<AppConfig>>, cmd_tx: mpsc::Sender<
181182
.with_title("HideDesktopApps Settings")
182183
.with_inner_size([600.0, 480.0])
183184
.with_resizable(true)
184-
.with_icon(icon),
185+
.with_icon(icon)
186+
// keep it out of the taskbar — we show/hide by minimizing
187+
.with_taskbar(false),
185188
event_loop_builder: Some(Box::new(|builder| {
186189
use winit::platform::windows::EventLoopBuilderExtWindows;
187190
builder.with_any_thread(true);

0 commit comments

Comments
 (0)