From 2e023fb8d39dcc12c38314725750d8ff5a0eb85d Mon Sep 17 00:00:00 2001 From: cucadmuh <49571317+cucadmuh@users.noreply.github.com> Date: Tue, 14 Jul 2026 10:08:33 +0300 Subject: [PATCH] fix(tray): restore sidebar after cold-start minimized to tray (#1296) --- CHANGELOG.md | 6 ++++++ src-tauri/src/lib.rs | 13 +++++-------- src-tauri/src/lib_commands/ui/mini.rs | 8 ++++++-- src/features/sidebar/components/Sidebar.tsx | 2 +- 4 files changed, 18 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2c3d9d62..758ad02f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -157,6 +157,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Fixed +### Tray — sidebar missing after cold start minimized to tray + +**By [@cucadmuh](https://github.com/cucadmuh), PR [#1296](https://github.com/Psychotoxical/psysonic/pull/1296)** + +* With **Start minimized to tray** enabled, opening the main window from the tray could leave the left sidebar menu invisible until a full app restart (seen on Linux tiling WMs such as Hyprland). The sidebar no longer uses a slide-in entrance animation that starts at `opacity: 0`; cold-start tray hide restores the original pause-and-hide path from PR #1271, and tray show again resumes rendering before `show()` without an extra `unminimize()` that could pop the window on tiling WMs. + ### Playlist and radio custom covers blank **By [@cucadmuh](https://github.com/cucadmuh), reported by VirtualWolf, PR [#1295](https://github.com/Psychotoxical/psysonic/pull/1295)** diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 58de8860..e46c46d5 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -53,14 +53,11 @@ fn on_second_instance( let window = app.get_webview_window("main").expect("no main window"); // The window may have been hidden via the close-to-tray path, // which injects PAUSE_RENDERING_JS (sets `__psyHidden=true`, - // pauses CSS animations). Tray-icon restore mirrors this with - // RESUME_RENDERING_JS — second-launch restore must do the same, - // otherwise the webview comes back with rendering still paused - // and navigation looks blank (issue #497). - let _ = window.eval(RESUME_RENDERING_JS); - let _ = window.show(); - let _ = window.unminimize(); - let _ = window.set_focus(); + // pauses CSS animations). Tray restore uses `restore_main_window` + // — second-launch restore must do the same, otherwise the webview + // comes back with rendering still paused and navigation looks blank + // (issue #497). + let _ = crate::lib_commands::ui::mini::restore_main_window(&window); } } diff --git a/src-tauri/src/lib_commands/ui/mini.rs b/src-tauri/src/lib_commands/ui/mini.rs index 602cd470..c40457ed 100644 --- a/src-tauri/src/lib_commands/ui/mini.rs +++ b/src-tauri/src/lib_commands/ui/mini.rs @@ -169,8 +169,12 @@ document.documentElement.style.removeProperty('--psy-anim-speed'); })(); "#; -/// Show the main window after startup splash paint, or pause rendering when the -/// user chose "start minimized to tray" (flag set in `startup-splash-preflight.js`). +/// Show the main window after startup splash paint, or pause rendering and hide +/// when the user chose "start minimized to tray" (flag set in +/// `startup-splash-preflight.js`). +/// +/// The shell no longer uses entrance animations that start at `opacity: 0`, so +/// pausing CSS here is safe on WebKitGTK tiling WMs (sidebar fix in #1296). pub(crate) fn eval_startup_main_window_visibility(window: &tauri::WebviewWindow) { let js = format!( "(function () {{ diff --git a/src/features/sidebar/components/Sidebar.tsx b/src/features/sidebar/components/Sidebar.tsx index c51c7b9d..513f7a9a 100644 --- a/src/features/sidebar/components/Sidebar.tsx +++ b/src/features/sidebar/components/Sidebar.tsx @@ -206,7 +206,7 @@ export default function Sidebar({ return ( <> -