Skip to content

Commit

Permalink
chore: update tauri example to v2 (#132)
Browse files Browse the repository at this point in the history
* chore: update tauri example to v2

closes #131

* Update test.yml

* Update test.yml
  • Loading branch information
amrbashir committed Apr 15, 2024
1 parent 708449c commit 31e86d3
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 84 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ jobs:
if: matrix.platform == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.1-dev
- uses: dtolnay/rust-toolchain@stable
- run: cargo test
- name: test tauri example
run: |
cd examples/tauri/src-tauri
cargo test --features tauri/custom-protocol
1 change: 1 addition & 0 deletions examples/tauri/src-tauri/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
# Generated by Cargo
# will have compiled files and executables
/target/
gen/schemas
15 changes: 5 additions & 10 deletions examples/tauri/src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,21 +1,16 @@
[package]
name = "app"
version = "0.1.0"
version = "0.0.0"
description = "A Tauri App"
authors = ["Tauri Programme within The Commons Conservancy"]
license = "MIT OR Apache-2.0"
edition = "2021"

[build-dependencies]
tauri-build = { version = "2.0.0-beta" }

[dependencies]
serde_json = "1"
serde = { version = "1", features = ["derive"] }
tauri = { version = "1", features = ["api-all"] }
tauri = { version = "2.0.0-beta", features = ["macos-private-api"] }
window-vibrancy = { path = "../../../" }


[build-dependencies]
tauri-build = { version = "1" }

[features]
default = ["custom-protocol"]
custom-protocol = ["tauri/custom-protocol"]
32 changes: 16 additions & 16 deletions examples/tauri/src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,28 @@
// SPDX-License-Identifier: MIT

#![cfg_attr(
all(not(debug_assertions), target_os = "windows"),
windows_subsystem = "windows"
all(not(debug_assertions), target_os = "windows"),
windows_subsystem = "windows"
)]

use tauri::Manager;
use window_vibrancy::{apply_blur, apply_vibrancy, NSVisualEffectMaterial};
use window_vibrancy::*;

fn main() {
tauri::Builder::default()
.setup(|app| {
let window = app.get_window("main").unwrap();
tauri::Builder::default()
.setup(|app| {
let window = app.get_webview_window("main").unwrap();

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

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

Ok(())
})
.run(tauri::generate_context!())
.expect("error while running tauri application");
Ok(())
})
.run(tauri::generate_context!())
.expect("error while running tauri application");
}
77 changes: 20 additions & 57 deletions examples/tauri/src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
@@ -1,65 +1,28 @@
{
"package": {
"productName": "app",
"version": "0.1.0"
},
"productName": "TauriApp",
"version": "0.0.0",
"identifier": "com.tauri.dev",
"build": {
"distDir": "../public",
"devPath": "../public"
"frontendDist": "../public"
},
"tauri": {
"bundle": {
"active": true,
"targets": "all",
"identifier": "com.tauri.window-vibrancy",
"icon": [
"icons/32x32.png",
"icons/128x128.png",
"icons/[email protected]",
"icons/icon.icns",
"icons/icon.ico"
],
"resources": [],
"externalBin": [],
"copyright": "",
"category": "DeveloperTool",
"shortDescription": "",
"longDescription": "",
"deb": {
"depends": []
},
"macOS": {
"frameworks": [],
"exceptionDomain": "",
"signingIdentity": null,
"entitlements": null
},
"windows": {
"certificateThumbprint": null,
"digestAlgorithm": "sha256",
"timestampUrl": ""
}
},
"updater": {
"active": false
},
"allowlist": {
"all": true
},
"app": {
"withGlobalTauri": true,
"windows": [{ "decorations": false, "transparent": true }],
"macOSPrivateApi": true,
"windows": [
{
"title": "app",
"width": 800,
"height": 600,
"resizable": true,
"fullscreen": false,
"transparent": true,
"decorations": false
}
],
"security": {
"csp": "default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self' img-src: 'self'"
"csp": null
}
},
"bundle": {
"active": true,
"targets": "all",
"icon": [
"icons/32x32.png",
"icons/128x128.png",
"icons/[email protected]",
"icons/icon.icns",
"icons/icon.ico"
],
"resources": ["icons/32x32.png"]
}
}

0 comments on commit 31e86d3

Please sign in to comment.