You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Linux: Launching app again while minimized doesn't restore the window #15
On Linux/Ubuntu, when the app is minimized to the system tray, launching the app again (running the executable) does not bring the existing window to the front. The app stays minimized. A second launch appears to start a new instance instead of restoring the first one.
Steps to Reproduce
Launch Flo Cafe on Linux/Ubuntu
Close the window — app minimizes to system tray
Run the app executable again
The existing window stays minimized — nothing comes to front
Expected Behavior
Launching the app again should detect the running instance and restore/focus the existing window.
Current Behavior
The window stays minimized. It seems like the second instance either starts a new process or the second-instance event fires but restore() + focus() don't work on Linux.
Investigation Notes
The single-instance lock is implemented in main/index.ts:
BrowserWindow.restore() may not work on some Linux compositors (especially when minimized to tray via minimize() rather than hide())
focus() may be blocked by the window manager — need to use mainWindow.setAlwaysOnTop(true); mainWindow.setAlwaysOnTop(false) or call app.focus() as a workaround
When running unpacked (not installed via AppImage/deb), the single-instance lock file path may differ, causing a race condition
Possible fixes:
On Linux, use app.focus() in the second-instance handler in addition to restore()/focus()
Alternatively, destroy and recreate the window on second-instance if restore fails
Consider using minimizeToTray pattern (hide instead of minimize) so restore() is more reliable
Environment
OS: Linux/Ubuntu (unpacked from GitHub Actions build, not installed)
This issue was caused by a custom PID lock implemented for Linux that bypassed Electron's native requestSingleInstanceLock(). Because the custom lock forcefully quit the second instance instead of using Electron's IPC, the primary instance never received the second-instance event to restore the window. We removed the redundant custom lock (since userData was already correctly hardcoded for AppImage stability) and relied entirely on the native lock. We also added a Linux-specific focus workaround (setAlwaysOnTop) to overcome window manager focus-stealing prevention. Fixed via PR #73.
Activity
khaira777 commentedon Jul 10, 2026
This issue was caused by a custom PID lock implemented for Linux that bypassed Electron's native
requestSingleInstanceLock(). Because the custom lock forcefully quit the second instance instead of using Electron's IPC, the primary instance never received thesecond-instanceevent to restore the window. We removed the redundant custom lock (sinceuserDatawas already correctly hardcoded for AppImage stability) and relied entirely on the native lock. We also added a Linux-specific focus workaround (setAlwaysOnTop) to overcome window manager focus-stealing prevention. Fixed via PR #73.fix: linux restore from tray and singleton lock mechanism (fixes Free…