-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Desktop: Add support for file associations #773
Labels
Comments
zhelenskiy
added a commit
to zhelenskiy/compose-multiplatform
that referenced
this issue
Jun 6, 2024
[Desktop: Add support for file associations](JetBrains#773)
Merged
zhelenskiy
added a commit
to zhelenskiy/compose-multiplatform
that referenced
this issue
Jun 12, 2024
[Desktop: Add support for file associations](JetBrains#773)
zhelenskiy
added a commit
to zhelenskiy/compose-multiplatform
that referenced
this issue
Jun 20, 2024
[Desktop: Add support for file associations](JetBrains#773)
zhelenskiy
added a commit
to zhelenskiy/compose-multiplatform
that referenced
this issue
Jun 21, 2024
[Desktop: Add support for file associations](JetBrains#773)
zhelenskiy
added a commit
to zhelenskiy/compose-multiplatform
that referenced
this issue
Jun 21, 2024
[Desktop: Add support for file associations](JetBrains#773)
zhelenskiy
added a commit
to zhelenskiy/compose-multiplatform
that referenced
this issue
Jun 22, 2024
[Desktop: Add support for file associations](JetBrains#773)
zhelenskiy
added a commit
to zhelenskiy/compose-multiplatform
that referenced
this issue
Jul 1, 2024
[Desktop: Add support for file associations](JetBrains#773)
zhelenskiy
added a commit
to zhelenskiy/compose-multiplatform
that referenced
this issue
Jul 1, 2024
[Desktop: Add support for file associations](JetBrains#773)
zhelenskiy
added a commit
to zhelenskiy/compose-multiplatform
that referenced
this issue
Jul 1, 2024
[Desktop: Add support for file associations](JetBrains#773)
zhelenskiy
added a commit
to zhelenskiy/compose-multiplatform
that referenced
this issue
Jul 1, 2024
terrakok
pushed a commit
that referenced
this issue
Jul 2, 2024
Add file associations support to Compose Desktop <!-- Optional --> Fixes #773 ## Testing Tested on the [sample project](https://github.com/zhelenskiy/file-associations-demo). Behaviours per OSs: - MacOS Sonoma: associations work for distributables. - Windows 11: associations work after the installation of the MSI. - Kubuntu: associations do not work, but everything else works fine. However, IDEA also does not have associations there, so I assume this is fine. I didn't write any unit tests because I don’t know which of them you are expecting me to write. So, I'm looking forward to your feedback and suggestions. <!-- Optional --> This should be tested by QA ## Release Notes <!-- Optional, if omitted - won't be included in the changelog Sections: - Highlights - Known issues - Breaking changes - Features - Fixes Subsections: - Multiple Platforms - iOS - Desktop - Web - Resources - Gradle Plugin --> ### Highlight - Desktop - Introduction of the new DSL function in `nativeDistributions` block: ```kotlin fun fileAssociation(mimeType: String, extension: String, description: String): Unit ```
igordmn
pushed a commit
that referenced
this issue
Jul 2, 2024
Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks. |
@okushnikov The integration didn't import mentions. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Feature Request
The current desktop packaging tasks do not include options for setting up file associations, a particularly valuable feature for desktop apps.
Possible Workaround
The
AbstractJPackageTask
allows us to add custom args with thefreeArgs
property, which get passed-through directly tojpackage
. So to add our file associations, we should be able to follow the documentation linked above and manually add the args we need.macOS Problems
The above workaround does not seem to work on macOS (I have not tried it on other OSs). macOS handles file associations differently than Windows or Linux, and has a particularly verbose "registration" process that involves adding a bunch of additional information to the package's
Info.plist
file. Normally,jpackage
would add all this info to theInfo.plist
file itself in accordance with the--file-associations
property, but the Compose for Desktop Gradle plugin is writing that file itself. This means that even if we add those flags manually using thefreeArgs
property, the application will still not be registered to open custom file types, because the Compose Gradle plugin is not adding the necessary properties to the plist it writes.In addition, the CfD plugin adds
freeArgs
before it configures itself, and it specifies--resource-dir
for its own use when writing theInfo.plist
, so we cannot provide our own resource dir to write the plist by hand ourselves either.Solution
Rather than writing the
Info.plist
file within the CfD Gradle plugin, it should letjpackage
do it.Potential Issues
There may already be info CfD is manually adding to
Info.plist
thatjpackage
is not adding (which may have been the reason for manually writing it in the first place). Removing the step to manually write the plist may cause issues with some of the existing Gradle plugin properties, and deeper research into customizingjpackage
usage or other workarounds may need to be added to fully support them.The text was updated successfully, but these errors were encountered: