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

Light/dark images parameter in dropdown menu #399

Open
eu81273 opened this issue Jan 2, 2024 · 0 comments
Open

Light/dark images parameter in dropdown menu #399

eu81273 opened this issue Jan 2, 2024 · 0 comments

Comments

@eu81273
Copy link
Contributor

eu81273 commented Jan 2, 2024

I submitted PR #395 and it's been merged. However, I overlooked the fact that the image parameter can also be used in the dropdown menu.

Currently, the selection of the light/dark image in the image parameter depends on the appearance of the macOS menu bar (related to wallpaper color tone). However, in the dropdown menu, it should be determined by the macOS appearance (dark mode/light mode).

Here's an example of the issue:
스크린샷 2024-01-02 오전 1 55 00
macOS menu bar appearance: dark
macOS appearance: light

As you can see, the image parameter of the header works as expected; it selected the light image because the macOS menu bar appearance is dark. However, the image parameter of the dropdown menu is not working correctly. It should select the dark image instead of the light image.

The solution I have in mind is as follows: To MenuLineParameters, pass the information about whether it is a header. If it's not a header, modify the logic to select the image based on AppShared.isDarkTheme instead. Alternatively, provide the OS_MENU_BAR_APPEARANCE environment variable (though I'm unsure about the implementation details for this).

To address this issue, I attempted to add the OS_MENU_BAR_APPEARANCE environment variable related to the macOS menu bar appearance. If there is an OS_MENU_BAR_APPEARANCE environment variable, I thought it would be a better approach as it allows us to reference this variable without relying on the light/dark image feature. This way, we can appropriately display the desired image based on the value of this environment variable.

However, the logic below that retrieves the macOS menu bar appearance had to run on the main thread, making it a bit challenging.

public static var isDarkStatusBar: Bool {
    let currentAppearance = NSStatusBar.system.statusItem(withLength: NSStatusItem.squareLength).button?.effectiveAppearance
    return currentAppearance?.bestMatch(from: [.aqua, .darkAqua]) == .aqua
}

If you tell me the solution, I will try to create a PR.

@eu81273 eu81273 changed the title Unexpected behavior of light/dark images parameter in dropdown menu light/dark images parameter in dropdown menu Jan 3, 2024
@eu81273 eu81273 changed the title light/dark images parameter in dropdown menu Light/dark images parameter in dropdown menu Jan 3, 2024
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

No branches or pull requests

1 participant