Skip to content

Commit

Permalink
add note about swift and macos 10.14.4+ (#160)
Browse files Browse the repository at this point in the history
  • Loading branch information
jaimergp authored Dec 11, 2023
1 parent 13d1c4d commit 0155ef1
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
21 changes: 19 additions & 2 deletions docs/source/defining-shortcuts.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,24 @@ Unix systems have the notion of MIME types, while Windows relies more on file na
files) placeholders to your command so the paths are passed adequately. If you are defining a new
MIME type, you must fill the `glob_patterns` field by mapping the new MIME type to the file
extensions you want to associate with it.
- On Windows, use `file_extensions`. Remember to add the `%1` or `%*` placeholders to your command
so the path of the opened file(s) is passed adequately.
- On macOS, use `CFBundleDocumentTypes`. Requires no placeholder. The opened document will be
automatically passed as a regular command-line argument. The file will be dispatched via events.
You need to define the `event_handler` field to define a logic that will forward the caught files
to your application (via sockets, API calls, inotify or any other inter-process communication
mechanism) The association happens via UTI strings (Uniform Type Identifiers). If you need UTIs
not defined by Apple, use the `UTImportedTypeDeclarations` field if they are provided by other
apps, or `UTExportedTypeDeclarations` if you are defining them yourself.
- On Windows, use `file_extensions`. Remember to add the `%1` or `%*` placeholders to your command
so the path of the opened file(s) is passed adequately.

:::{note}
On macOS, this feature uses an additional launcher written in Swift to handle the Apple events.
The Swift runtime libraries are only guaranteed to be available on macOS 10.14.4 and later.
If you need to support older versions of macOS, you will need to instruct your users to install
the Swift runtime libraries manually, available at https://support.apple.com/kb/DL1998.
You can add a dependency on `__osx>=10.14.4` on your conda package if you wish to enforce it.
:::


A multi-platform example:

Expand Down Expand Up @@ -144,6 +153,14 @@ shortcut.
communication mechanism). Note that setting `CFBundleTypeRole` will make the wrapper blip in the
dock when the URL is opened. If you don't want that, do not set it.

:::{note}
On macOS, this feature uses an additional launcher written in Swift to handle the Apple events.
The Swift runtime libraries are only guaranteed to be available on macOS 10.14.4 and later.
If you need to support older versions of macOS, you will need to instruct your users to install
the Swift runtime libraries manually, available at https://support.apple.com/kb/DL1998.
You can add a dependency on `__osx>=10.14.4` on your conda package if you wish to enforce it.
:::

```json
{
"$schema": "https://json-schema.org/draft-07/schema",
Expand Down
5 changes: 3 additions & 2 deletions menuinst/_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,12 +270,12 @@ class UTTypeDeclarationModel(BaseModel):
CFBundleURLTypes: Optional[List[CFBundleURLTypesModel]] = None
"""
URL types supported by this app. Requires setting `event_handler` too.
Note this feature requires macOS 10.15+.
Note this feature requires macOS 10.14.4 or above.
"""
CFBundleDocumentTypes: Optional[List[CFBundleDocumentTypesModel]] = None
"""
Document types supported by this app. Requires setting `event_handler` too.
Requires macOS 10.15+.
Requires macOS 10.14.4 or above.
"""
LSApplicationCategoryType: Optional[constr(regex=r"^public\.app-category\.\S+$")] = None
"The App Store uses this string to determine the appropriate categorization."
Expand Down Expand Up @@ -317,6 +317,7 @@ class UTTypeDeclarationModel(BaseModel):
event_handler: Optional[constr(min_length=1)] = None
"""
Required shell script logic to handle opened URL payloads.
Note this feature requires macOS 10.14.4 or above.
"""


Expand Down

0 comments on commit 0155ef1

Please sign in to comment.