mirror of
https://github.com/lumehq/lume.git
synced 2025-03-28 18:52:33 +01:00
feat: use native border in macos
This commit is contained in:
parent
3b99926f3b
commit
2d987849d8
56
biome.json
56
biome.json
@ -1,31 +1,31 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://biomejs.dev/schemas/1.4.1/schema.json",
|
"$schema": "https://biomejs.dev/schemas/1.4.1/schema.json",
|
||||||
"organizeImports": {
|
"organizeImports": {
|
||||||
"enabled": true
|
"enabled": true
|
||||||
},
|
},
|
||||||
"files": {
|
"files": {
|
||||||
"ignore": [
|
"ignore": [
|
||||||
"apps/desktop2/src/router.gen.ts",
|
"apps/desktop2/src/router.gen.ts",
|
||||||
"packages/system/src/commands.ts"
|
"packages/system/src/commands.ts"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"linter": {
|
"linter": {
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"rules": {
|
"rules": {
|
||||||
"recommended": true,
|
"recommended": true,
|
||||||
"style": {
|
"style": {
|
||||||
"noNonNullAssertion": "warn",
|
"noNonNullAssertion": "warn",
|
||||||
"noUselessElse": "off"
|
"noUselessElse": "off"
|
||||||
},
|
},
|
||||||
"correctness": {
|
"correctness": {
|
||||||
"useExhaustiveDependencies": "off"
|
"useExhaustiveDependencies": "off"
|
||||||
},
|
},
|
||||||
"a11y": {
|
"a11y": {
|
||||||
"noSvgWithoutTitle": "off"
|
"noSvgWithoutTitle": "off"
|
||||||
},
|
},
|
||||||
"complexity": {
|
"complexity": {
|
||||||
"noStaticOnlyClass": "off"
|
"noStaticOnlyClass": "off"
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
66
package.json
66
package.json
@ -1,35 +1,35 @@
|
|||||||
{
|
{
|
||||||
"name": "lume",
|
"name": "lume",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "turbo run build",
|
"build": "turbo run build",
|
||||||
"dev": "turbo run dev",
|
"dev": "turbo run dev",
|
||||||
"web:dev": "turbo run dev --filter web",
|
"web:dev": "turbo run dev --filter web",
|
||||||
"desktop:dev": "turbo run dev --filter desktop2",
|
"desktop:dev": "turbo run dev --filter desktop2",
|
||||||
"desktop:build": "turbo run build --filter desktop2",
|
"desktop:build": "turbo run build --filter desktop2",
|
||||||
"tauri": "tauri"
|
"tauri": "tauri"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@biomejs/biome": "^1.8.3",
|
"@biomejs/biome": "^1.8.3",
|
||||||
"@tauri-apps/cli": "2.0.0-beta.22",
|
"@tauri-apps/cli": "2.0.0-beta.22",
|
||||||
"turbo": "^1.13.4"
|
"turbo": "^1.13.4"
|
||||||
},
|
},
|
||||||
"packageManager": "pnpm@8.9.0",
|
"packageManager": "pnpm@8.9.0",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18"
|
"node": ">=18"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@tauri-apps/api": "2.0.0-beta.15",
|
"@tauri-apps/api": "2.0.0-beta.15",
|
||||||
"@tauri-apps/plugin-clipboard-manager": "2.1.0-beta.5",
|
"@tauri-apps/plugin-clipboard-manager": "2.1.0-beta.5",
|
||||||
"@tauri-apps/plugin-dialog": "2.0.0-beta.7",
|
"@tauri-apps/plugin-dialog": "2.0.0-beta.7",
|
||||||
"@tauri-apps/plugin-fs": "2.0.0-beta.7",
|
"@tauri-apps/plugin-fs": "2.0.0-beta.7",
|
||||||
"@tauri-apps/plugin-http": "2.0.0-beta.8",
|
"@tauri-apps/plugin-http": "2.0.0-beta.8",
|
||||||
"@tauri-apps/plugin-os": "2.0.0-beta.7",
|
"@tauri-apps/plugin-os": "2.0.0-beta.7",
|
||||||
"@tauri-apps/plugin-process": "2.0.0-beta.7",
|
"@tauri-apps/plugin-process": "2.0.0-beta.7",
|
||||||
"@tauri-apps/plugin-shell": "2.0.0-beta.8",
|
"@tauri-apps/plugin-shell": "2.0.0-beta.8",
|
||||||
"@tauri-apps/plugin-updater": "2.0.0-beta.7",
|
"@tauri-apps/plugin-updater": "2.0.0-beta.7",
|
||||||
"@tauri-apps/plugin-upload": "2.0.0-beta.8",
|
"@tauri-apps/plugin-upload": "2.0.0-beta.8",
|
||||||
"@tauri-apps/plugin-window-state": "2.0.0-beta.8"
|
"@tauri-apps/plugin-window-state": "2.0.0-beta.8"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
23
src-tauri/Cargo.lock
generated
23
src-tauri/Cargo.lock
generated
@ -606,6 +606,19 @@ dependencies = [
|
|||||||
"piper",
|
"piper",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "border"
|
||||||
|
version = "0.1.0"
|
||||||
|
source = "git+https://github.com/ahkohd/tauri-toolkit?branch=v2#8aac2f5659b036f9c269444a78e7bf15425b4bd8"
|
||||||
|
dependencies = [
|
||||||
|
"cocoa",
|
||||||
|
"color",
|
||||||
|
"objc",
|
||||||
|
"objc-foundation",
|
||||||
|
"objc_id",
|
||||||
|
"tauri",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "brotli"
|
name = "brotli"
|
||||||
version = "3.5.0"
|
version = "3.5.0"
|
||||||
@ -862,6 +875,15 @@ dependencies = [
|
|||||||
"objc",
|
"objc",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "color"
|
||||||
|
version = "0.1.0"
|
||||||
|
source = "git+https://github.com/ahkohd/tauri-toolkit?branch=v2#8aac2f5659b036f9c269444a78e7bf15425b4bd8"
|
||||||
|
dependencies = [
|
||||||
|
"cocoa",
|
||||||
|
"tauri",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "color_quant"
|
name = "color_quant"
|
||||||
version = "1.1.0"
|
version = "1.1.0"
|
||||||
@ -2780,6 +2802,7 @@ dependencies = [
|
|||||||
name = "lume"
|
name = "lume"
|
||||||
version = "4.0.0"
|
version = "4.0.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"border",
|
||||||
"cocoa",
|
"cocoa",
|
||||||
"futures",
|
"futures",
|
||||||
"keyring",
|
"keyring",
|
||||||
|
@ -16,11 +16,11 @@ tokio = { version = "1", features = ["full"] }
|
|||||||
serde_json = "1.0"
|
serde_json = "1.0"
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
tauri = { version = "2.0.0-beta", features = [
|
tauri = { version = "2.0.0-beta", features = [
|
||||||
"unstable",
|
"unstable",
|
||||||
"tray-icon",
|
"tray-icon",
|
||||||
"macos-private-api",
|
"macos-private-api",
|
||||||
"native-tls-vendored",
|
"native-tls-vendored",
|
||||||
"protocol-asset",
|
"protocol-asset",
|
||||||
] }
|
] }
|
||||||
tauri-plugin-window-state = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" }
|
tauri-plugin-window-state = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" }
|
||||||
tauri-plugin-clipboard-manager = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" }
|
tauri-plugin-clipboard-manager = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" }
|
||||||
@ -34,7 +34,7 @@ tauri-plugin-shell = { git = "https://github.com/tauri-apps/plugins-workspace",
|
|||||||
tauri-plugin-updater = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" }
|
tauri-plugin-updater = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" }
|
||||||
tauri-plugin-upload = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" }
|
tauri-plugin-upload = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" }
|
||||||
tauri-specta = { git = "https://github.com/reyamir/tauri-specta", branch = "feat/tauri-v2", features = [
|
tauri-specta = { git = "https://github.com/reyamir/tauri-specta", branch = "feat/tauri-v2", features = [
|
||||||
"typescript",
|
"typescript",
|
||||||
] }
|
] }
|
||||||
tauri-plugin-theme = "0.4.1"
|
tauri-plugin-theme = "0.4.1"
|
||||||
tauri-plugin-decorum = { git = "https://github.com/reyamir/tauri-plugin-decorum", branch = "feat/tauri-v2" }
|
tauri-plugin-decorum = { git = "https://github.com/reyamir/tauri-plugin-decorum", branch = "feat/tauri-v2" }
|
||||||
@ -53,6 +53,7 @@ objc = "0.2.7"
|
|||||||
rand = "0.8.5"
|
rand = "0.8.5"
|
||||||
monitor = { git = "https://github.com/ahkohd/tauri-toolkit", branch = "v2" }
|
monitor = { git = "https://github.com/ahkohd/tauri-toolkit", branch = "v2" }
|
||||||
tauri-nspanel = { git = "https://github.com/ahkohd/tauri-nspanel", branch = "v2" }
|
tauri-nspanel = { git = "https://github.com/ahkohd/tauri-nspanel", branch = "v2" }
|
||||||
|
border = { git = "https://github.com/ahkohd/tauri-toolkit", branch = "v2" }
|
||||||
|
|
||||||
[profile.release]
|
[profile.release]
|
||||||
codegen-units = 1
|
codegen-units = 1
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
||||||
|
#[cfg(target_os = "macos")]
|
||||||
|
use border::WebviewWindowExt as BorderWebviewWindowExt;
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
use cocoa::{appkit::NSApp, base::nil, foundation::NSString};
|
use cocoa::{appkit::NSApp, base::nil, foundation::NSString};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
@ -180,6 +182,7 @@ pub fn open_window(window: Window, app_handle: tauri::AppHandle) -> Result<(), S
|
|||||||
.title_bar_style(TitleBarStyle::Overlay)
|
.title_bar_style(TitleBarStyle::Overlay)
|
||||||
.minimizable(window.minimizable)
|
.minimizable(window.minimizable)
|
||||||
.maximizable(window.maximizable)
|
.maximizable(window.maximizable)
|
||||||
|
.transparent(true)
|
||||||
.effects(WindowEffectsConfig {
|
.effects(WindowEffectsConfig {
|
||||||
state: None,
|
state: None,
|
||||||
effects: vec![Effect::UnderWindowBackground],
|
effects: vec![Effect::UnderWindowBackground],
|
||||||
@ -226,9 +229,9 @@ pub fn open_window(window: Window, app_handle: tauri::AppHandle) -> Result<(), S
|
|||||||
// Set decoration
|
// Set decoration
|
||||||
window.create_overlay_titlebar().unwrap();
|
window.create_overlay_titlebar().unwrap();
|
||||||
|
|
||||||
// Make main window transparent
|
// Restore native border
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
window.make_transparent().unwrap();
|
window.add_border(None);
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
@ -250,9 +253,9 @@ pub fn open_main_window(app: tauri::AppHandle) {
|
|||||||
.build()
|
.build()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
// Make main window transparent
|
// Restore native border
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
window.make_transparent().unwrap();
|
window.add_border(None);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,6 +9,8 @@ extern crate cocoa;
|
|||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate objc;
|
extern crate objc;
|
||||||
|
|
||||||
|
#[cfg(target_os = "macos")]
|
||||||
|
use border::WebviewWindowExt as BorderWebviewWindowExt;
|
||||||
use nostr_sdk::prelude::*;
|
use nostr_sdk::prelude::*;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use specta::Type;
|
use specta::Type;
|
||||||
@ -150,9 +152,9 @@ fn main() {
|
|||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
main_window.create_overlay_titlebar().unwrap();
|
main_window.create_overlay_titlebar().unwrap();
|
||||||
|
|
||||||
// Make main window transparent
|
// Restore native border
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
main_window.make_transparent().unwrap();
|
main_window.add_border(None);
|
||||||
|
|
||||||
// Set a custom inset to the traffic lights
|
// Set a custom inset to the traffic lights
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
"minWidth": 480,
|
"minWidth": 480,
|
||||||
"minHeight": 760,
|
"minHeight": 760,
|
||||||
"hiddenTitle": true,
|
"hiddenTitle": true,
|
||||||
|
"transparent": true,
|
||||||
"windowEffects": {
|
"windowEffects": {
|
||||||
"state": "followsWindowActiveState",
|
"state": "followsWindowActiveState",
|
||||||
"effects": [
|
"effects": [
|
||||||
|
Loading…
x
Reference in New Issue
Block a user