electron: systemPreferences.isDarkMode always returns false on macOS 10.15 Catalina

Preflight Checklist

  • I have read the Contributing Guidelines for this project.
  • I agree to follow the Code of Conduct that this project adheres to.
  • I have searched the issue tracker for an issue that matches the one I want to file, without success.

Issue Details

  • Electron Version:
    • 5.0.6
  • Operating System:
    • macOS 10.15 Developer Beta 2 (19A487l)
  • Last Known Working Electron version:
    • 5.0.x (worked before Catalina)

Expected Behavior

systemPreferences.isDarkMode on macOS 10.15 Catalina should report whether it’s in dark mode or not, even when set to Auto Mode (based on time of day). Electron 5.0.6 fixed some of the issues from #18913 , but isn’t working correctly.

Actual Behavior

systemPreferences.isDarkMode is always reporting to be false.

To Reproduce

Repository: https://github.com/hyperspacedev/hyperspace

$ git clone https://github.com/hyperspacedev/hyperspace -b catalina-vibrancy
$ npm install
$ npm run electrify

Screenshots

Screen Shot 2019-06-27 at 08 23 18 Dark mode reports to be `false` here and is expected because it's in light mode. Screen Shot 2019-06-27 at 08 23 33 Dark mode reports to be `false` here as well since, at the time of Auto Mode, it shouldn't be in dark mode. Screen Shot 2019-06-27 at 08 23 25 However, dark mode reports to be `false` here, even though that isn't true.

Additional Information

I speculate that the name of the dark appearance might have changed.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 1
  • Comments: 24 (6 by maintainers)

Most upvoted comments

still broken in 6.0.11. As confirmed by @alicerunsonfedora it’s only when running from NPM, but still - very annoying when you need to see what the app looks like in both light & dark modes.

@fabiospampinato It’ll be fixed on Mojave in 5.0.7

I can reproduce this on Mojave as well, I believe it was working properly on Electron v5.0.5, but it broke on v5.0.6.

@DeerMichel it’s not a question of which backport is missing. It’s a question of the target SDK. You’ll be building master locally against 10.14 and we release against 10.13.

This results in difference of behavior around macOS’s dark mode apis. The linked PR changes it to not affect Mojave, in this case the only way to make this work is to either target 10.14 or to opt in to dark mode with NSRequiresAquaSystemAppearance=false

This probably requires a wider discussion before Catalina hits stable, I’ve also raised a TSI with apple to see if theirs a way to get this info with opting in to OS dark mode settings

@codebytere is working on a fix for a related issue which I believe is fundamentally the same cause 👍

Can confirm systemPreferences.isDarkMode() returns false in both dark and light mode

  • Mac OS Mojave 10.14.5
  • Electron 5.0.6

👌 Thank you to developers on the Electron team for the awesome work 🙇 Thank you for the upcoming fix https://github.com/electron/electron/issues/19009#issuecomment-508900680