Skip to content

Commit 5178609

Browse files
ahonnFabianLars
andauthored
feat(macos): add liquid glass effect support (#191)
Co-authored-by: FabianLars <github@fabianlars.de>
1 parent c9c6465 commit 5178609

18 files changed

Lines changed: 314 additions & 30 deletions

File tree

.changes/macos-liquid-glass.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"window-vibrancy": "patch:enhance"
3+
---
4+
5+
Introduce macOS liquid glass support with `apply_liquid_glass` / `clear_liquid_glass`.

.changes/msrv-177.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
window-vibrancy: minor:misc
3+
---
4+
5+
Increased the MSRV to `1.77`.

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
sudo apt-get update
2424
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.1-dev
2525
26-
- uses: dtolnay/rust-toolchain@1.71
26+
- uses: dtolnay/rust-toolchain@1.77
2727
- run: cargo build
2828

2929
- uses: dtolnay/rust-toolchain@stable

Cargo.lock

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

Cargo.toml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description = "Make your windows vibrant."
44
authors = ["Tauri Programme within The Commons Conservancy"]
55
version = "0.6.0"
66
edition = "2021"
7-
rust-version = "1.71"
7+
rust-version = "1.77"
88
license = "Apache-2.0 OR MIT"
99
readme = "README.md"
1010
repository = "https://github.com/tauri-apps/tauri-plugin-vibrancy"
@@ -38,20 +38,23 @@ features = [
3838
]
3939

4040
[target.'cfg(target_os = "macos")'.dependencies]
41-
objc2 = "0.6.0"
42-
objc2-app-kit = { version = "0.3.0", default-features = false, features = [
41+
objc2 = "0.6"
42+
objc2-app-kit = { version = "0.3", default-features = false, features = [
4343
"std",
44+
"objc2-core-foundation",
4445
"NSApplication",
46+
"NSColor",
47+
"NSGlassEffectView",
4548
"NSGraphics",
4649
"NSResponder",
4750
"NSView",
4851
"NSVisualEffectView",
4952
] }
50-
objc2-foundation = { version = "0.3.0", default-features = false, features = [
53+
objc2-foundation = { version = "0.3", default-features = false, features = [
5154
"std",
5255
"NSThread",
5356
"NSGeometry",
5457
] }
55-
objc2-core-foundation = { version = "0.3.0", default-features = false, features = [
58+
objc2-core-foundation = { version = "0.3", default-features = false, features = [
5659
"std",
5760
] }

examples/tao.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,10 @@ fn main() {
3030
.expect("Unsupported platform! 'apply_blur' is only supported on Windows");
3131

3232
#[cfg(target_os = "macos")]
33-
apply_vibrancy(&window, NSVisualEffectMaterial::HudWindow, None, None)
34-
.expect("Unsupported platform! 'apply_vibrancy' is only supported on macOS");
33+
{
34+
apply_liquid_glass(&window, NSGlassEffectViewStyle::Clear, None, Some(26.0))
35+
.expect("Unsupported platform! 'apply_liquid_glass' is only supported on macOS 26+");
36+
}
3537

3638
#[cfg(target_os = "windows")]
3739
window.set_undecorated_shadow(true);

examples/tauri/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@
99
"author": "",
1010
"license": "MIT",
1111
"dependencies": {
12-
"@tauri-apps/cli": "^1.0.0"
12+
"@tauri-apps/cli": "^2.9.0"
1313
}
1414
}

examples/tauri/public/index.html

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,14 @@
1010
html,
1111
body {
1212
background: transparent;
13+
width: 100vw;
14+
height: 100vh;
15+
overflow: hidden;
1316
}
1417
</style>
1518
</head>
1619

17-
<body>
18-
<div>window vibrancy example</div>
20+
<body data-tauri-drag-region>
1921
</body>
2022

21-
</html>
23+
</html>

examples/tauri/src-tauri/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ license = "MIT OR Apache-2.0"
77
edition = "2021"
88

99
[build-dependencies]
10-
tauri-build = { version = "2.0.0-beta" }
10+
tauri-build = { version = "2.0.0-beta", features = [] }
1111

1212
[dependencies]
1313
serde_json = "1"
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"identifier": "main-capability",
3+
"description": "Capability for the main window",
4+
"windows": ["main"],
5+
"permissions": ["core:window:allow-start-dragging"]
6+
}

0 commit comments

Comments
 (0)