Repository navigation
feat(theme): follow desktop light/dark switches while running - #166
Open
m-wilkowski wants to merge 1 commit into
Open
m-wilkowski wants to merge 1 commit into
m-wilkowski wants to merge 1 commit into
Conversation
mmaher88
approved these changes
Nov 9, 2026
mmaher88
left a comment
Owner
There was a problem hiding this comment.
Nice, small, and it works on our Qt 6.4 floor because it uses the portal signal rather than QStyleHints. Heads-up: #171 (keep running with the window closed) touches the same spot in main.cpp and makes the window optional. applyDark returns early when there's no root object, so after #171 lands, a theme switch while the window is closed would be lost. We'll sort out the ordering on our side. If this ends up rebasing onto #171, please route the update through MainWindowController (or a C++ dark property that Theme.qml binds to) instead of rootObjects().first(). Separately, a "Follow system" option, so users can return to live following after touching the toggle, would be a good follow-up.
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.
Problem
Logitune reads the desktop's light/dark preference once, at startup, through the XDG desktop portal. If the desktop switches later (GNOME's dark style toggle, or tools like darkman that switch at sunset), the window keeps the theme it started with until the app is restarted. Since logitune usually starts with the session and lives in the tray, in practice the window is often in the wrong theme.
Changes
SystemColorSchemeclass insrc/app/services/that wraps the portal:readDark()replaces the inlineReadcall inmain.cpp, and it listens to the portal'sSettingChangedsignal fororg.freedesktop.appearance/color-scheme.main.cppapplies the new value when the signal arrives, through the sameTheme.darkassignment used at startup.theme/darkis not saved, the same rule startup already follows.tests/test_system_color_scheme.cpp: value parsing (dark, light, no preference, nestedQDBusVariant, non-numeric), signal emission, repeated values, and unrelated settings being ignored.No UI changes.
Testing
logitune-tests: 760 passed, 1 failed (HyprlandDesktopFocus.ActiveWindowEventEmitsFocusSignal, the existing HyprlandDesktopFocus.ActiveWindowEventEmitsFocusSignal fails when a firefox .desktop entry is installed #160, fails the same way on master).logitune-tray-tests9/9,logitune-qml-tests72/72.org.gnome.desktop.interface color-schemebetweendefaultandprefer-darkwhile logitune runs flips the window both ways within a few milliseconds, once per switch.