Skip to content

Commit 31e86d3

Browse files
authored
chore: update tauri example to v2 (#132)
* chore: update tauri example to v2 closes #131 * Update test.yml * Update test.yml
1 parent 708449c commit 31e86d3

File tree

5 files changed

+47
-84
lines changed

5 files changed

+47
-84
lines changed

.github/workflows/test.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,11 @@ jobs:
2121
if: matrix.platform == 'ubuntu-latest'
2222
run: |
2323
sudo apt-get update
24-
sudo apt-get install -y libgtk-3-dev
24+
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.1-dev
2525
2626
- uses: dtolnay/rust-toolchain@stable
2727
- run: cargo test
28+
- name: test tauri example
29+
run: |
30+
cd examples/tauri/src-tauri
31+
cargo test --features tauri/custom-protocol

examples/tauri/src-tauri/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@
55
# Generated by Cargo
66
# will have compiled files and executables
77
/target/
8+
gen/schemas

examples/tauri/src-tauri/Cargo.toml

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,16 @@
11
[package]
22
name = "app"
3-
version = "0.1.0"
3+
version = "0.0.0"
44
description = "A Tauri App"
55
authors = ["Tauri Programme within The Commons Conservancy"]
66
license = "MIT OR Apache-2.0"
77
edition = "2021"
88

9+
[build-dependencies]
10+
tauri-build = { version = "2.0.0-beta" }
11+
912
[dependencies]
1013
serde_json = "1"
1114
serde = { version = "1", features = ["derive"] }
12-
tauri = { version = "1", features = ["api-all"] }
15+
tauri = { version = "2.0.0-beta", features = ["macos-private-api"] }
1316
window-vibrancy = { path = "../../../" }
14-
15-
16-
[build-dependencies]
17-
tauri-build = { version = "1" }
18-
19-
[features]
20-
default = ["custom-protocol"]
21-
custom-protocol = ["tauri/custom-protocol"]

examples/tauri/src-tauri/src/main.rs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,28 @@
33
// SPDX-License-Identifier: MIT
44

55
#![cfg_attr(
6-
all(not(debug_assertions), target_os = "windows"),
7-
windows_subsystem = "windows"
6+
all(not(debug_assertions), target_os = "windows"),
7+
windows_subsystem = "windows"
88
)]
99

1010
use tauri::Manager;
11-
use window_vibrancy::{apply_blur, apply_vibrancy, NSVisualEffectMaterial};
11+
use window_vibrancy::*;
1212

1313
fn main() {
14-
tauri::Builder::default()
15-
.setup(|app| {
16-
let window = app.get_window("main").unwrap();
14+
tauri::Builder::default()
15+
.setup(|app| {
16+
let window = app.get_webview_window("main").unwrap();
1717

18-
#[cfg(target_os = "macos")]
19-
apply_vibrancy(&window, NSVisualEffectMaterial::HudWindow, None, None)
20-
.expect("Unsupported platform! 'apply_vibrancy' is only supported on macOS");
18+
#[cfg(target_os = "macos")]
19+
apply_vibrancy(&window, NSVisualEffectMaterial::HudWindow, None, None)
20+
.expect("Unsupported platform! 'apply_vibrancy' is only supported on macOS");
2121

22-
#[cfg(target_os = "windows")]
23-
apply_blur(&window, Some((18, 18, 18, 125)))
24-
.expect("Unsupported platform! 'apply_blur' is only supported on Windows");
22+
#[cfg(target_os = "windows")]
23+
apply_blur(&window, Some((18, 18, 18, 125)))
24+
.expect("Unsupported platform! 'apply_blur' is only supported on Windows");
2525

26-
Ok(())
27-
})
28-
.run(tauri::generate_context!())
29-
.expect("error while running tauri application");
26+
Ok(())
27+
})
28+
.run(tauri::generate_context!())
29+
.expect("error while running tauri application");
3030
}
Lines changed: 20 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,28 @@
11
{
2-
"package": {
3-
"productName": "app",
4-
"version": "0.1.0"
5-
},
2+
"productName": "TauriApp",
3+
"version": "0.0.0",
4+
"identifier": "com.tauri.dev",
65
"build": {
7-
"distDir": "../public",
8-
"devPath": "../public"
6+
"frontendDist": "../public"
97
},
10-
"tauri": {
11-
"bundle": {
12-
"active": true,
13-
"targets": "all",
14-
"identifier": "com.tauri.window-vibrancy",
15-
"icon": [
16-
"icons/32x32.png",
17-
"icons/128x128.png",
18-
19-
"icons/icon.icns",
20-
"icons/icon.ico"
21-
],
22-
"resources": [],
23-
"externalBin": [],
24-
"copyright": "",
25-
"category": "DeveloperTool",
26-
"shortDescription": "",
27-
"longDescription": "",
28-
"deb": {
29-
"depends": []
30-
},
31-
"macOS": {
32-
"frameworks": [],
33-
"exceptionDomain": "",
34-
"signingIdentity": null,
35-
"entitlements": null
36-
},
37-
"windows": {
38-
"certificateThumbprint": null,
39-
"digestAlgorithm": "sha256",
40-
"timestampUrl": ""
41-
}
42-
},
43-
"updater": {
44-
"active": false
45-
},
46-
"allowlist": {
47-
"all": true
48-
},
8+
"app": {
9+
"withGlobalTauri": true,
10+
"windows": [{ "decorations": false, "transparent": true }],
4911
"macOSPrivateApi": true,
50-
"windows": [
51-
{
52-
"title": "app",
53-
"width": 800,
54-
"height": 600,
55-
"resizable": true,
56-
"fullscreen": false,
57-
"transparent": true,
58-
"decorations": false
59-
}
60-
],
6112
"security": {
62-
"csp": "default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self' img-src: 'self'"
13+
"csp": null
6314
}
15+
},
16+
"bundle": {
17+
"active": true,
18+
"targets": "all",
19+
"icon": [
20+
"icons/32x32.png",
21+
"icons/128x128.png",
22+
23+
"icons/icon.icns",
24+
"icons/icon.ico"
25+
],
26+
"resources": ["icons/32x32.png"]
6427
}
6528
}

0 commit comments

Comments
 (0)