-
Notifications
You must be signed in to change notification settings - Fork 431
feat: add tauri-plugin-opener
#2019
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
Merged
Merged
Changes from 15 commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
38369c8
[WIP] create tauri-plugin-opener
amrbashir 42ab44c
migrate to using scope
amrbashir b9ced54
clippy
amrbashir 6766bfd
add show_item_in_dir (windows impl)
amrbashir 67c8f42
reveal_item_in_dir (linux impl)
amrbashir 73959f5
macos impl
amrbashir fe2fdee
1.0.0 & major in change file
amrbashir 8555563
lock file and licenese headers
amrbashir 5399e54
implement revealItemInDir in JS
amrbashir f7244d5
Merge branch 'v2' into feat/plugin-opener
amrbashir 5158101
remove regex and urlpattern deps
amrbashir a24915e
error msg
amrbashir 7f7f3e4
lock file
amrbashir eb88ad5
try to fix CI
amrbashir f3a5f88
fmt
amrbashir f5da785
update window crate
amrbashir adf4d52
strong type openWith paramter
amrbashir bcc6c09
split into openUrl and openPath
amrbashir e0264cc
refactor init script
amrbashir 9594639
fmt
amrbashir 47a5c85
Merge branch 'v2' into feat/plugin-opener
amrbashir 6d62ec7
update example
amrbashir ec35bf3
fix evt.ctrlKey and evt.shiftKey
amrbashir 7cd8b23
simplify and fix leak
amrbashir 5df1e4b
remove lefover
amrbashir b696024
fix example, fix linux, document
amrbashir 768e3ec
remove `Program` enum
amrbashir 3f66dbd
Merge branch 'v2' into feat/plugin-opener
amrbashir 3b80f1e
remove middle click comment
amrbashir 8ed396f
remove AppHandle, Program from ts
amrbashir 30dcce8
fix permissions error
amrbashir ff17c5d
Update plugins/opener/src/scope_entry.rs
amrbashir ac467fe
Merge branch 'v2' into feat/plugin-opener
amrbashir 3a54f2f
fix fallback
amrbashir 955697a
Merge branch 'v2' into feat/plugin-opener
amrbashir 23143e9
add option to configure global script behavior
amrbashir File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
"opener": "major" | ||
"opener-js": "major" | ||
--- | ||
|
||
Initial Release |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -80,6 +80,7 @@ | |
], | ||
"deny": ["$APPDATA/db/*.stronghold"] | ||
}, | ||
"store:default" | ||
"store:default", | ||
"opener:default" | ||
] | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<script> | ||
import { open } from '@tauri-apps/plugin-opener' | ||
|
||
export let onMessage | ||
|
||
const programs = [ | ||
'firefox', | ||
'google chrome', | ||
'chromium', | ||
'safari', | ||
'open', | ||
'start', | ||
'xdg-open', | ||
'gio', | ||
'gnome-open', | ||
'kde-open', | ||
'wslview' | ||
] | ||
|
||
let path = '' | ||
|
||
let program = 'Default' | ||
|
||
function openPath() { | ||
open(path, program === 'Default' ? undefined : program).catch(onMessage) | ||
} | ||
</script> | ||
|
||
<div class="flex flex-col"> | ||
<form | ||
class="flex flex-row gap-2 items-center" | ||
on:submit|preventDefault={openPath} | ||
> | ||
<input | ||
class="input grow" | ||
placeholder="Type the path to watch..." | ||
bind:value={path} | ||
/> | ||
|
||
<span> with </span> | ||
<select class="input" bind:value={program}> | ||
<option value="Default">Default</option> | ||
{#each programs as p} | ||
<option value={p}>{p}</option> | ||
{/each} | ||
</select> | ||
|
||
<button class="btn" type="submit">Open</button> | ||
</form> | ||
</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
[package] | ||
name = "tauri-plugin-opener" | ||
version = "1.0.0" | ||
description = "Open files and URLs using their default application." | ||
edition = { workspace = true } | ||
authors = { workspace = true } | ||
license = { workspace = true } | ||
repository = { workspace = true } | ||
links = "tauri-plugin-opener" | ||
|
||
[package.metadata.docs.rs] | ||
rustc-args = ["--cfg", "docsrs"] | ||
rustdoc-args = ["--cfg", "docsrs"] | ||
|
||
# Platforms supported by the plugin | ||
# Support levels are "full", "partial", "none", "unknown" | ||
# Details of the support level are left to plugin maintainer | ||
[package.metadata.platforms] | ||
windows = { level = "full", notes = "" } | ||
linux = { level = "full", notes = "" } | ||
macos = { level = "full", notes = "" } | ||
android = { level = "partial", notes = "Only allows to open URLs via `open`" } | ||
ios = { level = "partial", notes = "Only allows to open URLs via `open`" } | ||
|
||
|
||
[build-dependencies] | ||
tauri-plugin = { workspace = true, features = ["build"] } | ||
schemars = { workspace = true } | ||
serde = { workspace = true } | ||
|
||
[dependencies] | ||
serde = { workspace = true } | ||
serde_json = { workspace = true } | ||
tauri = { workspace = true } | ||
thiserror = { workspace = true } | ||
open = { version = "5", features = ["shellexecute-on-windows"] } | ||
url = { workspace = true } | ||
glob = { workspace = true } | ||
|
||
[target."cfg(windows)".dependencies] | ||
dunce = { workspace = true } | ||
|
||
[target."cfg(windows)".dependencies.windows] | ||
version = "0.54" | ||
amrbashir marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
features = [ | ||
"Win32_Foundation", | ||
"Win32_UI_Shell_Common", | ||
"Win32_UI_WindowsAndMessaging", | ||
"Win32_System_Com", | ||
"Win32_System_Registry", | ||
] | ||
|
||
[target."cfg(any(target_os = \"linux\", target_os = \"dragonfly\", target_os = \"freebsd\", target_os = \"netbsd\", target_os = \"openbsd\"))".dependencies] | ||
zbus = { workspace = true } | ||
|
||
[target."cfg(target_os = \"macos\")".dependencies.objc2-app-kit] | ||
version = "0.2" | ||
features = ["NSWorkspace"] | ||
|
||
[target."cfg(target_os = \"macos\")".dependencies.objc2-foundation] | ||
version = "0.2" | ||
features = ["NSURL", "NSArray", "NSString"] | ||
|
||
[target.'cfg(target_os = "ios")'.dependencies] | ||
tauri = { workspace = true, features = ["wry"] } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
SPDXVersion: SPDX-2.1 | ||
DataLicense: CC0-1.0 | ||
PackageName: tauri | ||
DataFormat: SPDXRef-1 | ||
PackageSupplier: Organization: The Tauri Programme in the Commons Conservancy | ||
PackageHomePage: https://tauri.app | ||
PackageLicenseDeclared: Apache-2.0 | ||
PackageLicenseDeclared: MIT | ||
PackageCopyrightText: 2019-2022, The Tauri Programme in the Commons Conservancy | ||
PackageSummary: <text>Tauri is a rust project that enables developers to make secure | ||
and small desktop applications using a web frontend. | ||
</text> | ||
PackageComment: <text>The package includes the following libraries; see | ||
Relationship information. | ||
</text> | ||
Created: 2019-05-20T09:00:00Z | ||
PackageDownloadLocation: git://github.com/tauri-apps/tauri | ||
PackageDownloadLocation: git+https://github.com/tauri-apps/tauri.git | ||
PackageDownloadLocation: git+ssh://github.com/tauri-apps/tauri.git | ||
Creator: Person: Daniel Thompson-Yvetot |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.