Repository navigation
fix(app): second launch shows the window; keep running in the background when closed - #171
Open
schultz-dev0 wants to merge 2 commits into
Open
schultz-dev0 wants to merge 2 commits into
schultz-dev0 wants to merge 2 commits into
Conversation
A second launch used to fail the instance lock and exit silently while the first instance sat hidden. It now asks the running instance to show its window and exits 0. Without a tray, closing the window quits instead of hiding.
Closing the window destroys the UI and keeps devices, profiles, the tray and the single-instance server running, with or without a tray. Launching again rebuilds the window. --minimized starts without building it at all. Add --quit and a Quit button in Settings so the app can be ended without a tray.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closing the window doesn't close it. In
src/app/qml/Main.qml:77-80,onClosingrejects the close and callshide(), andsetQuitOnLastWindowClosed(false)insrc/app/main.cpp:60keeps the process alive with no window. The next launch then failslockFile.tryLock()insrc/app/main.cpp:93-99, because the hidden instance still holds the lock. It logs "Another instance of Logitune is already running" and returns 1. If you're on a system with no tray, the only way to open the app again is to pkill it first.The first commit keeps the QLockFile and adds a QLocalServer next to it in the first instance (
src/app/SingleInstance.*). A second launch connects, sends a show command and exits with 0, and the window comes back up. The tray's "Show" and the second launch share the same code. The lock file moved from the temp directory to the per-user runtime directory, next to the new socket.Since a second launch can now always bring the window back, the second commit makes Logitune keep running when its window is closed, tray or not:
src/app/MainWindowController.*). Devices, profiles, the tray and the single-instance server keep running.--minimizedstarts without building the window at all.logitune --quitends the running instance, and there's a Quit button in Settings, so you can quit without a tray. The tray's Quit stays.Memory (PSS, Hyprland, after an 8 s settle): about 120 MiB with the window open, about 80 MiB after closing it (88 MiB after repeated open/close cycles, then flat), and about 32 MiB when started with
--minimized. Closing frees the window's objects and callsmalloc_trim(0)on glibc, but Qt keeps some caches once the UI has been built, so it doesn't get back down to the--minimizedfigure.Tests: second launch sends show and exits 0;
--quitreaches the primary and exits 0, and does nothing when no instance is running; closing destroys the window and a show request builds a new one; the Quit button quits.logitune-tests(762),logitune-tray-tests(9) and the QML tests (79) pass. Smoke-tested on Hyprland with and without a tray host: closing keeps the process, a second launch brings the window back, device notifications keep being handled with no window, and--quitends it.