https://kotlinlang.org logo
#compose-desktop
Title
# compose-desktop
a

Alex Styl

12/01/2023, 7:21 AM
was anyone able to right click file a file on their mac desktop and share with their compose desktop app? if yes, any pointers?
👀 4
a

Arjan van Wieringen

12/02/2023, 5:39 PM
You mean “open in…”? How is that dependent on Compose?
a

Alex Styl

12/03/2023, 4:04 AM
Nope. I am trying to figure out how to add my app to the 'share to' menu like this screenshot
a

Arjan van Wieringen

12/03/2023, 7:07 AM
Okay but that is not specific to Compose right? I believe it is related to the Application Registration: https://stackoverflow.com/questions/7959956/mac-how-to-assign-a-file-extension-to-be-opened-with-my-java-app-application
According to ChatGPT: To add your Java application to the Finder “Share” menu on macOS, you’ll need to create a macOS service that calls your Java application. This involves using Automator to create the service and integrating your Java application within it. Here’s a step-by-step guide: a. Create a macOS Service with Automator: • Open Automator (found in the Applications folder). • Choose to create a new “Service” (or “Quick Action” in newer macOS versions). • In the service settings at the top, set “Service receives” to “files or folders” and “in” to “Finder.” a. Add a Run Shell Script Action: • Drag the “Run Shell Script” action into the workflow. • Set “Pass input” to “as arguments.” • In the script area, you’ll need to write a shell script that launches your Java application. This typically involves calling the java command with the path to your Java application’s executable JAR file or class files. Example script: /usr/bin/java -jar /path/to/your/java-application.jar "$@" a. Replace /path/to/your/java-application.jar with the actual path to your Java application. b. Save the Service: • Save your new service with an appropriate name. This name is what will appear in the Finder “Share” menu. a. Test the Service: • Go to Finder, right-click on a file or folder, navigate to the “Share” menu, and you should see your new service listed there. Click it to test if it launches your Java application as expected. a. Troubleshooting: • If the service doesn’t work as expected, ensure that your Java application can be executed from the command line and that the path in the script is correct. • Remember that Java applications may require specific runtime environments or dependencies. Ensure these are appropriately configured on the system where you intend to use the service. a. Optional Steps: • You may need to adjust your Java application to handle input files or arguments passed by the service. This method allows you to integrate Java applications or other scripts into the macOS Finder context menus, providing a seamless user experience.
m

Michael Paus

12/03/2023, 10:19 AM
To my opinion this ChatGPT answer is misleading and handles a different use case but I am not a native macOS developer and so I cannot answer this question. My guess would be that a bundled application can somehow register itself for this service and the technical means could be the same notification mechanism that is used to open files by double-clicking them in the finder.
👍 1
a

Alex Styl

12/04/2023, 10:44 AM
+1 to what Michael mentioned. I was under the impression Compose Desktop was not just a UI framework as there are docs about signing and distributing, So I guess this is not the best place to ask this kind of questions.
3 Views