Skip to content

Commit 3caef5e

Browse files
committed
v1.0.4
1 parent b2d21bf commit 3caef5e

6 files changed

Lines changed: 73 additions & 4 deletions

File tree

assets/installer.iss

-18 Bytes
Binary file not shown.

src/main.rs

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,4 +349,51 @@ fn main_loop(
349349

350350
Cmd::CheckForUpdates => {
351351
let cfg = config_shared.lock().unwrap().clone();
352-
updater::background_check(cfg.updater, cmd_t
352+
updater::background_check(cfg.updater, cmd_tx.clone());
353+
}
354+
355+
Cmd::Restart => {
356+
// Restore all before restarting
357+
{
358+
let mut state = state_shared.lock().unwrap();
359+
profiles::restore_all(&mut state);
360+
}
361+
let exe = std::env::current_exe()
362+
.unwrap_or_else(|_| std::path::PathBuf::from("HideDesktopApps.exe"));
363+
let _ = std::process::Command::new(exe).spawn();
364+
return Ok(());
365+
}
366+
367+
Cmd::Exit => {
368+
// Restore everything cleanly before exiting
369+
let mut state = state_shared.lock().unwrap();
370+
profiles::restore_all(&mut state);
371+
return Ok(());
372+
}
373+
374+
Cmd::UpdateAvailable(version) => {
375+
let cfg = config_shared.lock().unwrap().clone();
376+
notifications::notify_update_available(&version, &cfg.notifications);
377+
eprintln!("Update available: {version}");
378+
}
379+
380+
Cmd::HotkeyFailed(hotkey) => {
381+
let cfg = config_shared.lock().unwrap().clone();
382+
notifications::notify_hotkey_failed(&hotkey, &cfg.notifications);
383+
}
384+
}
385+
}
386+
}
387+
}
388+
389+
/// Update Discord Rich Presence if enabled.
390+
fn update_discord(state: &AppState, config: &AppConfig) {
391+
if config.discord.enabled {
392+
discord::set_rich_presence(
393+
state.icons_hidden,
394+
state.taskbar_hidden,
395+
state.windows_hidden,
396+
state.active_profile.clone(),
397+
);
398+
}
399+
}

src/startup.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,4 +80,10 @@ pub fn sync_startup(config: &crate::config::StartupConfig, exe_path: &str) {
8080
if config.enabled {
8181
if let Err(e) = register(exe_path, config.delay_s) {
8282
eprintln!("Failed to register startup task: {e}");
83-
83+
}
84+
} else if is_registered() {
85+
if let Err(e) = unregister() {
86+
eprintln!("Failed to unregister startup task: {e}");
87+
}
88+
}
89+
}

src/taskbar.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,4 +89,14 @@ pub fn show_taskbar() -> Result<()> {
8989
Ok(())
9090
}
9191

92-
/// Toggle taskba
92+
/// Toggle taskbar visibility.
93+
#[allow(dead_code)]
94+
pub fn toggle_taskbar() -> Result<bool> {
95+
if is_taskbar_visible() {
96+
hide_taskbar()?;
97+
Ok(false)
98+
} else {
99+
show_taskbar()?;
100+
Ok(true)
101+
}
102+
}

src/tray.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,3 +280,6 @@ pub fn poll_menu_event() -> Option<MenuEvent> {
280280
}
281281

282282
/// Poll tray icon events (click, double-click) without blocking.
283+
pub fn poll_tray_event() -> Option<TrayIconEvent> {
284+
TrayIconEvent::receiver().try_recv().ok()
285+
}

src/ui/mod.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,4 +152,7 @@ pub fn open_settings(config_shared: Arc<Mutex<AppConfig>>, cmd_tx: std::sync::mp
152152

153153
if let Err(e) = result {
154154
crate::dlog!("Settings window error: {e}");
155-
eprin
155+
eprintln!("Settings window error: {e}");
156+
}
157+
});
158+
}

0 commit comments

Comments
 (0)