Implement file association Open a file from Finder/Explorer (#2918)

* implement MacOS openFile/openFiles events

* wip: windows file association

* fix macro import

* add file icon copy

* try copy icon

* keep only required part of scripts

* update config schema

* fix json

* set fileAssociation for mac via config

* proper iconName handling

* add fileAssociation icon generator

* fix file association icons bundle

* don't break compatibility

* remove mimeType as not supported linux for now

* add documentation

* adjust config schema

* restore formatting

* remove unused option in file association

* get rid of openFiles mac os. change configuration structure

* remove unused channel

* fix documentation

* fix typo

---------

Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
This commit is contained in:
Andrey Pshenkin
2023-10-22 06:44:38 +11:00
committed by GitHub
co-authored by Lea Anthony
parent 42708e7f40
commit 6c46f6b41c
13 changed files with 493 additions and 62 deletions
+127 -31
View File
@@ -72,10 +72,17 @@
"frontend:dev:serverUrl": {
"type": "string",
"description": "URL to a 3rd party dev server to be used to serve assets (eg. Vite). If this is set to 'auto', then the devServerUrl will be inferred from the Vite output",
"examples": [ "auto", "http://localhost:3000" ],
"examples": [
"auto",
"http://localhost:3000"
],
"oneOf": [
{ "format": "uri" },
{ "const": "auto" }
{
"format": "uri"
},
{
"const": "auto"
}
]
},
"wailsjsdir": {
@@ -87,7 +94,9 @@
"version": {
"description": "Project config version",
"default": "2",
"enum": [ "2" ]
"enum": [
"2"
]
},
"outputfilename": {
"type": "string",
@@ -123,7 +132,9 @@
"type": "object",
"description": "The application author",
"properties": {
"name": { "type": "string" },
"name": {
"type": "string"
},
"email": {
"type": "string",
"format": "email"
@@ -156,6 +167,39 @@
"type": "string",
"description": "A short comment for the app",
"default": "Built using Wails (https://wails.io)"
},
"fileAssociations": {
"type": "array",
"description": "File associations for the app",
"items": {
"type": "object",
"properties": {
"ext": {
"type": "string",
"description": "The extension (minus the leading period). e.g. png"
},
"name": {
"type": "string",
"description": "The name. e.g. PNG File"
},
"description": {
"type": "string",
"description": "Windows-only. The description. It is displayed on the `Type` column on Windows Explorer."
},
"iconName": {
"type": "string",
"description": "The icon name without extension. Icons should be located in build folder. Proper icons will be generated from .png file for both macOS and Windows)"
},
"role": {
"description": "macOS-only. The apps role with respect to the type. Corresponds to CFBundleTypeRole.",
"allOf": [
{
"$ref": "#/definitions/BundleTypeRole"
}
]
}
}
}
}
}
},
@@ -185,7 +229,9 @@
}
},
"dependencies": {
"garbleargs": ["obfuscated"]
"garbleargs": [
"obfuscated"
]
},
"definitions": {
"OsHook": {
@@ -203,11 +249,21 @@
"description": "Build hooks for different targets.",
"additionalProperties": false,
"properties": {
"{GOOS}/{GOARCH}": { "$ref": "#/definitions/OsArchHook" },
"{GOOS}/*": { "$ref": "#/definitions/OsHook" },
"windows/*": { "$ref": "#/definitions/OsHook" },
"linux/*": { "$ref": "#/definitions/OsHook" },
"darwin/*": { "$ref": "#/definitions/OsHook" },
"{GOOS}/{GOARCH}": {
"$ref": "#/definitions/OsArchHook"
},
"{GOOS}/*": {
"$ref": "#/definitions/OsHook"
},
"windows/*": {
"$ref": "#/definitions/OsHook"
},
"linux/*": {
"$ref": "#/definitions/OsHook"
},
"darwin/*": {
"$ref": "#/definitions/OsHook"
},
"*/*": {
"type": "string",
"description": "Executed at build level before/after a build"
@@ -225,26 +281,66 @@
"description": "Executed at build level before/after a build of the specific platform"
}
}
},
"BundleTypeRole": {
"description": "macOS-only. Corresponds to CFBundleTypeRole",
"oneOf": [
{
"description": "CFBundleTypeRole.Editor. Files can be read and edited.",
"type": "string",
"enum": [
"Editor"
]
},
{
"description": "CFBundleTypeRole.Viewer. Files can be read.",
"type": "string",
"enum": [
"Viewer"
]
},
{
"description": "CFBundleTypeRole.Shell",
"type": "string",
"enum": [
"Shell"
]
},
{
"description": "CFBundleTypeRole.QLGenerator",
"type": "string",
"enum": [
"QLGenerator"
]
},
{
"description": "CFBundleTypeRole.None",
"type": "string",
"enum": [
"None"
]
}
]
}
},
"bindings": {
"type": "object",
"description": "Bindings configurations",
"properties": {
"ts_generation": {
"type": "object",
"description": "model.ts file generation config",
"properties": {
"prefix": {
"type": "string",
"description": "All generated JavaScript entities will be prefixed with this value"
},
"suffix": {
"type": "string",
"description": "All generated JavaScript entities will be suffixed with this value"
}
}
}
}
}
"bindings": {
"type": "object",
"description": "Bindings configurations",
"properties": {
"ts_generation": {
"type": "object",
"description": "model.ts file generation config",
"properties": {
"prefix": {
"type": "string",
"description": "All generated JavaScript entities will be prefixed with this value"
},
"suffix": {
"type": "string",
"description": "All generated JavaScript entities will be suffixed with this value"
}
}
}
}
}
}