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
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.