Post

Replies

Boosts

Views

Activity

Safari App Extension remove toolbar item - Mac
Hi, I have built a Safari App Extension for Mac. However, I want to remove the toolbar item from the extension. I have tried the following approach: Remove SFSafariToolbarItem dictionary from Info.plist Remove the toolbar icon pdf from the project Remove validateToolbarItem and popoverViewController from the extension handler. This does not remove the toolbar item. Instead I have a toolbar item that shows my App Icon just greyed out. On clicking that item, it show an option to "Manage Extension". What should I do to remove the toolbar item from my extension?
1
0
517
Jun ’24
Safari App Extension toolbar item greyed (but enabled) at Start page
I was wondering if it's possible to not have my safari app extension's toolbar item greyed out at the start page. I have allowed my app extension to run on all the websites (image attached). But still my app extension's toolbar item is greyed out at the start page (it is enabled though, as the the popover does open up when i click on the greyed out toolbar item on the start page). Is there any way to show my toolbar item in colour even on the Start page? Allowing on all domains: Coloured icon on all websites: Greyed (but enabled) icon on the Start Page:
0
0
527
Feb ’22
Charging resetting a singleton flag in the app extension?
My SingletonHelper class reads as: class SingletonHelper : NSObject{ private override init(){} static let shared = SingletonHelper() var firstRunFlag = true } And the messageReceived() in my SafariExtensionHandler class reads as: if SingletonHelper.shared.firstRunFlag == true{ NSWorkspace.shared.open(url) SingletonHelper.shared.firstRunFlag = false } Ideally, the url would have opened up whenever the user opens Safari after right-clicking and quitting Safari. However, for some reason, it also opens up when I connect and disconnect my charging cable. Why is connecting and disconnecting the cable resetting the firstRunFlag?
2
0
438
Feb ’21
Safari Web Extension running slow
So I created a Safari Web Extension. I did not change any piece of code and ran the template code provided by Xcode. I clicked on the toolbar item and a blank popover window popped up. It took around a good 5 seconds to load the "Hello World!" screen (It is the screen that is the part of the template Xcode provides). After that, whenever I again clicked on the toolbar item, the "Hello World!" screen popped up immediately, but Safari did not respond until around another 5 seconds. Is this a bug on related to Safari or am I missing something? I am using Xcode 12.2 and Safari 14.0.1
6
0
1.5k
Dec ’20
Terminate an app once Safari Preferences has loaded(Swift. MacOS.)
I have a button on click of which Safari Preferences should load. Once Safari Preferences has loaded, I want my apllication to get terminated. But the following code does not wait for the Safari Preferences to get loaded before terminating the app. How do I fix this? @IBAction func openSafariExtensionPreferences(_ sender: AnyObject?) { SFSafariApplication.showPreferencesForExtension(withIdentifier: extensionBundleIdentifier) { [self] error in 				guard error == nil else { 						self.alert(title: "Error", message: "Safari preferences could not be opened.", buttonText: "Okay") 						return 				} 				DispatchQueue.main.async { 				safariPreferencesButton.isEnabled = false 				NSApplication.shared.terminate(nil) 				} 		} }
0
0
282
Nov ’20