GithubHelp home page GithubHelp logo

Comments (6)

allenhumphreys avatar allenhumphreys commented on May 28, 2024

We'll probably want to wait a bit on the beta issues. Menus were rebuilt using AppKit in Sonoma, there's bound to be issues that get resolved during the beta process! Could you close this issue until the RCs become available at least?

from wwdc.

casperriboe avatar casperriboe commented on May 28, 2024

We'll probably want to wait a bit on the beta issues. Menus were rebuilt using AppKit in Sonoma, there's bound to be issues that get resolved during the beta process! Could you close this issue until the RCs become available at least?

I wasn't actually aware of those AppKit changes, that's nice to know. I just checked my other OS and this also happen in Ventura 13.4.

from wwdc.

allenhumphreys avatar allenhumphreys commented on May 28, 2024

This seems to be related to dark/light mode. I did a little looking, we're using the system sharing picker, nothing special. We do override the app's appearance to be dark. It seems the font in the sharing menu is not honoring the appearance while the background is. Whether there is anything we can do about it would require setting up a blank Mac app and minimally reproduce it. If the bug exists in a standard app, I'd say the only option would be to file a feedback. If it doesn't reproduce in a basic app, then more digging would be required.

The relevant code starts at https://github.com/insidegui/WWDC/blob/master/WWDC/AppCoordinator%2BSessionActions.swift#L153-L164 and it invokes the system share sheet which has a delegate

Screenshot 2023-06-07 at 11 02 21 AM

from wwdc.

allenhumphreys avatar allenhumphreys commented on May 28, 2024

Gonna leave this here, not sure if we'll do it, but I was able to hack the pop over window to override it's appearance with reasonable results:

NotificationCenter.default.publisher(for: NSApplication.willUpdateNotification).sink { note in
    guard let windows = (note.object as? NSApplication)?.windows else { return }
    windows.filter { window in
        guard let popOverClass = NSClassFromString("_NSPopoverWindow") else { return false }
        guard let shareSheetViewControllerClass = NSClassFromString("SHKShareSheetRemoteViewController") else { return false }
        return window.isKind(of: popOverClass) && window.contentViewController?.isKind(of: shareSheetViewControllerClass) == true
    }
    .forEach {
        $0.appearance = NSAppearance(named: .darkAqua)
    }
}.store(in: &self.cancellables)

from wwdc.

insidegui avatar insidegui commented on May 28, 2024

@allenhumphreys I set up a blank project and was able to reproduce the issue, so it's definitely feedback-worthy. The contents of the sharing popover are rendered out-of-process, so there's probably some weird AppKit/ViewBridge bug that's causing the app's appearance propagation to fail.

I tried a few alternatives to your solution, including subclassing NSApplication and overriding effectiveAppearance, but that didn't work either.

from wwdc.

insidegui avatar insidegui commented on May 28, 2024

Here's another potential solution that covers all popovers in the app (since we definitely want all poppers to inherit the dark appearance):

@objcMembers final class DarkPopover: NSWindow {
    static var darkAppearance: NSAppearance? { NSAppearance(named: .darkAqua) }

    static func install() {
        guard let target = NSClassFromString("_NSPopoverWindow") else { return }
        guard let original = class_getInstanceMethod(target, #selector(getter: NSWindow.appearance)) else { return }
        guard let replacement = class_getClassMethod(DarkPopover.self, #selector(getter: DarkPopover.darkAppearance)) else { return }

        method_exchangeImplementations(original, replacement)
    }
}

from wwdc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.