feat: allow enabling dark mode on Linux#11331
Open
BenJule wants to merge 1 commit into
Open
Conversation
The Preferences 'Dark Mode' toggle was guarded by #ifdef _WIN32, so Linux users had no way to turn dark mode on even though the dark rendering path is built on all platforms (SUPPORT_DARK_MODE). On top of that, on non-Windows the app overwrote dark_color_mode with the system appearance on every start, which on Linux follows only the GTK theme (not e.g. KDE's color-scheme) and reset any manual choice. - Show the dark-mode toggle on Linux as well (#ifndef __APPLE__; macOS stays on the native appearance, where dark_mode() ignores this config). - Seed dark_color_mode from the system appearance on first run only, so the user's explicit choice persists across restarts instead of being overwritten.
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.
Summary
On Linux there's no way to turn on dark mode: the Preferences "Dark Mode" toggle is guarded by
#ifdef _WIN32, even though the dark rendering path is compiled on all platforms (SUPPORT_DARK_MODEis defined unconditionally). So Linux users can't enable dark mode from the UI at all.It's also worse than just a hidden toggle: on non-Windows,
GUI_Appoverwritesdark_color_modewithwxSystemSettings::GetAppearance().IsDark()on every startup. On Linux wxGTK derives that purely from the GTK theme (it doesn't see e.g. KDE'scolor-scheme: prefer-dark), so even if a user sets the config by hand it gets reset on the next launch.Changes
#ifndef __APPLE__instead of#ifdef _WIN32). macOS is left out on purpose: theredark_mode()uses the native appearance and ignores this config, so a toggle would do nothing.dark_color_modefrom the system appearance on first run only, so a user's explicit choice in Preferences persists across restarts instead of being overwritten every start. On first run the behaviour is unchanged (it still follows the detected system appearance).This mirrors how the toggle already works on Windows (
dark_mode()isconfig == "1" ? true : check_dark_mode()on both).Test plan
dark_mode()).Note: as before, on Linux the live re-theme of native widgets still depends on the GTK theme; a full switch is cleanest after a restart. This PR is about making the option reachable and persistent, which it wasn't.