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

Dark mode support for macOS & Windows #1048

Merged
merged 8 commits into from
Feb 23, 2023
Merged

Dark mode support for macOS & Windows #1048

merged 8 commits into from
Feb 23, 2023

Conversation

seejdev
Copy link
Contributor

@seejdev seejdev commented Feb 21, 2023

This PR adds functionality to:

  • Set the menu bar icon to dark versions when dark mode is detected on either macOS or Windows
  • On macOS, watch for OS notifications when the theme changes, and refresh the menu bar

@seejdev seejdev changed the title Dark mode support for macOS Dark mode support for macOS & Windows Feb 22, 2023
RebeccaMahany
RebeccaMahany previously approved these changes Feb 22, 2023
James-Pickett
James-Pickett previously approved these changes Feb 22, 2023
directionless
directionless previously approved these changes Feb 22, 2023
once.Do(watchTheme)
}

//export themeChanged
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does export mean here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah not sure if this is a Go idiom, but I meant to call out that this function is marked as extern, so it's callable from C code, and in a sense exported to C. I can remove if it's not clear, since Go has it's own concept of exporting symbols.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it's meant for humans, make a godoc style comment with more words :)

}
return monochromePng
return darkOrLight(darkPng, lightPng)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm okay with this, though I don't know if we want to default linux to monochrome.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The monochrome icons are effectively unused with this change, on Windows/macOS if we detect dark mode we will use those icons. On Linux, or in any situation where we can't successfully detect dark mode, we default to light mode.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm okay with that, but I'm wondering if we should default to monochrome when we can't tell. 🤷 okay to iterate

@seejdev seejdev merged commit 325e4f2 into kolide:main Feb 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants