feat: use native border in macos
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
use std::path::PathBuf;
|
||||
use std::str::FromStr;
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
use border::WebviewWindowExt as BorderWebviewWindowExt;
|
||||
#[cfg(target_os = "macos")]
|
||||
use cocoa::{appkit::NSApp, base::nil, foundation::NSString};
|
||||
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)
|
||||
.minimizable(window.minimizable)
|
||||
.maximizable(window.maximizable)
|
||||
.transparent(true)
|
||||
.effects(WindowEffectsConfig {
|
||||
state: None,
|
||||
effects: vec![Effect::UnderWindowBackground],
|
||||
@@ -226,9 +229,9 @@ pub fn open_window(window: Window, app_handle: tauri::AppHandle) -> Result<(), S
|
||||
// Set decoration
|
||||
window.create_overlay_titlebar().unwrap();
|
||||
|
||||
// Make main window transparent
|
||||
// Restore native border
|
||||
#[cfg(target_os = "macos")]
|
||||
window.make_transparent().unwrap();
|
||||
window.add_border(None);
|
||||
}
|
||||
|
||||
Ok(())
|
||||
@@ -250,9 +253,9 @@ pub fn open_main_window(app: tauri::AppHandle) {
|
||||
.build()
|
||||
.unwrap();
|
||||
|
||||
// Make main window transparent
|
||||
// Restore native border
|
||||
#[cfg(target_os = "macos")]
|
||||
window.make_transparent().unwrap();
|
||||
window.add_border(None);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,8 @@ extern crate cocoa;
|
||||
#[macro_use]
|
||||
extern crate objc;
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
use border::WebviewWindowExt as BorderWebviewWindowExt;
|
||||
use nostr_sdk::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use specta::Type;
|
||||
@@ -150,9 +152,9 @@ fn main() {
|
||||
#[cfg(target_os = "windows")]
|
||||
main_window.create_overlay_titlebar().unwrap();
|
||||
|
||||
// Make main window transparent
|
||||
// Restore native border
|
||||
#[cfg(target_os = "macos")]
|
||||
main_window.make_transparent().unwrap();
|
||||
main_window.add_border(None);
|
||||
|
||||
// Set a custom inset to the traffic lights
|
||||
#[cfg(target_os = "macos")]
|
||||
|
||||
Reference in New Issue
Block a user