Open Safari Extensions Preferences in macOS Catalyst - safari-extension

How am I supposed to open the Safari Extension Preferences window with the user click of a button in macOS Catalyst? It looks like the API is not available for Catalyst.

You could try with an AppleScript
tell application "Safari" to activate
tell application "System Events"
tell process "Safari"
keystroke "," using command down
click button 9 of toolbar 1 of window 1
end tell
end tell
The button 9 of the toolbar should be the extension panel
You could look in this answer to execute the AppleScript inside the code of your application
Can you execute an Applescript script from a Swift Application

Related

Debugging background scripts in safari extension

I am working on a custom Safari extension and would like to debug the Background scripts. I am not certain how to do this? Ideally, if there was a way to step into the background scripts, that would be great. But when I try to step into a background call, the Safari debugger just steps to the next line. The console.log within the background scripts do not get printed to the console (This is the console I launched from right clicking a popover that is part of the extension and then hitting inspect).
Any help on this would be great. Thank you.
This is an old question that asks about a different type of Safari extensions but I figured it could be helpful to add an updated answer now that Safari (v14) supports the Web Extensions API (similar to the API that all other major browsers use).
Debugging background scripts is now built into the Safari menu in the toolbar: "Develop" => "Web Extension Background Pages" => select your (enabled) extension. That should open the dev tools with all your background scripts where you can set breakpoints, check the network tab, etc..
As a side note, you can debug your extension's popup by opening it, right clicking the popup and clicking "Inspect Element".
In case this comes useful for someone - I figured out a way to view console statements in the background scripts. Open the extension builder and click on Inspect Global Page. Go to the console tab and the console.log messages in the background scripts will be printed in that console.
Now you can use Safari Preview to debug your Safari App Extension. There is a control to select the extension container at the lower-right corner of the console.

Handling the application in dock

I'm using Mac OSX 10.9. I made the settings in system preferences->Dock->select "Minimise windows into application icon". The desktop application(objective c) which i created opens a popup window on clicking a button. Once minimised that popup window to the dock i'm unable to maximise it again. Even i tried the function - (BOOL)applicationShouldHandleReopen. But its not responding.
Please help me to resolve it.
Thanks in advance

Create an execution file from Xcode mac project

I had created a mac app in Xcode, and i would like to create a file out of it , so that it will be a regular program on my mac, which i can run on startup , and send to other people.
I don't know if it has to be a .dmg , , or something else.
I have tried this link to do that, but the dmg is just a file that when i open, shows me the Xcode project and not run the app as like any other mac app :
Creating a .DMG (dbf answer and marc answer)
How do you create an app? a regular mac app from Xcode project ??
How do enable it to be open at startup as like any other app ?
EDIT
I can see lots of people just taking the .app from Xcode, to use as the desktop app . but for me, when i click this file .app . nothing is happens, (it open and than closed)
Thanks.
Open your project in Xcode.
In the "Products" folder on the left-hand side of the Xcode window, select .app
In the "Product" menu, select "Archive."
When Xcode has finished building your project, the Archive window will open.
On the right, near the top is an "Export..." button. Click it.
You have several options for creating your Archive. The last one is: Export as a Mac Application. That option will simply save your project as an ordinary Mac application. Click it.
You'll then be presented with a dialog in which you can select the destination folder for your application. Choose where you want your application saved, and click "Export."
In the "Finder" go to the same folder you just selected and your application will be there.
~~
To make your application open when you log into your account on your computer, open "System Preferences," select "Users & Groups," select the "Login Items" tab, click on the "+" button, find your application, click on the "Add" button.

Add Button On Safari And Execute Shell Command On button Click

I want to run a shell command from Button on Safari Browser. I have successfully added the button on safari browser using Safari Extension Program. Using that button I'm able to open a website in new tab. basically I want to use that button to run a tool on mac.
I have developed an mac application and want to run this application from the button on that safari browser. For that I need to run a shell command from the button.
Please help me I'm new in mac development and safari extension. My first question is: Is it possible to run a application on mac from the button on safari browser ?
If its possible am I join in right direction to execute that application from shell command which is run on button click ?
Is there any other way to do the same ?
Please help me . Thanks in advance.
You can create a server in node.js script and insert the code in it to run the command( to run that tool). Now call this url from button that you have added in safari browser.
Not very sure but may be use full for you.

How can I make IntelliJ/Android Studio open Android docs when clicking F1 on function?

Let's say I have the following line of Android code:
MyClass myClass = (MyClass) intent.getExtras().getSerializable("SomeKey");
How can I make IntelliJ/Android Studio open a browser and navigate to the following URI when hitting F1 while the cursor has marked "getSerializable"?
http://developer.android.com/reference/android/os/Bundle.html#getSerializable(java.lang.String)
Is there a plugin for this maybe?
Open up Project Structure window and then go to Libraries and point to the android jar:
Now press the green plus sign:
Choose the Specify Documentation URL... option:
Enter the Android SDK API url:
Press OK all the way back so you end up in the editor again. Now place the caret at the method and press Shift+F1:
The browser will open up and navigate to the correct page.
In my Android Studio 1.5.1 installation, the libraries are listed in the Structure View once I select my module from the Project View and select Android from the drop-down as shown in this link:
Click >> Project View and Project Structure View
Now right-clink on the library you want to add URL to and select Library Properties. A window will popup with a button Specify Documentation URL and you can paste your URL there.
Click >> Library Properties windows and Documentation URL popup
Now you can go to the code editor, select any element you want to see documentation for and press Shift+F1 and browser will open up with the corresponding URL.
Tested with Android Studio Bumblebee 2021.1.1
Select an Android SDK symbol (e.g. class name) and then...
Press Shift+F1 to open browser with External Documentation
Press Ctrl+Q to open a popup showing Quick Documentation