Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: nativeTheme.shouldUseDarkColors not working on linux #28838

Closed
3 tasks done
makerio90 opened this issue Apr 26, 2021 · 10 comments · Fixed by #38977
Closed
3 tasks done

[Bug]: nativeTheme.shouldUseDarkColors not working on linux #28838

makerio90 opened this issue Apr 26, 2021 · 10 comments · Fixed by #38977

Comments

@makerio90
Copy link

Preflight Checklist

Electron Version

12.0.0

What operating system are you using?

Ubuntu

Operating System Version

20.04

What arch are you using?

x64

Last Known Working Electron version

No response

Expected Behavior

returning true (i use dark mode)

Actual Behavior

returning false, regardless of color scheme.

Testcase Gist URL

No response

Additional Information

No response

@Nokel81
Copy link

Nokel81 commented Apr 4, 2022

I have run into this as well on electron@14.2.9

@Hubro
Copy link

Hubro commented Jul 29, 2022

This is probably my biggest annoyance in my day to day life. I have pretty much every application following my system wide dark mode preference at this point, except my browser and all my Electron applications, which is like half of my applications.

Is this something Electron won't support before Chromium supports it natively? I feel like that could take a long time.

It would be amazing if Electron could implement support for the (now standardized) Freedesktop system-wide dark mode preference:

https://github.com/flatpak/xdg-desktop-portal/blob/main/data/org.freedesktop.impl.portal.Settings.xml#L34

It doesn't seem like it would be a lot of effort. The logic would basically be:

  • If running on Linux
  • If "org.freedesktop.appearance.color-scheme" is available (dbus)
  • Then use the value of "color-scheme"
  • Listen for changes to the value and re-apply above logic

Just among the applications I use every day, this would add automatic light/dark theme switching to:

  • Discord
  • Obsidian
  • Slack
  • VSCode

@github-actions
Copy link
Contributor

This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment!

@github-actions github-actions bot added the stale label Oct 28, 2022
@Nokel81
Copy link

Nokel81 commented Oct 28, 2022

This is certainly still an issue

@github-actions github-actions bot removed the stale label Oct 29, 2022
@makerio90
Copy link
Author

fuck that bot

@dbrgn
Copy link

dbrgn commented Dec 2, 2022

Related issue (newer, but with more technical details): #33635

@Igetin
Copy link

Igetin commented Jan 19, 2023

Just among the applications I use every day, this would add automatic light/dark theme switching to:

  • Discord

Fixing this issue on Electron wouldn’t actually fix the theme sync for Discord, as they use the prefers-color-scheme CSS media query directly instead of Electron APIs. For Discord’s theme sync to work, this Chromium bug needs to be resolved.

@Danik1601
Copy link

#33635 (comment)

@github-actions
Copy link
Contributor

This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment!

@github-actions github-actions bot added the stale label Jul 11, 2023
@Igetin
Copy link

Igetin commented Jul 11, 2023

Still reproducible on Electron 25, see this comment for details.

@github-actions github-actions bot removed the stale label Jul 12, 2023
robertgzr added a commit to robertgzr/electron that referenced this issue Jul 14, 2023
This is needed after https://bugs.chromium.org/p/chromium/issues/detail?id=998903
and replaces the previous workaround to detect dark mode on GTK.
Detect system dark theme preference via xdg settings portal:
https://flatpak.github.io/xdg-desktop-portal/#gdbus-org.freedesktop.portal.Settings

Closes: electron#38961
Closes: electron#28838
Signed-off-by: Robert Günzler <r@gnzler.io>
robertgzr added a commit to robertgzr/electron that referenced this issue Jul 20, 2023
This is needed after https://bugs.chromium.org/p/chromium/issues/detail?id=998903
and replaces the previous workaround to detect dark mode on GTK.
Detect system dark theme preference via xdg settings portal:
https://flatpak.github.io/xdg-desktop-portal/#gdbus-org.freedesktop.portal.Settings

Closes: electron#38961
Closes: electron#28838
Signed-off-by: Robert Günzler <r@gnzler.io>
jkleinsc added a commit that referenced this issue Sep 27, 2023
feat: port DarkModeManagerLinux

This is needed after https://bugs.chromium.org/p/chromium/issues/detail?id=998903
and replaces the previous workaround to detect dark mode on GTK.
Detect system dark theme preference via xdg settings portal:
https://flatpak.github.io/xdg-desktop-portal/#gdbus-org.freedesktop.portal.Settings

Closes: #38961
Closes: #28838

Signed-off-by: Robert Günzler <r@gnzler.io>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
trop bot added a commit that referenced this issue Sep 27, 2023
feat: port DarkModeManagerLinux

This is needed after https://bugs.chromium.org/p/chromium/issues/detail?id=998903
and replaces the previous workaround to detect dark mode on GTK.
Detect system dark theme preference via xdg settings portal:
https://flatpak.github.io/xdg-desktop-portal/#gdbus-org.freedesktop.portal.Settings

Closes: #38961
Closes: #28838

Signed-off-by: Robert Günzler <r@gnzler.io>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>

Co-authored-by: Robert Günzler <r@gnzler.io>
trop bot added a commit that referenced this issue Sep 27, 2023
feat: port DarkModeManagerLinux

This is needed after https://bugs.chromium.org/p/chromium/issues/detail?id=998903
and replaces the previous workaround to detect dark mode on GTK.
Detect system dark theme preference via xdg settings portal:
https://flatpak.github.io/xdg-desktop-portal/#gdbus-org.freedesktop.portal.Settings

Closes: #38961
Closes: #28838

Signed-off-by: Robert Günzler <r@gnzler.io>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>

Co-authored-by: Robert Günzler <r@gnzler.io>
trop bot added a commit that referenced this issue Sep 27, 2023
feat: port DarkModeManagerLinux

This is needed after https://bugs.chromium.org/p/chromium/issues/detail?id=998903
and replaces the previous workaround to detect dark mode on GTK.
Detect system dark theme preference via xdg settings portal:
https://flatpak.github.io/xdg-desktop-portal/#gdbus-org.freedesktop.portal.Settings

Closes: #38961
Closes: #28838

Signed-off-by: Robert Günzler <r@gnzler.io>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>

Co-authored-by: Robert Günzler <r@gnzler.io>
trop bot added a commit that referenced this issue Sep 27, 2023
feat: port DarkModeManagerLinux

This is needed after https://bugs.chromium.org/p/chromium/issues/detail?id=998903
and replaces the previous workaround to detect dark mode on GTK.
Detect system dark theme preference via xdg settings portal:
https://flatpak.github.io/xdg-desktop-portal/#gdbus-org.freedesktop.portal.Settings

Closes: #38961
Closes: #28838

Signed-off-by: Robert Günzler <r@gnzler.io>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>

Co-authored-by: Robert Günzler <r@gnzler.io>
jkleinsc pushed a commit that referenced this issue Sep 27, 2023
feat: port DarkModeManagerLinux

This is needed after https://bugs.chromium.org/p/chromium/issues/detail?id=998903
and replaces the previous workaround to detect dark mode on GTK.
Detect system dark theme preference via xdg settings portal:
https://flatpak.github.io/xdg-desktop-portal/#gdbus-org.freedesktop.portal.Settings

Closes: #38961
Closes: #28838

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Robert Günzler <r@gnzler.io>
jkleinsc pushed a commit that referenced this issue Sep 27, 2023
feat: port DarkModeManagerLinux

This is needed after https://bugs.chromium.org/p/chromium/issues/detail?id=998903
and replaces the previous workaround to detect dark mode on GTK.
Detect system dark theme preference via xdg settings portal:
https://flatpak.github.io/xdg-desktop-portal/#gdbus-org.freedesktop.portal.Settings

Closes: #38961
Closes: #28838

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Robert Günzler <r@gnzler.io>
codebytere pushed a commit that referenced this issue Sep 28, 2023
feat: port DarkModeManagerLinux

This is needed after https://bugs.chromium.org/p/chromium/issues/detail?id=998903
and replaces the previous workaround to detect dark mode on GTK.
Detect system dark theme preference via xdg settings portal:
https://flatpak.github.io/xdg-desktop-portal/#gdbus-org.freedesktop.portal.Settings

Closes: #38961
Closes: #28838

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Robert Günzler <r@gnzler.io>
MrHuangJser pushed a commit to MrHuangJser/electron that referenced this issue Dec 11, 2023
feat: port DarkModeManagerLinux

This is needed after https://bugs.chromium.org/p/chromium/issues/detail?id=998903
and replaces the previous workaround to detect dark mode on GTK.
Detect system dark theme preference via xdg settings portal:
https://flatpak.github.io/xdg-desktop-portal/#gdbus-org.freedesktop.portal.Settings

Closes: electron#38961
Closes: electron#28838

Signed-off-by: Robert Günzler <r@gnzler.io>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants