Skip to content

Commit c95a236

Browse files
committed
feat(v0.2.0): added support for clipboard
added minimal working example of clipboard plugin
1 parent aa2c660 commit c95a236

File tree

8 files changed

+436
-20
lines changed

8 files changed

+436
-20
lines changed

Cargo.lock

Lines changed: 363 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,36 @@ This template should help get you started developing with Tauri and Leptos.
1818
### Recommended IDE Setup
1919

2020
[VS Code](https://code.visualstudio.com/) + [Tauri](https://marketplace.visualstudio.com/items?itemName=tauri-apps.tauri-vscode) + [rust-analyzer](https://marketplace.visualstudio.com/items?itemName=rust-lang.rust-analyzer).
21+
22+
## TODOs
23+
24+
- [ ] Implement Clipboard Plugin functionality
25+
- [ ] Explore/Implement Deeplinking Plugin functionality
26+
- [ ] Implement Filesystem Plugin functionality
27+
- [ ] Implement Dialog Plugin functionality
28+
- [ ] Implement Logging Plugin functionality
29+
- [ ] Implement Localhost Plugin functionality
30+
- [ ] Implement GlobalShortCut Plugin functionality (Keyboard ShortCuts)
31+
- [ ] Implement [Stronghold](https://docs.iota.org/) Plugin functionality ()
32+
- [ ] Implement Notifications Plugin functionality
33+
- [ ] Implement OS Information Plugin functionality
34+
- [ ] Implement Persisted Scope Plugin functionality
35+
- [ ] Implement Process Plugin functionality
36+
- [ ] Implement Shell Plugin functionality
37+
- [ ] Implement Single InstancePlugin functionality
38+
- [ ] Implement Store Plugin functionality
39+
- [ ] Implement Updater Plugin functionality
40+
- [ ] Implement Upload Plugin functionality
41+
- [ ] Implement HTTP Client Plugin functionality
42+
- [ ] Implement Window State Plugin functionality
43+
- [ ] Implement WebSocket Plugin functionality
44+
- [ ] Implement tauri-plugin-macos-permissions community Plugin functionality
45+
- [ ] Implement tauri-plugin-graphql community Plugin functionality
46+
- [ ] Implement sentry-tauri community Plugin functionality
47+
- [ ] Implement tauri-plugin-clipboard community Plugin functionality
48+
- [ ] Implement tauri-plugin-network community Plugin functionality
49+
- [ ] Implement tauri-plugin-screenshots community Plugin functionality
50+
- [ ] Implement tauri-update-cloudflare integration functionality
51+
- [ ] Implement tauri-update-server integration functionality
52+
- [ ] Implement tauri-macos-spotlight-example integration functionality
53+
- [ ] Implement tauri-macos-menubar-app-example integration functionality

src-tauri/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,4 @@ log = "0.4"
2424
tauri = { version = "2.5.0", features = [] }
2525
tauri-plugin-log = "2.0.0-rc"
2626
tauri-plugin-opener = "2"
27+
tauri-plugin-clipboard-manager = "2"

src-tauri/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
fn main() {
2-
tauri_build::build()
2+
tauri_build::build()
33
}

src-tauri/capabilities/README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Capabilities
2+
3+
4+
| identifier | description |
5+
|-----------------------------------------|-------------------------------------------------------------------|
6+
| `"clipboard-manager:allow-clear"` | Enables the clear command without any pre-configured scope. |
7+
| `"clipboard-manager:deny-clear"` | Denies the clear command without any pre-configured scope. |
8+
| `"clipboard-manager:allow-read-image"` | Enables the read_image command without any pre-configured scope. |
9+
| `"clipboard-manager:deny-read-image"` | Denies the read_image command without any pre-configured scope. |
10+
| `"clipboard-manager:allow-read-text"` | Enables the read_text command without any pre-configured scope. |
11+
| `"clipboard-manager:deny-read-text"` | Denies the read_text command without any pre-configured scope. |
12+
| `"clipboard-manager:allow-write-html"` | Enables the write_html command without any pre-configured scope. |
13+
| `"clipboard-manager:deny-write-html"` | Denies the write_html command without any pre-configured scope. |
14+
| `"clipboard-manager:allow-write-image"` | Enables the write_image command without any pre-configured scope. |
15+
| `"clipboard-manager:deny-write-image"` | Denies the write_image command without any pre-configured scope. |
16+
| `"clipboard-manager:allow-write-text"` | Enables the write_text command without any pre-configured scope. |
17+
| `"clipboard-manager:deny-write-text"` | Denies the write_text command without any pre-configured scope. |

src-tauri/capabilities/default.json

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
{
2-
"$schema": "../gen/schemas/desktop-schema.json",
3-
"identifier": "default",
4-
"description": "enables the default permissions",
5-
"windows": [
6-
"main"
7-
],
8-
"permissions": [
9-
"core:default",
10-
"opener:default"
11-
]
12-
}
2+
"$schema": "../gen/schemas/desktop-schema.json",
3+
"identifier": "default",
4+
"description": "enables the default permissions",
5+
"windows": ["main"],
6+
"permissions": [
7+
"core:default",
8+
"opener:default",
9+
"clipboard-manager:default"
10+
]
11+
}

src-tauri/src/lib.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// use tauri_plugin_opener::OpenerExt;
2+
use tauri_plugin_clipboard_manager::ClipboardExt;
23
// Learn more about Tauri commands at https://tauri.app/develop/calling-rust/
34
#[tauri::command]
45
fn greet(name: &str) -> String {
@@ -8,9 +9,13 @@ fn greet(name: &str) -> String {
89
#[cfg_attr(mobile, tauri::mobile_entry_point)]
910
pub fn run() {
1011
tauri::Builder::default()
12+
.plugin(tauri_plugin_clipboard_manager::init())
1113
.plugin(tauri_plugin_opener::init())
1214
.invoke_handler(tauri::generate_handler![greet])
1315
.setup(|app| {
16+
app.clipboard()
17+
.write_text("Tauri is awesome!".to_string())
18+
.unwrap();
1419
if cfg!(debug_assertions) {
1520
app.handle().plugin(
1621
tauri_plugin_log::Builder::default()
@@ -23,3 +28,8 @@ pub fn run() {
2328
.run(tauri::generate_context!())
2429
.expect("error while running tauri application");
2530
}
31+
32+
// // Read content from clipboard
33+
// let content = app.clipboard().read_text();
34+
// println!("{:?}", content.unwrap());
35+
// // Prints "Tauri is awesome!" to the terminal

src-tauri/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
33

44
fn main() {
5-
app_lib::run();
5+
app_lib::run();
66
}

0 commit comments

Comments
 (0)