p0deje / Maccy

Lightweight clipboard manager for macOS
https://maccy.app
MIT License
13.11k stars 551 forks source link

Context menu not respecting dark mode #20

Closed yougotwill closed 5 years ago

yougotwill commented 5 years ago

Firstly, thanks for the hard work making this app. It suits my daily needs perfectly! As seen in the title the context menu doesn't respect dark mode.

I attempted to see if this could be solved easily using

defaults write org.p0deje.Maccy NSRequiresAquaSystemAppearance 0

which was something I learned about on the Sublime Text forums. Unfortunately this didn't fix the issue. I don't know enough about Swift to do a PR but if I can help in anyway let me know. :)

Screenshot 2019-08-08 at 10 22 48
yougotwill commented 5 years ago

From some googling this should be the right direction to solving this issue https://developer.apple.com/documentation/appkit/nsappearancecustomization/choosing_a_specific_appearance_for_your_macos_app

p0deje commented 5 years ago

Frankly, this is a bug in macOS which I reported about a year ago to Apple. I don't know how to reference a link to it, but here is a screenshot:

Screenshot 2019-08-13 at 08 17 11

They say it will be fixed in macOS 10.15 (since beta1 19A471t), but I have not verified it yet.

yougotwill commented 5 years ago

Ok got it thanks @p0deje! Hopefully it will be resolved by apple in future.

curthard89 commented 5 years ago

I believe you can listen for the system change and manually set the NSApp's appearance at app level to that new value, this should update the menus...

NSDistributedNotificationCenter * dnc = NSDistributedNotificationCenter.defaultCenter; [dnc addObserver:self selector:@selector(systemThemeDidChange:) name:@"AppleInterfaceThemeChangedNotification" object:nil];

then in systemThemeDidChange: can simply force NSApp's appearance to what the new system one is, seems to fix various bugs.

p0deje commented 5 years ago

@curthard89 I don't actually control or listen to appearance change as I merely use NSMenu and its view handles the appearance bu itself. The only approach to overcome this issue is to actually replace NSMenu with a custom implementation which is too much IMO.

curthard89 commented 5 years ago

Hmm, that annoying, another possible way to force it, is to just put a custom NSMenuItem with a view, grab the views window and then set that windows appearance, sketchy but doable :)

p0deje commented 5 years ago

@curthard89 I'm not sure how to do properly that and I'm not sure that setting windows appearance will actually draw menu with dark mode. I'll be happy to merge a PR adding this though :)

artginzburg commented 5 years ago

Seems to be fixed in macOS10.15 Catalina.

p0deje commented 5 years ago

Cool, then I'm going to close it, though I haven't updated yet :)