Fix dark mode detection on Linux #895

pull benthecarman wants to merge 1 commits into bitcoin-core:master from benthecarman:fix-dark-mode changing 1 files +12 −0
  1. benthecarman commented at 1:19 am on September 23, 2025: contributor

    Enable GTK3 platform theme integration on Linux to properly detect system dark/light mode settings. Without this, Qt applications on Linux don’t automatically adapt to the system theme, unlike macOS where it works out of the box.

    The fix sets QT_QPA_PLATFORMTHEME to “gtk3” before QApplication initialization, but only if the user hasn’t already set a platform theme. This respects existing user configurations while providing better defaults for desktop environments using GTK (GNOME, Unity, XFCE, MATE).

    The change is non-breaking as Qt falls back gracefully if the GTK platform theme plugin is unavailable

  2. qt: Fix dark mode detection on Linux
      Enable GTK3 platform theme integration on Linux to properly detect
      system dark/light mode settings. Without this, Qt applications on
      Linux don't automatically adapt to the system theme, unlike macOS
      where it works out of the box.
    
      The fix sets QT_QPA_PLATFORMTHEME to "gtk3" before QApplication
      initialization, but only if the user hasn't already set a platform
      theme. This respects existing user configurations while providing
      better defaults for desktop environments using GTK (GNOME, Unity,
      XFCE, MATE).
    
      The change is non-breaking as Qt falls back gracefully if the GTK
      platform theme plugin is unavailable
    f2cd577b98
  3. DrahtBot commented at 1:19 am on September 23, 2025: contributor

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Reviews

    See the guideline for information on the review process. A summary of reviews will appear here.

  4. hebasto commented at 8:07 am on September 23, 2025: member

    Enable GTK3 platform theme integration on Linux to properly detect system dark/light mode settings. Without this, Qt applications on Linux don’t automatically adapt to the system theme, unlike macOS where it works out of the box.

    Could you please clarify which build this change is intended to affect, statically linked or shared?

    If the latter, which system was this tested on (OS, desktop environment, Qt version)?

  5. hebasto renamed this:
    qt: Fix dark mode detection on Linux
    Fix dark mode detection on Linux
    on Sep 23, 2025
  6. hebasto added the label Linux on Sep 23, 2025
  7. luke-jr commented at 9:27 am on September 23, 2025: member
    Seems like this could make things worse for native (Qt) environments?
  8. benthecarman commented at 4:55 pm on September 23, 2025: contributor

    Could you please clarify which build this change is intended to affect, statically linked or shared?

    If the latter, which system was this tested on (OS, desktop environment, Qt version)?

    this sadly only effects dynamically linked builds.

    I have tested on ubuntu 24.04 with Qt 6.4.2

  9. hebasto commented at 5:38 pm on September 23, 2025: member

    Could you please clarify which build this change is intended to affect, statically linked or shared? If the latter, which system was this tested on (OS, desktop environment, Qt version)?

    this sadly only effects dynamically linked builds.

    Bringing this functionality to statically linked (including release) binaries would require introducing new build dependencies. There is a consensus among Core developers that this should only be considered after separating the GUI build into its own Guix script.

    I have tested on ubuntu 24.04 with Qt 6.4.2

    On the same system, the master branch @ 34fefb633584ecd803b01209756f2bef412f1cb1:

    Everything seems to be working correctly.

  10. katesalazar commented at 4:15 pm on September 24, 2025: none

    Ah, nice and small, thanks. I have a couple of questions.

    This is in your code:

    This must be done before creating the QApplication

    Does this mean window won’t change live when theme changes, on Linux?

    This is in your post:

    unlike macOS where it works out of the box.

    Does this mean window will change live when theme changes, on macOS?

  11. benthecarman closed this on Oct 4, 2025

  12. benthecarman deleted the branch on Oct 4, 2025

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin-core/gui. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2025-10-11 03:20 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me