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?
Post
Replies
Boosts
Views
Activity
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:
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?
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
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)
				}
		}
}
Is there any function that returns when the user hits enter on the safari address bar? Is there any way to tell where the user searched using the address bar. I am trying to implement this in a Safari App Extension.
I have macOS Catalina 10.15.7 and Safari 14. I am trying to convert a chrome extension. However I get the error:
Unable to parse manifest.json at file:///...