I would also love to be able to open the popover programmatically whent he Action is set to "Command".
I have a list of supported URLs that my extension injects Scripts, which inject HTML and the Toolbar Item controls some functionality. But on non-whitelisted sites the popover can't do anything.
I struggled to find an API that could load the popover view from the SafariExtensionHandler.
Have you ever found a solution for 2: Closing popover programmatically? I have the same issue and am too unsuccessful.
Hello? Any news on this? Are Safari extensions dead now or what is the matter?
I might be wrong; but far as I know, both 1 and 2 (the possibility to control the pop-over programmatically) were debated before and the widely shared conclusion is that with the current Apple APIs both of them are impossible.
No idea of 3 at the moment.
1) This is not currently possible.
Can you explain why you'd like both a Command and Popover? In the case of your extension, would the user know if a click was going to open the popover or dispatch a command?
2) We are working on an API for this and hope to have it available for extensions soon.
3) The recommended place for extension settings is in the host app. What kind of settings are you looking to add?
I can't speak for esellier, but we do have a similar case ourselves.
Our extension's services depend on its container application (which is essentially a data server for the extension, with some extra GUI). The services provided by the popover are available only if the container is running (and the user is logged into it).
We would prefer
(a) if the toolbar icon presented the current state of our application;
(b) if the container does not run at all, if a click to the toolbar icon launched it;
(c) if the container runs, but the user is not logged in, if a click to the toolbar icon opened a login panel in the app;
(d) if the container runs and the user is logged in, if a click to the toolbar icon opened the pop-over (whose contents then communicates further with the container through the extension).
For the moment and with the current APIs, we more-or-less can do (a), although there's a problem with reflecting the changes when the extension process is not running (compare please the “Keep the extension alive for awhile?” thread: https://forums.developer.apple.com/thread/110979).
Nevertheless, we can't achieve (b)-(d). Our current work-around is to have a pop-over containing just the “Launch” or “Login” button for (b)/(c); that's rather ugly and sub-optimal.
There are other problems with this approach, too: e.g., if the container application quits or the user logs out while the pop-over is open, we must dynamically switch its contents (to the Launch/Login button) — that leads to pretty ugly extension design. The proper design would be to use two or three different popover view controllers for different cases; but we can't, for we can't close the popover nor switch its current controller if the conditions change whilst the popover is open.
Thanks a lot,