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

[FEATURE] Use future Code API to detect preferred scheme #40

Closed
Arcitec opened this issue Nov 26, 2019 · 6 comments
Closed

[FEATURE] Use future Code API to detect preferred scheme #40

Arcitec opened this issue Nov 26, 2019 · 6 comments
Assignees
Labels
enhancement New feature or request external good first issue Good for newcomers

Comments

@Arcitec
Copy link

Arcitec commented Nov 26, 2019

Hey everyone. Your extension looks nice, but it's a shame that it's mac-only.

Read the bottom of this comment:
microsoft/vscode#61519 (comment)

There is a JavaScript query, supported by V8/Electron (VSCode's GUI engine), which tells you whether dark mode is enabled or disabled on the system.

So you can rip out all the ugly macOS-specific code and replace it with this. :-)

@muuvmuuv
Copy link
Owner

Thank you for opening the issue! I will try to use the CSS media query solution today, but would love to see that the VS Code team will implement the electron native solution ASAP.

@muuvmuuv muuvmuuv changed the title [BUG] – No more hacks! [FEATURE] Use CSS media query to detect system theme or native electron API Nov 27, 2019
@muuvmuuv muuvmuuv added enhancement New feature or request good first issue Good for newcomers external labels Nov 27, 2019
@muuvmuuv muuvmuuv self-assigned this Nov 27, 2019
@muuvmuuv
Copy link
Owner

@VideoPlayerCode How have you accessed the window? VS Code always tells me window is not defined.

@Arcitec
Copy link
Author

Arcitec commented Nov 27, 2019

You're welcome. Your extension looks great by the way.

Hmm. With Help - Show Developer Tools. I did it in the console there. Hmm. I really hope there is some way for extensions to access window. Although window is just used for guaranteed namespacing. In JS browsers, that prefix is optional. So try calling matchMedia without window. prefix.

Edit: I was reading up on extensions. Seems each runs in a Node subprocess without Electron. Hence no DOM and no Electron API. So it may actually currently be impossible to call matchMedia. If so, then at the very least, VSCode needs to expose that API for extensions. Hopefully there is some way, though. And of course there is talk about adding the feature to VSCode itself.

Edit2: Oh no. The main thread I linked to now has confirmation that only core code can access the two APIs. There is talk of adding switching to core. I hope they also expose matchMedia or at least the dark mode check for extensions. Let's keep watching the discussion.

Edit3: Oh, you got involved and offered to help them. Awesome! <3

@Arcitec
Copy link
Author

Arcitec commented Dec 8, 2019

Hi again @muuvmuuv, the vscode ticket has died after your post ten days ago. What are your current plans? Could you share your plans with the official ticket, or if you don't have time, let them know so someone else can work on it. :-)

@muuvmuuv
Copy link
Owner

muuvmuuv commented Dec 9, 2019

As I'm planning to expose an API to VS Code that sends the preferred scheme or a getter which returns it. I'll change the purpose of this issue a little:

@muuvmuuv muuvmuuv changed the title [FEATURE] Use CSS media query to detect system theme or native electron API [FEATURE] Use future Code API to detect preferred scheme Dec 9, 2019
@Arcitec
Copy link
Author

Arcitec commented Dec 9, 2019

That's great news. I replied in the vscode discussion. :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request external good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants