refactor: update permission identifiers and descriptions in windows-schema.json

- Changed permission identifiers from `shell` to `opener` for clarity.
- Updated descriptions to reflect new functionality for opening URLs and revealing items in directories.
- Removed deprecated permissions and added new autostart permissions in the schema.
- Adjusted the structure of allowed and denied entries for better organization.

feat: implement system tray functionality in lib.rs

- Added system tray support with show and quit options.
- Implemented event handling for tray icon clicks and menu interactions.
- Modified application run logic to minimize to tray on window close.
- Updated plugins to use `tauri_plugin_opener` instead of `tauri_plugin_shell`.
This commit is contained in:
2026-01-25 13:58:58 +11:00
parent 90fc67c805
commit 58626aa942
9 changed files with 426 additions and 418 deletions

2
cinny

Submodule cinny updated: 72ba2e200a...156dfcf397

145
src-tauri/Cargo.lock generated
View File

@@ -243,6 +243,17 @@ version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0"
[[package]]
name = "auto-launch"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1f012b8cc0c850f34117ec8252a44418f2e34a2cf501de89e29b241ae5f79471"
dependencies = [
"dirs 4.0.0",
"thiserror 1.0.69",
"winreg 0.10.1",
]
[[package]] [[package]]
name = "autocfg" name = "autocfg"
version = "1.5.0" version = "1.5.0"
@@ -764,13 +775,33 @@ dependencies = [
"crypto-common", "crypto-common",
] ]
[[package]]
name = "dirs"
version = "4.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ca3aa72a6f96ea37bbc5aa912f6788242832f75369bdfdadcb0e38423f100059"
dependencies = [
"dirs-sys 0.3.7",
]
[[package]] [[package]]
name = "dirs" name = "dirs"
version = "6.0.0" version = "6.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c3e8aa94d75141228480295a7d0e7feb620b1a5ad9f12bc40be62411e38cce4e" checksum = "c3e8aa94d75141228480295a7d0e7feb620b1a5ad9f12bc40be62411e38cce4e"
dependencies = [ dependencies = [
"dirs-sys", "dirs-sys 0.5.0",
]
[[package]]
name = "dirs-sys"
version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6"
dependencies = [
"libc",
"redox_users 0.4.6",
"winapi",
] ]
[[package]] [[package]]
@@ -781,7 +812,7 @@ checksum = "e01a3366d27ee9890022452ee61b2b63a67e6f13f58900b651ff5665f0bb1fab"
dependencies = [ dependencies = [
"libc", "libc",
"option-ext", "option-ext",
"redox_users", "redox_users 0.5.2",
"windows-sys 0.61.2", "windows-sys 0.61.2",
] ]
@@ -897,7 +928,7 @@ dependencies = [
"rustc_version", "rustc_version",
"toml 0.9.11+spec-1.1.0", "toml 0.9.11+spec-1.1.0",
"vswhom", "vswhom",
"winreg", "winreg 0.55.0",
] ]
[[package]] [[package]]
@@ -906,15 +937,6 @@ version = "1.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4ef6b89e5b37196644d8796de5268852ff179b44e96276cf4290264843743bb7" checksum = "4ef6b89e5b37196644d8796de5268852ff179b44e96276cf4290264843743bb7"
[[package]]
name = "encoding_rs"
version = "0.8.35"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3"
dependencies = [
"cfg-if",
]
[[package]] [[package]]
name = "endi" name = "endi"
version = "1.1.1" version = "1.1.1"
@@ -2665,10 +2687,11 @@ dependencies = [
"serde_json", "serde_json",
"tauri", "tauri",
"tauri-build", "tauri-build",
"tauri-plugin-autostart",
"tauri-plugin-deep-link", "tauri-plugin-deep-link",
"tauri-plugin-localhost", "tauri-plugin-localhost",
"tauri-plugin-notification", "tauri-plugin-notification",
"tauri-plugin-shell", "tauri-plugin-opener",
"tauri-plugin-single-instance", "tauri-plugin-single-instance",
"tauri-plugin-updater", "tauri-plugin-updater",
"tauri-plugin-window-state", "tauri-plugin-window-state",
@@ -3302,6 +3325,17 @@ dependencies = [
"bitflags 2.10.0", "bitflags 2.10.0",
] ]
[[package]]
name = "redox_users"
version = "0.4.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43"
dependencies = [
"getrandom 0.2.17",
"libredox",
"thiserror 1.0.69",
]
[[package]] [[package]]
name = "redox_users" name = "redox_users"
version = "0.5.2" version = "0.5.2"
@@ -3777,44 +3811,12 @@ dependencies = [
"digest", "digest",
] ]
[[package]]
name = "shared_child"
version = "1.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e362d9935bc50f019969e2f9ecd66786612daae13e8f277be7bfb66e8bed3f7"
dependencies = [
"libc",
"sigchld",
"windows-sys 0.60.2",
]
[[package]] [[package]]
name = "shlex" name = "shlex"
version = "1.3.0" version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
[[package]]
name = "sigchld"
version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "47106eded3c154e70176fc83df9737335c94ce22f821c32d17ed1db1f83badb1"
dependencies = [
"libc",
"os_pipe",
"signal-hook",
]
[[package]]
name = "signal-hook"
version = "0.3.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d881a16cf4426aa584979d30bd82cb33429027e42122b169753d6ef1085ed6e2"
dependencies = [
"libc",
"signal-hook-registry",
]
[[package]] [[package]]
name = "signal-hook-registry" name = "signal-hook-registry"
version = "1.4.8" version = "1.4.8"
@@ -4099,7 +4101,7 @@ dependencies = [
"anyhow", "anyhow",
"bytes", "bytes",
"cookie", "cookie",
"dirs", "dirs 6.0.0",
"dunce", "dunce",
"embed_plist", "embed_plist",
"getrandom 0.3.4", "getrandom 0.3.4",
@@ -4107,6 +4109,7 @@ dependencies = [
"gtk", "gtk",
"heck 0.5.0", "heck 0.5.0",
"http", "http",
"image",
"jni", "jni",
"libc", "libc",
"log", "log",
@@ -4149,7 +4152,7 @@ checksum = "17fcb8819fd16463512a12f531d44826ce566f486d7ccd211c9c8cebdaec4e08"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"cargo_toml", "cargo_toml",
"dirs", "dirs 6.0.0",
"glob", "glob",
"heck 0.5.0", "heck 0.5.0",
"json-patch", "json-patch",
@@ -4221,6 +4224,20 @@ dependencies = [
"walkdir", "walkdir",
] ]
[[package]]
name = "tauri-plugin-autostart"
version = "2.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "459383cebc193cdd03d1ba4acc40f2c408a7abce419d64bdcd2d745bc2886f70"
dependencies = [
"auto-launch",
"serde",
"serde_json",
"tauri",
"tauri-plugin",
"thiserror 2.0.18",
]
[[package]] [[package]]
name = "tauri-plugin-deep-link" name = "tauri-plugin-deep-link"
version = "2.4.6" version = "2.4.6"
@@ -4277,24 +4294,25 @@ dependencies = [
] ]
[[package]] [[package]]
name = "tauri-plugin-shell" name = "tauri-plugin-opener"
version = "2.3.4" version = "2.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "39b76f884a3937e04b631ffdc3be506088fa979369d25147361352f2f352e5ed" checksum = "fc624469b06f59f5a29f874bbc61a2ed737c0f9c23ef09855a292c389c42e83f"
dependencies = [ dependencies = [
"encoding_rs", "dunce",
"log", "glob",
"objc2-app-kit",
"objc2-foundation",
"open", "open",
"os_pipe",
"regex",
"schemars 0.8.22", "schemars 0.8.22",
"serde", "serde",
"serde_json", "serde_json",
"shared_child",
"tauri", "tauri",
"tauri-plugin", "tauri-plugin",
"thiserror 2.0.18", "thiserror 2.0.18",
"tokio", "url",
"windows",
"zbus",
] ]
[[package]] [[package]]
@@ -4319,7 +4337,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "27cbc31740f4d507712550694749572ec0e43bdd66992db7599b89fbfd6b167b" checksum = "27cbc31740f4d507712550694749572ec0e43bdd66992db7599b89fbfd6b167b"
dependencies = [ dependencies = [
"base64 0.22.1", "base64 0.22.1",
"dirs", "dirs 6.0.0",
"flate2", "flate2",
"futures-util", "futures-util",
"http", "http",
@@ -4843,7 +4861,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a5e85aa143ceb072062fc4d6356c1b520a51d636e7bc8e77ec94be3608e5e80c" checksum = "a5e85aa143ceb072062fc4d6356c1b520a51d636e7bc8e77ec94be3608e5e80c"
dependencies = [ dependencies = [
"crossbeam-channel", "crossbeam-channel",
"dirs", "dirs 6.0.0",
"libappindicator", "libappindicator",
"muda", "muda",
"objc2", "objc2",
@@ -5798,6 +5816,15 @@ dependencies = [
"memchr", "memchr",
] ]
[[package]]
name = "winreg"
version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d"
dependencies = [
"winapi",
]
[[package]] [[package]]
name = "winreg" name = "winreg"
version = "0.55.0" version = "0.55.0"
@@ -5848,7 +5875,7 @@ dependencies = [
"block2", "block2",
"cookie", "cookie",
"crossbeam-channel", "crossbeam-channel",
"dirs", "dirs 6.0.0",
"dpi", "dpi",
"dunce", "dunce",
"gdkx11", "gdkx11",

View File

@@ -21,8 +21,8 @@ tauri-build = { version = "2", features = [] }
[dependencies] [dependencies]
serde_json = "1.0" serde_json = "1.0"
serde = { version = "1.0", features = ["derive"] } serde = { version = "1.0", features = ["derive"] }
tauri = { version = "2", features = ["devtools"] } tauri = { version = "2", features = ["devtools", "tray-icon", "image-png"] }
tauri-plugin-shell = "2" tauri-plugin-opener = "2"
tauri-plugin-notification = "2" tauri-plugin-notification = "2"
[target."cfg(target_os = \"linux\")".dependencies] [target."cfg(target_os = \"linux\")".dependencies]
@@ -38,6 +38,7 @@ tauri-plugin-localhost = "2"
tauri-plugin-window-state = "2" tauri-plugin-window-state = "2"
tauri-plugin-single-instance = "2" tauri-plugin-single-instance = "2"
tauri-plugin-updater = "2" tauri-plugin-updater = "2"
tauri-plugin-autostart = "2"
[features] [features]
default = ["custom-protocol"] default = ["custom-protocol"]

View File

@@ -5,7 +5,8 @@
"windows": ["*"], "windows": ["*"],
"permissions": [ "permissions": [
"core:default", "core:default",
"shell:allow-open", "opener:default",
"notification:default" "notification:default",
"autostart:default"
] ]
} }

File diff suppressed because one or more lines are too long

View File

@@ -1 +1 @@
{"default":{"identifier":"default","description":"Default capability for all windows","local":true,"windows":["*"],"permissions":["core:default","shell:allow-open","notification:default"]}} {"default":{"identifier":"default","description":"Default capability for all windows","local":true,"windows":["*"],"permissions":["core:default","opener:default","notification:default","autostart:default"]}}

View File

@@ -140,70 +140,52 @@
"identifier": { "identifier": {
"anyOf": [ "anyOf": [
{ {
"description": "This permission set configures which\nshell functionality is exposed by default.\n\n#### Granted Permissions\n\nIt allows to use the `open` functionality with a reasonable\nscope pre-configured. It will allow opening `http(s)://`,\n`tel:` and `mailto:` links.\n\n#### This default permission set includes:\n\n- `allow-open`", "description": "This permission set allows opening `mailto:`, `tel:`, `https://` and `http://` urls using their default application\nas well as reveal file in directories using default file explorer\n#### This default permission set includes:\n\n- `allow-open-url`\n- `allow-reveal-item-in-dir`\n- `allow-default-urls`",
"type": "string", "type": "string",
"const": "shell:default", "const": "opener:default",
"markdownDescription": "This permission set configures which\nshell functionality is exposed by default.\n\n#### Granted Permissions\n\nIt allows to use the `open` functionality with a reasonable\nscope pre-configured. It will allow opening `http(s)://`,\n`tel:` and `mailto:` links.\n\n#### This default permission set includes:\n\n- `allow-open`" "markdownDescription": "This permission set allows opening `mailto:`, `tel:`, `https://` and `http://` urls using their default application\nas well as reveal file in directories using default file explorer\n#### This default permission set includes:\n\n- `allow-open-url`\n- `allow-reveal-item-in-dir`\n- `allow-default-urls`"
}, },
{ {
"description": "Enables the execute command without any pre-configured scope.", "description": "This enables opening `mailto:`, `tel:`, `https://` and `http://` urls using their default application.",
"type": "string", "type": "string",
"const": "shell:allow-execute", "const": "opener:allow-default-urls",
"markdownDescription": "Enables the execute command without any pre-configured scope." "markdownDescription": "This enables opening `mailto:`, `tel:`, `https://` and `http://` urls using their default application."
}, },
{ {
"description": "Enables the kill command without any pre-configured scope.", "description": "Enables the open_path command without any pre-configured scope.",
"type": "string", "type": "string",
"const": "shell:allow-kill", "const": "opener:allow-open-path",
"markdownDescription": "Enables the kill command without any pre-configured scope." "markdownDescription": "Enables the open_path command without any pre-configured scope."
}, },
{ {
"description": "Enables the open command without any pre-configured scope.", "description": "Enables the open_url command without any pre-configured scope.",
"type": "string", "type": "string",
"const": "shell:allow-open", "const": "opener:allow-open-url",
"markdownDescription": "Enables the open command without any pre-configured scope." "markdownDescription": "Enables the open_url command without any pre-configured scope."
}, },
{ {
"description": "Enables the spawn command without any pre-configured scope.", "description": "Enables the reveal_item_in_dir command without any pre-configured scope.",
"type": "string", "type": "string",
"const": "shell:allow-spawn", "const": "opener:allow-reveal-item-in-dir",
"markdownDescription": "Enables the spawn command without any pre-configured scope." "markdownDescription": "Enables the reveal_item_in_dir command without any pre-configured scope."
}, },
{ {
"description": "Enables the stdin_write command without any pre-configured scope.", "description": "Denies the open_path command without any pre-configured scope.",
"type": "string", "type": "string",
"const": "shell:allow-stdin-write", "const": "opener:deny-open-path",
"markdownDescription": "Enables the stdin_write command without any pre-configured scope." "markdownDescription": "Denies the open_path command without any pre-configured scope."
}, },
{ {
"description": "Denies the execute command without any pre-configured scope.", "description": "Denies the open_url command without any pre-configured scope.",
"type": "string", "type": "string",
"const": "shell:deny-execute", "const": "opener:deny-open-url",
"markdownDescription": "Denies the execute command without any pre-configured scope." "markdownDescription": "Denies the open_url command without any pre-configured scope."
}, },
{ {
"description": "Denies the kill command without any pre-configured scope.", "description": "Denies the reveal_item_in_dir command without any pre-configured scope.",
"type": "string", "type": "string",
"const": "shell:deny-kill", "const": "opener:deny-reveal-item-in-dir",
"markdownDescription": "Denies the kill command without any pre-configured scope." "markdownDescription": "Denies the reveal_item_in_dir command without any pre-configured scope."
},
{
"description": "Denies the open command without any pre-configured scope.",
"type": "string",
"const": "shell:deny-open",
"markdownDescription": "Denies the open command without any pre-configured scope."
},
{
"description": "Denies the spawn command without any pre-configured scope.",
"type": "string",
"const": "shell:deny-spawn",
"markdownDescription": "Denies the spawn command without any pre-configured scope."
},
{
"description": "Denies the stdin_write command without any pre-configured scope.",
"type": "string",
"const": "shell:deny-stdin-write",
"markdownDescription": "Denies the stdin_write command without any pre-configured scope."
} }
] ]
} }
@@ -213,120 +195,96 @@
"properties": { "properties": {
"allow": { "allow": {
"items": { "items": {
"title": "ShellScopeEntry", "title": "OpenerScopeEntry",
"description": "Shell scope entry.", "description": "Opener scope entry.",
"anyOf": [ "anyOf": [
{ {
"type": "object", "type": "object",
"required": [ "required": [
"cmd", "url"
"name"
], ],
"properties": { "properties": {
"args": { "app": {
"description": "The allowed arguments for the command execution.", "description": "An application to open this url with, for example: firefox.",
"allOf": [ "allOf": [
{ {
"$ref": "#/definitions/ShellScopeEntryAllowedArgs" "$ref": "#/definitions/Application"
} }
] ]
}, },
"cmd": { "url": {
"description": "The command name. It can start with a variable that resolves to a system base directory. The variables are: `$AUDIO`, `$CACHE`, `$CONFIG`, `$DATA`, `$LOCALDATA`, `$DESKTOP`, `$DOCUMENT`, `$DOWNLOAD`, `$EXE`, `$FONT`, `$HOME`, `$PICTURE`, `$PUBLIC`, `$RUNTIME`, `$TEMPLATE`, `$VIDEO`, `$RESOURCE`, `$LOG`, `$TEMP`, `$APPCONFIG`, `$APPDATA`, `$APPLOCALDATA`, `$APPCACHE`, `$APPLOG`.", "description": "A URL that can be opened by the webview when using the Opener APIs.\n\nWildcards can be used following the UNIX glob pattern.\n\nExamples:\n\n- \"https://*\" : allows all HTTPS origin\n\n- \"https://*.github.com/tauri-apps/tauri\": allows any subdomain of \"github.com\" with the \"tauri-apps/api\" path\n\n- \"https://myapi.service.com/users/*\": allows access to any URLs that begins with \"https://myapi.service.com/users/\"",
"type": "string"
},
"name": {
"description": "The name for this allowed shell command configuration.\n\nThis name will be used inside of the webview API to call this command along with any specified arguments.",
"type": "string" "type": "string"
} }
}, }
"additionalProperties": false
}, },
{ {
"type": "object", "type": "object",
"required": [ "required": [
"name", "path"
"sidecar"
], ],
"properties": { "properties": {
"args": { "app": {
"description": "The allowed arguments for the command execution.", "description": "An application to open this path with, for example: xdg-open.",
"allOf": [ "allOf": [
{ {
"$ref": "#/definitions/ShellScopeEntryAllowedArgs" "$ref": "#/definitions/Application"
} }
] ]
}, },
"name": { "path": {
"description": "The name for this allowed shell command configuration.\n\nThis name will be used inside of the webview API to call this command along with any specified arguments.", "description": "A path that can be opened by the webview when using the Opener APIs.\n\nThe pattern can start with a variable that resolves to a system base directory. The variables are: `$AUDIO`, `$CACHE`, `$CONFIG`, `$DATA`, `$LOCALDATA`, `$DESKTOP`, `$DOCUMENT`, `$DOWNLOAD`, `$EXE`, `$FONT`, `$HOME`, `$PICTURE`, `$PUBLIC`, `$RUNTIME`, `$TEMPLATE`, `$VIDEO`, `$RESOURCE`, `$APP`, `$LOG`, `$TEMP`, `$APPCONFIG`, `$APPDATA`, `$APPLOCALDATA`, `$APPCACHE`, `$APPLOG`.",
"type": "string" "type": "string"
},
"sidecar": {
"description": "If this command is a sidecar command.",
"type": "boolean"
} }
}, }
"additionalProperties": false
} }
] ]
} }
}, },
"deny": { "deny": {
"items": { "items": {
"title": "ShellScopeEntry", "title": "OpenerScopeEntry",
"description": "Shell scope entry.", "description": "Opener scope entry.",
"anyOf": [ "anyOf": [
{ {
"type": "object", "type": "object",
"required": [ "required": [
"cmd", "url"
"name"
], ],
"properties": { "properties": {
"args": { "app": {
"description": "The allowed arguments for the command execution.", "description": "An application to open this url with, for example: firefox.",
"allOf": [ "allOf": [
{ {
"$ref": "#/definitions/ShellScopeEntryAllowedArgs" "$ref": "#/definitions/Application"
} }
] ]
}, },
"cmd": { "url": {
"description": "The command name. It can start with a variable that resolves to a system base directory. The variables are: `$AUDIO`, `$CACHE`, `$CONFIG`, `$DATA`, `$LOCALDATA`, `$DESKTOP`, `$DOCUMENT`, `$DOWNLOAD`, `$EXE`, `$FONT`, `$HOME`, `$PICTURE`, `$PUBLIC`, `$RUNTIME`, `$TEMPLATE`, `$VIDEO`, `$RESOURCE`, `$LOG`, `$TEMP`, `$APPCONFIG`, `$APPDATA`, `$APPLOCALDATA`, `$APPCACHE`, `$APPLOG`.", "description": "A URL that can be opened by the webview when using the Opener APIs.\n\nWildcards can be used following the UNIX glob pattern.\n\nExamples:\n\n- \"https://*\" : allows all HTTPS origin\n\n- \"https://*.github.com/tauri-apps/tauri\": allows any subdomain of \"github.com\" with the \"tauri-apps/api\" path\n\n- \"https://myapi.service.com/users/*\": allows access to any URLs that begins with \"https://myapi.service.com/users/\"",
"type": "string"
},
"name": {
"description": "The name for this allowed shell command configuration.\n\nThis name will be used inside of the webview API to call this command along with any specified arguments.",
"type": "string" "type": "string"
} }
}, }
"additionalProperties": false
}, },
{ {
"type": "object", "type": "object",
"required": [ "required": [
"name", "path"
"sidecar"
], ],
"properties": { "properties": {
"args": { "app": {
"description": "The allowed arguments for the command execution.", "description": "An application to open this path with, for example: xdg-open.",
"allOf": [ "allOf": [
{ {
"$ref": "#/definitions/ShellScopeEntryAllowedArgs" "$ref": "#/definitions/Application"
} }
] ]
}, },
"name": { "path": {
"description": "The name for this allowed shell command configuration.\n\nThis name will be used inside of the webview API to call this command along with any specified arguments.", "description": "A path that can be opened by the webview when using the Opener APIs.\n\nThe pattern can start with a variable that resolves to a system base directory. The variables are: `$AUDIO`, `$CACHE`, `$CONFIG`, `$DATA`, `$LOCALDATA`, `$DESKTOP`, `$DOCUMENT`, `$DOWNLOAD`, `$EXE`, `$FONT`, `$HOME`, `$PICTURE`, `$PUBLIC`, `$RUNTIME`, `$TEMPLATE`, `$VIDEO`, `$RESOURCE`, `$APP`, `$LOG`, `$TEMP`, `$APPCONFIG`, `$APPDATA`, `$APPLOCALDATA`, `$APPCACHE`, `$APPLOG`.",
"type": "string" "type": "string"
},
"sidecar": {
"description": "If this command is a sidecar command.",
"type": "boolean"
} }
}, }
"additionalProperties": false
} }
] ]
} }
@@ -386,6 +344,48 @@
"Identifier": { "Identifier": {
"description": "Permission identifier", "description": "Permission identifier",
"oneOf": [ "oneOf": [
{
"description": "This permission set configures if your\napplication can enable or disable auto\nstarting the application on boot.\n\n#### Granted Permissions\n\nIt allows all to check, enable and\ndisable the automatic start on boot.\n\n\n#### This default permission set includes:\n\n- `allow-enable`\n- `allow-disable`\n- `allow-is-enabled`",
"type": "string",
"const": "autostart:default",
"markdownDescription": "This permission set configures if your\napplication can enable or disable auto\nstarting the application on boot.\n\n#### Granted Permissions\n\nIt allows all to check, enable and\ndisable the automatic start on boot.\n\n\n#### This default permission set includes:\n\n- `allow-enable`\n- `allow-disable`\n- `allow-is-enabled`"
},
{
"description": "Enables the disable command without any pre-configured scope.",
"type": "string",
"const": "autostart:allow-disable",
"markdownDescription": "Enables the disable command without any pre-configured scope."
},
{
"description": "Enables the enable command without any pre-configured scope.",
"type": "string",
"const": "autostart:allow-enable",
"markdownDescription": "Enables the enable command without any pre-configured scope."
},
{
"description": "Enables the is_enabled command without any pre-configured scope.",
"type": "string",
"const": "autostart:allow-is-enabled",
"markdownDescription": "Enables the is_enabled command without any pre-configured scope."
},
{
"description": "Denies the disable command without any pre-configured scope.",
"type": "string",
"const": "autostart:deny-disable",
"markdownDescription": "Denies the disable command without any pre-configured scope."
},
{
"description": "Denies the enable command without any pre-configured scope.",
"type": "string",
"const": "autostart:deny-enable",
"markdownDescription": "Denies the enable command without any pre-configured scope."
},
{
"description": "Denies the is_enabled command without any pre-configured scope.",
"type": "string",
"const": "autostart:deny-is-enabled",
"markdownDescription": "Denies the is_enabled command without any pre-configured scope."
},
{ {
"description": "Default core plugins set.\n#### This default permission set includes:\n\n- `core:path:default`\n- `core:event:default`\n- `core:window:default`\n- `core:webview:default`\n- `core:app:default`\n- `core:image:default`\n- `core:resources:default`\n- `core:menu:default`\n- `core:tray:default`", "description": "Default core plugins set.\n#### This default permission set includes:\n\n- `core:path:default`\n- `core:event:default`\n- `core:window:default`\n- `core:webview:default`\n- `core:app:default`\n- `core:image:default`\n- `core:resources:default`\n- `core:menu:default`\n- `core:tray:default`",
"type": "string", "type": "string",
@@ -2553,70 +2553,52 @@
"markdownDescription": "Denies the show command without any pre-configured scope." "markdownDescription": "Denies the show command without any pre-configured scope."
}, },
{ {
"description": "This permission set configures which\nshell functionality is exposed by default.\n\n#### Granted Permissions\n\nIt allows to use the `open` functionality with a reasonable\nscope pre-configured. It will allow opening `http(s)://`,\n`tel:` and `mailto:` links.\n\n#### This default permission set includes:\n\n- `allow-open`", "description": "This permission set allows opening `mailto:`, `tel:`, `https://` and `http://` urls using their default application\nas well as reveal file in directories using default file explorer\n#### This default permission set includes:\n\n- `allow-open-url`\n- `allow-reveal-item-in-dir`\n- `allow-default-urls`",
"type": "string", "type": "string",
"const": "shell:default", "const": "opener:default",
"markdownDescription": "This permission set configures which\nshell functionality is exposed by default.\n\n#### Granted Permissions\n\nIt allows to use the `open` functionality with a reasonable\nscope pre-configured. It will allow opening `http(s)://`,\n`tel:` and `mailto:` links.\n\n#### This default permission set includes:\n\n- `allow-open`" "markdownDescription": "This permission set allows opening `mailto:`, `tel:`, `https://` and `http://` urls using their default application\nas well as reveal file in directories using default file explorer\n#### This default permission set includes:\n\n- `allow-open-url`\n- `allow-reveal-item-in-dir`\n- `allow-default-urls`"
}, },
{ {
"description": "Enables the execute command without any pre-configured scope.", "description": "This enables opening `mailto:`, `tel:`, `https://` and `http://` urls using their default application.",
"type": "string", "type": "string",
"const": "shell:allow-execute", "const": "opener:allow-default-urls",
"markdownDescription": "Enables the execute command without any pre-configured scope." "markdownDescription": "This enables opening `mailto:`, `tel:`, `https://` and `http://` urls using their default application."
}, },
{ {
"description": "Enables the kill command without any pre-configured scope.", "description": "Enables the open_path command without any pre-configured scope.",
"type": "string", "type": "string",
"const": "shell:allow-kill", "const": "opener:allow-open-path",
"markdownDescription": "Enables the kill command without any pre-configured scope." "markdownDescription": "Enables the open_path command without any pre-configured scope."
}, },
{ {
"description": "Enables the open command without any pre-configured scope.", "description": "Enables the open_url command without any pre-configured scope.",
"type": "string", "type": "string",
"const": "shell:allow-open", "const": "opener:allow-open-url",
"markdownDescription": "Enables the open command without any pre-configured scope." "markdownDescription": "Enables the open_url command without any pre-configured scope."
}, },
{ {
"description": "Enables the spawn command without any pre-configured scope.", "description": "Enables the reveal_item_in_dir command without any pre-configured scope.",
"type": "string", "type": "string",
"const": "shell:allow-spawn", "const": "opener:allow-reveal-item-in-dir",
"markdownDescription": "Enables the spawn command without any pre-configured scope." "markdownDescription": "Enables the reveal_item_in_dir command without any pre-configured scope."
}, },
{ {
"description": "Enables the stdin_write command without any pre-configured scope.", "description": "Denies the open_path command without any pre-configured scope.",
"type": "string", "type": "string",
"const": "shell:allow-stdin-write", "const": "opener:deny-open-path",
"markdownDescription": "Enables the stdin_write command without any pre-configured scope." "markdownDescription": "Denies the open_path command without any pre-configured scope."
}, },
{ {
"description": "Denies the execute command without any pre-configured scope.", "description": "Denies the open_url command without any pre-configured scope.",
"type": "string", "type": "string",
"const": "shell:deny-execute", "const": "opener:deny-open-url",
"markdownDescription": "Denies the execute command without any pre-configured scope." "markdownDescription": "Denies the open_url command without any pre-configured scope."
}, },
{ {
"description": "Denies the kill command without any pre-configured scope.", "description": "Denies the reveal_item_in_dir command without any pre-configured scope.",
"type": "string", "type": "string",
"const": "shell:deny-kill", "const": "opener:deny-reveal-item-in-dir",
"markdownDescription": "Denies the kill command without any pre-configured scope." "markdownDescription": "Denies the reveal_item_in_dir command without any pre-configured scope."
},
{
"description": "Denies the open command without any pre-configured scope.",
"type": "string",
"const": "shell:deny-open",
"markdownDescription": "Denies the open command without any pre-configured scope."
},
{
"description": "Denies the spawn command without any pre-configured scope.",
"type": "string",
"const": "shell:deny-spawn",
"markdownDescription": "Denies the spawn command without any pre-configured scope."
},
{
"description": "Denies the stdin_write command without any pre-configured scope.",
"type": "string",
"const": "shell:deny-stdin-write",
"markdownDescription": "Denies the stdin_write command without any pre-configured scope."
}, },
{ {
"description": "This permission set configures which kind of\nupdater functions are exposed to the frontend.\n\n#### Granted Permissions\n\nThe full workflow from checking for updates to installing them\nis enabled.\n\n\n#### This default permission set includes:\n\n- `allow-check`\n- `allow-download`\n- `allow-install`\n- `allow-download-and-install`", "description": "This permission set configures which kind of\nupdater functions are exposed to the frontend.\n\n#### Granted Permissions\n\nThe full workflow from checking for updates to installing them\nis enabled.\n\n\n#### This default permission set includes:\n\n- `allow-check`\n- `allow-download`\n- `allow-install`\n- `allow-download-and-install`",
@@ -2810,47 +2792,20 @@
} }
] ]
}, },
"ShellScopeEntryAllowedArg": { "Application": {
"description": "A command argument allowed to be executed by the webview API.", "description": "Opener scope application.",
"anyOf": [ "anyOf": [
{ {
"description": "A non-configurable argument that is passed to the command in the order it was specified.", "description": "Open in default application.",
"type": "string" "type": "null"
}, },
{ {
"description": "A variable that is set while calling the command from the webview API.", "description": "If true, allow open with any application.",
"type": "object",
"required": [
"validator"
],
"properties": {
"raw": {
"description": "Marks the validator as a raw regex, meaning the plugin should not make any modification at runtime.\n\nThis means the regex will not match on the entire string by default, which might be exploited if your regex allow unexpected input to be considered valid. When using this option, make sure your regex is correct.",
"default": false,
"type": "boolean"
},
"validator": {
"description": "[regex] validator to require passed values to conform to an expected input.\n\nThis will require the argument value passed to this variable to match the `validator` regex before it will be executed.\n\nThe regex string is by default surrounded by `^...$` to match the full string. For example the `https?://\\w+` regex would be registered as `^https?://\\w+$`.\n\n[regex]: <https://docs.rs/regex/latest/regex/#syntax>",
"type": "string"
}
},
"additionalProperties": false
}
]
},
"ShellScopeEntryAllowedArgs": {
"description": "A set of command arguments allowed to be executed by the webview API.\n\nA value of `true` will allow any arguments to be passed to the command. `false` will disable all arguments. A list of [`ShellScopeEntryAllowedArg`] will set those arguments as the only valid arguments to be passed to the attached command configuration.",
"anyOf": [
{
"description": "Use a simple boolean to allow all or disable all arguments to this command configuration.",
"type": "boolean" "type": "boolean"
}, },
{ {
"description": "A specific set of [`ShellScopeEntryAllowedArg`] that are valid to call for the command configuration.", "description": "Allow specific application to open with.",
"type": "array", "type": "string"
"items": {
"$ref": "#/definitions/ShellScopeEntryAllowedArg"
}
} }
] ]
} }

View File

@@ -140,70 +140,52 @@
"identifier": { "identifier": {
"anyOf": [ "anyOf": [
{ {
"description": "This permission set configures which\nshell functionality is exposed by default.\n\n#### Granted Permissions\n\nIt allows to use the `open` functionality with a reasonable\nscope pre-configured. It will allow opening `http(s)://`,\n`tel:` and `mailto:` links.\n\n#### This default permission set includes:\n\n- `allow-open`", "description": "This permission set allows opening `mailto:`, `tel:`, `https://` and `http://` urls using their default application\nas well as reveal file in directories using default file explorer\n#### This default permission set includes:\n\n- `allow-open-url`\n- `allow-reveal-item-in-dir`\n- `allow-default-urls`",
"type": "string", "type": "string",
"const": "shell:default", "const": "opener:default",
"markdownDescription": "This permission set configures which\nshell functionality is exposed by default.\n\n#### Granted Permissions\n\nIt allows to use the `open` functionality with a reasonable\nscope pre-configured. It will allow opening `http(s)://`,\n`tel:` and `mailto:` links.\n\n#### This default permission set includes:\n\n- `allow-open`" "markdownDescription": "This permission set allows opening `mailto:`, `tel:`, `https://` and `http://` urls using their default application\nas well as reveal file in directories using default file explorer\n#### This default permission set includes:\n\n- `allow-open-url`\n- `allow-reveal-item-in-dir`\n- `allow-default-urls`"
}, },
{ {
"description": "Enables the execute command without any pre-configured scope.", "description": "This enables opening `mailto:`, `tel:`, `https://` and `http://` urls using their default application.",
"type": "string", "type": "string",
"const": "shell:allow-execute", "const": "opener:allow-default-urls",
"markdownDescription": "Enables the execute command without any pre-configured scope." "markdownDescription": "This enables opening `mailto:`, `tel:`, `https://` and `http://` urls using their default application."
}, },
{ {
"description": "Enables the kill command without any pre-configured scope.", "description": "Enables the open_path command without any pre-configured scope.",
"type": "string", "type": "string",
"const": "shell:allow-kill", "const": "opener:allow-open-path",
"markdownDescription": "Enables the kill command without any pre-configured scope." "markdownDescription": "Enables the open_path command without any pre-configured scope."
}, },
{ {
"description": "Enables the open command without any pre-configured scope.", "description": "Enables the open_url command without any pre-configured scope.",
"type": "string", "type": "string",
"const": "shell:allow-open", "const": "opener:allow-open-url",
"markdownDescription": "Enables the open command without any pre-configured scope." "markdownDescription": "Enables the open_url command without any pre-configured scope."
}, },
{ {
"description": "Enables the spawn command without any pre-configured scope.", "description": "Enables the reveal_item_in_dir command without any pre-configured scope.",
"type": "string", "type": "string",
"const": "shell:allow-spawn", "const": "opener:allow-reveal-item-in-dir",
"markdownDescription": "Enables the spawn command without any pre-configured scope." "markdownDescription": "Enables the reveal_item_in_dir command without any pre-configured scope."
}, },
{ {
"description": "Enables the stdin_write command without any pre-configured scope.", "description": "Denies the open_path command without any pre-configured scope.",
"type": "string", "type": "string",
"const": "shell:allow-stdin-write", "const": "opener:deny-open-path",
"markdownDescription": "Enables the stdin_write command without any pre-configured scope." "markdownDescription": "Denies the open_path command without any pre-configured scope."
}, },
{ {
"description": "Denies the execute command without any pre-configured scope.", "description": "Denies the open_url command without any pre-configured scope.",
"type": "string", "type": "string",
"const": "shell:deny-execute", "const": "opener:deny-open-url",
"markdownDescription": "Denies the execute command without any pre-configured scope." "markdownDescription": "Denies the open_url command without any pre-configured scope."
}, },
{ {
"description": "Denies the kill command without any pre-configured scope.", "description": "Denies the reveal_item_in_dir command without any pre-configured scope.",
"type": "string", "type": "string",
"const": "shell:deny-kill", "const": "opener:deny-reveal-item-in-dir",
"markdownDescription": "Denies the kill command without any pre-configured scope." "markdownDescription": "Denies the reveal_item_in_dir command without any pre-configured scope."
},
{
"description": "Denies the open command without any pre-configured scope.",
"type": "string",
"const": "shell:deny-open",
"markdownDescription": "Denies the open command without any pre-configured scope."
},
{
"description": "Denies the spawn command without any pre-configured scope.",
"type": "string",
"const": "shell:deny-spawn",
"markdownDescription": "Denies the spawn command without any pre-configured scope."
},
{
"description": "Denies the stdin_write command without any pre-configured scope.",
"type": "string",
"const": "shell:deny-stdin-write",
"markdownDescription": "Denies the stdin_write command without any pre-configured scope."
} }
] ]
} }
@@ -213,120 +195,96 @@
"properties": { "properties": {
"allow": { "allow": {
"items": { "items": {
"title": "ShellScopeEntry", "title": "OpenerScopeEntry",
"description": "Shell scope entry.", "description": "Opener scope entry.",
"anyOf": [ "anyOf": [
{ {
"type": "object", "type": "object",
"required": [ "required": [
"cmd", "url"
"name"
], ],
"properties": { "properties": {
"args": { "app": {
"description": "The allowed arguments for the command execution.", "description": "An application to open this url with, for example: firefox.",
"allOf": [ "allOf": [
{ {
"$ref": "#/definitions/ShellScopeEntryAllowedArgs" "$ref": "#/definitions/Application"
} }
] ]
}, },
"cmd": { "url": {
"description": "The command name. It can start with a variable that resolves to a system base directory. The variables are: `$AUDIO`, `$CACHE`, `$CONFIG`, `$DATA`, `$LOCALDATA`, `$DESKTOP`, `$DOCUMENT`, `$DOWNLOAD`, `$EXE`, `$FONT`, `$HOME`, `$PICTURE`, `$PUBLIC`, `$RUNTIME`, `$TEMPLATE`, `$VIDEO`, `$RESOURCE`, `$LOG`, `$TEMP`, `$APPCONFIG`, `$APPDATA`, `$APPLOCALDATA`, `$APPCACHE`, `$APPLOG`.", "description": "A URL that can be opened by the webview when using the Opener APIs.\n\nWildcards can be used following the UNIX glob pattern.\n\nExamples:\n\n- \"https://*\" : allows all HTTPS origin\n\n- \"https://*.github.com/tauri-apps/tauri\": allows any subdomain of \"github.com\" with the \"tauri-apps/api\" path\n\n- \"https://myapi.service.com/users/*\": allows access to any URLs that begins with \"https://myapi.service.com/users/\"",
"type": "string"
},
"name": {
"description": "The name for this allowed shell command configuration.\n\nThis name will be used inside of the webview API to call this command along with any specified arguments.",
"type": "string" "type": "string"
} }
}, }
"additionalProperties": false
}, },
{ {
"type": "object", "type": "object",
"required": [ "required": [
"name", "path"
"sidecar"
], ],
"properties": { "properties": {
"args": { "app": {
"description": "The allowed arguments for the command execution.", "description": "An application to open this path with, for example: xdg-open.",
"allOf": [ "allOf": [
{ {
"$ref": "#/definitions/ShellScopeEntryAllowedArgs" "$ref": "#/definitions/Application"
} }
] ]
}, },
"name": { "path": {
"description": "The name for this allowed shell command configuration.\n\nThis name will be used inside of the webview API to call this command along with any specified arguments.", "description": "A path that can be opened by the webview when using the Opener APIs.\n\nThe pattern can start with a variable that resolves to a system base directory. The variables are: `$AUDIO`, `$CACHE`, `$CONFIG`, `$DATA`, `$LOCALDATA`, `$DESKTOP`, `$DOCUMENT`, `$DOWNLOAD`, `$EXE`, `$FONT`, `$HOME`, `$PICTURE`, `$PUBLIC`, `$RUNTIME`, `$TEMPLATE`, `$VIDEO`, `$RESOURCE`, `$APP`, `$LOG`, `$TEMP`, `$APPCONFIG`, `$APPDATA`, `$APPLOCALDATA`, `$APPCACHE`, `$APPLOG`.",
"type": "string" "type": "string"
},
"sidecar": {
"description": "If this command is a sidecar command.",
"type": "boolean"
} }
}, }
"additionalProperties": false
} }
] ]
} }
}, },
"deny": { "deny": {
"items": { "items": {
"title": "ShellScopeEntry", "title": "OpenerScopeEntry",
"description": "Shell scope entry.", "description": "Opener scope entry.",
"anyOf": [ "anyOf": [
{ {
"type": "object", "type": "object",
"required": [ "required": [
"cmd", "url"
"name"
], ],
"properties": { "properties": {
"args": { "app": {
"description": "The allowed arguments for the command execution.", "description": "An application to open this url with, for example: firefox.",
"allOf": [ "allOf": [
{ {
"$ref": "#/definitions/ShellScopeEntryAllowedArgs" "$ref": "#/definitions/Application"
} }
] ]
}, },
"cmd": { "url": {
"description": "The command name. It can start with a variable that resolves to a system base directory. The variables are: `$AUDIO`, `$CACHE`, `$CONFIG`, `$DATA`, `$LOCALDATA`, `$DESKTOP`, `$DOCUMENT`, `$DOWNLOAD`, `$EXE`, `$FONT`, `$HOME`, `$PICTURE`, `$PUBLIC`, `$RUNTIME`, `$TEMPLATE`, `$VIDEO`, `$RESOURCE`, `$LOG`, `$TEMP`, `$APPCONFIG`, `$APPDATA`, `$APPLOCALDATA`, `$APPCACHE`, `$APPLOG`.", "description": "A URL that can be opened by the webview when using the Opener APIs.\n\nWildcards can be used following the UNIX glob pattern.\n\nExamples:\n\n- \"https://*\" : allows all HTTPS origin\n\n- \"https://*.github.com/tauri-apps/tauri\": allows any subdomain of \"github.com\" with the \"tauri-apps/api\" path\n\n- \"https://myapi.service.com/users/*\": allows access to any URLs that begins with \"https://myapi.service.com/users/\"",
"type": "string"
},
"name": {
"description": "The name for this allowed shell command configuration.\n\nThis name will be used inside of the webview API to call this command along with any specified arguments.",
"type": "string" "type": "string"
} }
}, }
"additionalProperties": false
}, },
{ {
"type": "object", "type": "object",
"required": [ "required": [
"name", "path"
"sidecar"
], ],
"properties": { "properties": {
"args": { "app": {
"description": "The allowed arguments for the command execution.", "description": "An application to open this path with, for example: xdg-open.",
"allOf": [ "allOf": [
{ {
"$ref": "#/definitions/ShellScopeEntryAllowedArgs" "$ref": "#/definitions/Application"
} }
] ]
}, },
"name": { "path": {
"description": "The name for this allowed shell command configuration.\n\nThis name will be used inside of the webview API to call this command along with any specified arguments.", "description": "A path that can be opened by the webview when using the Opener APIs.\n\nThe pattern can start with a variable that resolves to a system base directory. The variables are: `$AUDIO`, `$CACHE`, `$CONFIG`, `$DATA`, `$LOCALDATA`, `$DESKTOP`, `$DOCUMENT`, `$DOWNLOAD`, `$EXE`, `$FONT`, `$HOME`, `$PICTURE`, `$PUBLIC`, `$RUNTIME`, `$TEMPLATE`, `$VIDEO`, `$RESOURCE`, `$APP`, `$LOG`, `$TEMP`, `$APPCONFIG`, `$APPDATA`, `$APPLOCALDATA`, `$APPCACHE`, `$APPLOG`.",
"type": "string" "type": "string"
},
"sidecar": {
"description": "If this command is a sidecar command.",
"type": "boolean"
} }
}, }
"additionalProperties": false
} }
] ]
} }
@@ -386,6 +344,48 @@
"Identifier": { "Identifier": {
"description": "Permission identifier", "description": "Permission identifier",
"oneOf": [ "oneOf": [
{
"description": "This permission set configures if your\napplication can enable or disable auto\nstarting the application on boot.\n\n#### Granted Permissions\n\nIt allows all to check, enable and\ndisable the automatic start on boot.\n\n\n#### This default permission set includes:\n\n- `allow-enable`\n- `allow-disable`\n- `allow-is-enabled`",
"type": "string",
"const": "autostart:default",
"markdownDescription": "This permission set configures if your\napplication can enable or disable auto\nstarting the application on boot.\n\n#### Granted Permissions\n\nIt allows all to check, enable and\ndisable the automatic start on boot.\n\n\n#### This default permission set includes:\n\n- `allow-enable`\n- `allow-disable`\n- `allow-is-enabled`"
},
{
"description": "Enables the disable command without any pre-configured scope.",
"type": "string",
"const": "autostart:allow-disable",
"markdownDescription": "Enables the disable command without any pre-configured scope."
},
{
"description": "Enables the enable command without any pre-configured scope.",
"type": "string",
"const": "autostart:allow-enable",
"markdownDescription": "Enables the enable command without any pre-configured scope."
},
{
"description": "Enables the is_enabled command without any pre-configured scope.",
"type": "string",
"const": "autostart:allow-is-enabled",
"markdownDescription": "Enables the is_enabled command without any pre-configured scope."
},
{
"description": "Denies the disable command without any pre-configured scope.",
"type": "string",
"const": "autostart:deny-disable",
"markdownDescription": "Denies the disable command without any pre-configured scope."
},
{
"description": "Denies the enable command without any pre-configured scope.",
"type": "string",
"const": "autostart:deny-enable",
"markdownDescription": "Denies the enable command without any pre-configured scope."
},
{
"description": "Denies the is_enabled command without any pre-configured scope.",
"type": "string",
"const": "autostart:deny-is-enabled",
"markdownDescription": "Denies the is_enabled command without any pre-configured scope."
},
{ {
"description": "Default core plugins set.\n#### This default permission set includes:\n\n- `core:path:default`\n- `core:event:default`\n- `core:window:default`\n- `core:webview:default`\n- `core:app:default`\n- `core:image:default`\n- `core:resources:default`\n- `core:menu:default`\n- `core:tray:default`", "description": "Default core plugins set.\n#### This default permission set includes:\n\n- `core:path:default`\n- `core:event:default`\n- `core:window:default`\n- `core:webview:default`\n- `core:app:default`\n- `core:image:default`\n- `core:resources:default`\n- `core:menu:default`\n- `core:tray:default`",
"type": "string", "type": "string",
@@ -2553,70 +2553,52 @@
"markdownDescription": "Denies the show command without any pre-configured scope." "markdownDescription": "Denies the show command without any pre-configured scope."
}, },
{ {
"description": "This permission set configures which\nshell functionality is exposed by default.\n\n#### Granted Permissions\n\nIt allows to use the `open` functionality with a reasonable\nscope pre-configured. It will allow opening `http(s)://`,\n`tel:` and `mailto:` links.\n\n#### This default permission set includes:\n\n- `allow-open`", "description": "This permission set allows opening `mailto:`, `tel:`, `https://` and `http://` urls using their default application\nas well as reveal file in directories using default file explorer\n#### This default permission set includes:\n\n- `allow-open-url`\n- `allow-reveal-item-in-dir`\n- `allow-default-urls`",
"type": "string", "type": "string",
"const": "shell:default", "const": "opener:default",
"markdownDescription": "This permission set configures which\nshell functionality is exposed by default.\n\n#### Granted Permissions\n\nIt allows to use the `open` functionality with a reasonable\nscope pre-configured. It will allow opening `http(s)://`,\n`tel:` and `mailto:` links.\n\n#### This default permission set includes:\n\n- `allow-open`" "markdownDescription": "This permission set allows opening `mailto:`, `tel:`, `https://` and `http://` urls using their default application\nas well as reveal file in directories using default file explorer\n#### This default permission set includes:\n\n- `allow-open-url`\n- `allow-reveal-item-in-dir`\n- `allow-default-urls`"
}, },
{ {
"description": "Enables the execute command without any pre-configured scope.", "description": "This enables opening `mailto:`, `tel:`, `https://` and `http://` urls using their default application.",
"type": "string", "type": "string",
"const": "shell:allow-execute", "const": "opener:allow-default-urls",
"markdownDescription": "Enables the execute command without any pre-configured scope." "markdownDescription": "This enables opening `mailto:`, `tel:`, `https://` and `http://` urls using their default application."
}, },
{ {
"description": "Enables the kill command without any pre-configured scope.", "description": "Enables the open_path command without any pre-configured scope.",
"type": "string", "type": "string",
"const": "shell:allow-kill", "const": "opener:allow-open-path",
"markdownDescription": "Enables the kill command without any pre-configured scope." "markdownDescription": "Enables the open_path command without any pre-configured scope."
}, },
{ {
"description": "Enables the open command without any pre-configured scope.", "description": "Enables the open_url command without any pre-configured scope.",
"type": "string", "type": "string",
"const": "shell:allow-open", "const": "opener:allow-open-url",
"markdownDescription": "Enables the open command without any pre-configured scope." "markdownDescription": "Enables the open_url command without any pre-configured scope."
}, },
{ {
"description": "Enables the spawn command without any pre-configured scope.", "description": "Enables the reveal_item_in_dir command without any pre-configured scope.",
"type": "string", "type": "string",
"const": "shell:allow-spawn", "const": "opener:allow-reveal-item-in-dir",
"markdownDescription": "Enables the spawn command without any pre-configured scope." "markdownDescription": "Enables the reveal_item_in_dir command without any pre-configured scope."
}, },
{ {
"description": "Enables the stdin_write command without any pre-configured scope.", "description": "Denies the open_path command without any pre-configured scope.",
"type": "string", "type": "string",
"const": "shell:allow-stdin-write", "const": "opener:deny-open-path",
"markdownDescription": "Enables the stdin_write command without any pre-configured scope." "markdownDescription": "Denies the open_path command without any pre-configured scope."
}, },
{ {
"description": "Denies the execute command without any pre-configured scope.", "description": "Denies the open_url command without any pre-configured scope.",
"type": "string", "type": "string",
"const": "shell:deny-execute", "const": "opener:deny-open-url",
"markdownDescription": "Denies the execute command without any pre-configured scope." "markdownDescription": "Denies the open_url command without any pre-configured scope."
}, },
{ {
"description": "Denies the kill command without any pre-configured scope.", "description": "Denies the reveal_item_in_dir command without any pre-configured scope.",
"type": "string", "type": "string",
"const": "shell:deny-kill", "const": "opener:deny-reveal-item-in-dir",
"markdownDescription": "Denies the kill command without any pre-configured scope." "markdownDescription": "Denies the reveal_item_in_dir command without any pre-configured scope."
},
{
"description": "Denies the open command without any pre-configured scope.",
"type": "string",
"const": "shell:deny-open",
"markdownDescription": "Denies the open command without any pre-configured scope."
},
{
"description": "Denies the spawn command without any pre-configured scope.",
"type": "string",
"const": "shell:deny-spawn",
"markdownDescription": "Denies the spawn command without any pre-configured scope."
},
{
"description": "Denies the stdin_write command without any pre-configured scope.",
"type": "string",
"const": "shell:deny-stdin-write",
"markdownDescription": "Denies the stdin_write command without any pre-configured scope."
}, },
{ {
"description": "This permission set configures which kind of\nupdater functions are exposed to the frontend.\n\n#### Granted Permissions\n\nThe full workflow from checking for updates to installing them\nis enabled.\n\n\n#### This default permission set includes:\n\n- `allow-check`\n- `allow-download`\n- `allow-install`\n- `allow-download-and-install`", "description": "This permission set configures which kind of\nupdater functions are exposed to the frontend.\n\n#### Granted Permissions\n\nThe full workflow from checking for updates to installing them\nis enabled.\n\n\n#### This default permission set includes:\n\n- `allow-check`\n- `allow-download`\n- `allow-install`\n- `allow-download-and-install`",
@@ -2810,47 +2792,20 @@
} }
] ]
}, },
"ShellScopeEntryAllowedArg": { "Application": {
"description": "A command argument allowed to be executed by the webview API.", "description": "Opener scope application.",
"anyOf": [ "anyOf": [
{ {
"description": "A non-configurable argument that is passed to the command in the order it was specified.", "description": "Open in default application.",
"type": "string" "type": "null"
}, },
{ {
"description": "A variable that is set while calling the command from the webview API.", "description": "If true, allow open with any application.",
"type": "object",
"required": [
"validator"
],
"properties": {
"raw": {
"description": "Marks the validator as a raw regex, meaning the plugin should not make any modification at runtime.\n\nThis means the regex will not match on the entire string by default, which might be exploited if your regex allow unexpected input to be considered valid. When using this option, make sure your regex is correct.",
"default": false,
"type": "boolean"
},
"validator": {
"description": "[regex] validator to require passed values to conform to an expected input.\n\nThis will require the argument value passed to this variable to match the `validator` regex before it will be executed.\n\nThe regex string is by default surrounded by `^...$` to match the full string. For example the `https?://\\w+` regex would be registered as `^https?://\\w+$`.\n\n[regex]: <https://docs.rs/regex/latest/regex/#syntax>",
"type": "string"
}
},
"additionalProperties": false
}
]
},
"ShellScopeEntryAllowedArgs": {
"description": "A set of command arguments allowed to be executed by the webview API.\n\nA value of `true` will allow any arguments to be passed to the command. `false` will disable all arguments. A list of [`ShellScopeEntryAllowedArg`] will set those arguments as the only valid arguments to be passed to the attached command configuration.",
"anyOf": [
{
"description": "Use a simple boolean to allow all or disable all arguments to this command configuration.",
"type": "boolean" "type": "boolean"
}, },
{ {
"description": "A specific set of [`ShellScopeEntryAllowedArg`] that are valid to call for the command configuration.", "description": "Allow specific application to open with.",
"type": "array", "type": "string"
"items": {
"$ref": "#/definitions/ShellScopeEntryAllowedArg"
}
} }
] ]
} }

View File

@@ -1,8 +1,16 @@
//! Cinny Desktop library for cross-platform builds including Android //! Paarrot Desktop library for cross-platform builds including Android
#[cfg(mobile)] #[cfg(mobile)]
mod mobile; mod mobile;
#[cfg(not(any(target_os = "android", target_os = "ios")))]
use tauri::{
Manager,
menu::{Menu, MenuItem},
tray::{MouseButton, MouseButtonState, TrayIconBuilder, TrayIconEvent},
WindowEvent,
};
/// Read image from clipboard on Linux using arboard with Wayland support /// Read image from clipboard on Linux using arboard with Wayland support
#[cfg(target_os = "linux")] #[cfg(target_os = "linux")]
#[tauri::command] #[tauri::command]
@@ -42,17 +50,78 @@ fn read_clipboard_image() -> Result<Option<String>, String> {
} }
/// Runs the Tauri application /// Runs the Tauri application
#[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() { pub fn run() {
#[cfg(not(any(target_os = "android", target_os = "ios")))] #[cfg(not(any(target_os = "android", target_os = "ios")))]
{ {
let port = 44548; let port = 44548;
tauri::Builder::default() tauri::Builder::default()
.plugin(tauri_plugin_localhost::Builder::new(port).build()) .plugin(tauri_plugin_localhost::Builder::new(port).build())
.plugin(tauri_plugin_shell::init()) .plugin(tauri_plugin_opener::init())
.plugin(tauri_plugin_window_state::Builder::default().build()) .plugin(tauri_plugin_window_state::Builder::default().build())
.plugin(tauri_plugin_single_instance::init(|_app, _args, _cwd| {})) .plugin(tauri_plugin_single_instance::init(|app, _args, _cwd| {
// When a second instance tries to launch, focus the existing window
if let Some(window) = app.get_webview_window("main") {
let _ = window.unminimize();
let _ = window.show();
let _ = window.set_focus();
}
}))
.plugin(tauri_plugin_notification::init()) .plugin(tauri_plugin_notification::init())
.plugin(tauri_plugin_updater::Builder::new().build()) .plugin(tauri_plugin_updater::Builder::new().build())
.plugin(tauri_plugin_autostart::init(
tauri_plugin_autostart::MacosLauncher::LaunchAgent,
Some(vec!["--minimized"]),
))
.setup(|app| {
// Create system tray
let show_item = MenuItem::with_id(app, "show", "Show Paarrot", true, None::<&str>)?;
let quit_item = MenuItem::with_id(app, "quit", "Quit", true, None::<&str>)?;
let menu = Menu::with_items(app, &[&show_item, &quit_item])?;
let _tray = TrayIconBuilder::new()
.icon(app.default_window_icon().unwrap().clone())
.menu(&menu)
.show_menu_on_left_click(false)
.on_menu_event(|app, event| match event.id.as_ref() {
"show" => {
if let Some(window) = app.get_webview_window("main") {
let _ = window.unminimize();
let _ = window.show();
let _ = window.set_focus();
}
}
"quit" => {
app.exit(0);
}
_ => {}
})
.on_tray_icon_event(|tray, event| {
if let TrayIconEvent::Click {
button: MouseButton::Left,
button_state: MouseButtonState::Up,
..
} = event
{
let app = tray.app_handle();
if let Some(window) = app.get_webview_window("main") {
let _ = window.unminimize();
let _ = window.show();
let _ = window.set_focus();
}
}
})
.build(app)?;
Ok(())
})
.on_window_event(|window, event| {
// Minimize to tray on close instead of quitting
if let WindowEvent::CloseRequested { api, .. } = event {
window.hide().unwrap();
api.prevent_close();
}
})
.invoke_handler(tauri::generate_handler![read_clipboard_image]) .invoke_handler(tauri::generate_handler![read_clipboard_image])
.run(tauri::generate_context!()) .run(tauri::generate_context!())
.expect("error while building tauri application"); .expect("error while building tauri application");
@@ -61,7 +130,7 @@ pub fn run() {
#[cfg(any(target_os = "android", target_os = "ios"))] #[cfg(any(target_os = "android", target_os = "ios"))]
{ {
tauri::Builder::default() tauri::Builder::default()
.plugin(tauri_plugin_shell::init()) .plugin(tauri_plugin_opener::init())
.plugin(tauri_plugin_notification::init()) .plugin(tauri_plugin_notification::init())
.plugin(tauri_plugin_deep_link::init()) .plugin(tauri_plugin_deep_link::init())
.invoke_handler(tauri::generate_handler![read_clipboard_image]) .invoke_handler(tauri::generate_handler![read_clipboard_image])