From eca3d1680e19cd0f865fa9ec3bb58391df059a6d Mon Sep 17 00:00:00 2001 From: spike Date: Thu, 9 Oct 2025 17:03:54 +0800 Subject: [PATCH] fix: support Dia browser in Browser Rules MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Browser Rules UI hides toggles until NSApplication.isBrowserInstalled returns true. That helper only checks LaunchServices’ “html/https handler” set, and Dia isn’t registered there yet, so it never appeared. This patch lets isBrowserApp fall back to our Browser enum: if the bundle id is one we support and NSWorkspace.shared.urlForApplication confirms the app exists, I treat it as installed. The change unlocks the Dia toggle without affecting existing browsers, because they still match the LaunchServices branch first. --- .../Utilities/AppKit/NSApplication.swift | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Input Source Pro/Utilities/AppKit/NSApplication.swift b/Input Source Pro/Utilities/AppKit/NSApplication.swift index 3fdef22..8e1c71d 100644 --- a/Input Source Pro/Utilities/AppKit/NSApplication.swift +++ b/Input Source Pro/Utilities/AppKit/NSApplication.swift @@ -76,7 +76,17 @@ extension NSApplication { static func isBrowserApp(_ bundleIdentifier: String?) -> Bool { guard let bundleIdentifier = bundleIdentifier else { return false } - return browserAppIdentifier.contains(bundleIdentifier) + if browserAppIdentifier.contains(bundleIdentifier) { + return true + } + + if Browser(rawValue: bundleIdentifier) != nil, + NSWorkspace.shared.urlForApplication(withBundleIdentifier: bundleIdentifier) != nil + { + return true + } + + return false } static func isBrowserInstalled(_ bundleIdentifier: String) -> Bool {