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

No more hacks! #2

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

No more hacks! #2

Arcitec opened this issue Nov 26, 2019 · 3 comments
Labels
question Further information is requested

Comments

@Arcitec
Copy link

Arcitec commented Nov 26, 2019

Hey man, nice work on the extension. But the .bat file and registry reading are ugly hacks that are no longer necessary. :-)

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 code and replace it with this. :-)

@danielgjackson
Copy link
Owner

Hi,

The extension actually uses an executable (from wait-registry.c) to efficiently watch for a registry change -- that hacky batch file would only get used as a fallback if the user deleted the executable!

Thanks for the matchMedia tip -- unfortunately, VS Code doesn't seem to expose the underlying DOM/Window to extensions, so I don't think I've got access to the underlying 'window' object to call matchMedia on.

I would expect them to provide a proper event for this at some point, or even just implement this functionality natively!

@danielgjackson danielgjackson added the question Further information is requested label Nov 27, 2019
@Arcitec
Copy link
Author

Arcitec commented Nov 27, 2019

Ahh, so it's not as inefficient as it looked!

As for the function, yeah I found out that Extensions cannot see the DOM or Electron APIs. There is now talk of adding the APIs for extensions. So subscribe to the discussion I linked to find out when it will be available. :-)

@danielgjackson
Copy link
Owner

I'll close this issue for now, as nothing can be done just yet -- but I'll keep an eye out for updates in this area. Although I expect the functionality will just make its way into VS Code and we won't need this extension at all in the long run!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants