Skip to content

Commit

Permalink
Add file associations support documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
zhelenskiy committed Jul 1, 2024
1 parent fc90219 commit fe6dd1e
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions tutorials/Native_distributions_and_local_execution/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,60 @@ compose.desktop {
}
```

## File associations

File associations can be added with `fileAssociation` function.
These associations can optionally include custom icons.
Similar to [app icon](#app-icon), these custom icons also have OS-specific formats: `.icns` for macOS, `.ico` for Windows and `.png` for Linux.

It is possible to specify both OS-specific and OS-agnostic file associations.
For OS-agnostic you can specify icon files for all three OSes in-place,
while for OS-specific there is a shorthand with a single icon file parameter.

```kotlin
compose.desktop {
application {
mainClass = "MainKt"

nativeDistributions {
targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb)

packageName = "file-associations-demo"
packageVersion = "1.0.0"

macOS {
fileAssociation(
mimeType = "text/kotlin",
extension = "kott",
description = "Kotlin Source File",
iconFile = project.file("Kotlin_icon_big.icns"),
)
fileAssociation(
mimeType = "text/kotlin",
extension = "ko",
description = "Kotlin Source File",
)
}

fileAssociation(
mimeType = "text/kotlin",
extension = "kot",
description = "Kotlin Source File",
macOSIconFile = project.file("Kotlin_icon_big.icns"),
windowsIconFile = project.file("Kotlin_icon_big.ico"),
linuxIconFile = project.file("Kotlin_icon_big.png"),
)

fileAssociation(
mimeType = "text/kotlin",
extension = "kottt",
description = "Kotlin Source File",
)
}
}
}
```

## Customizing Info.plist on macOS

We aim to support important platform-specific customization use-cases via declarative DSL.
Expand Down

0 comments on commit fe6dd1e

Please sign in to comment.