mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-07-10 23:02:46 +02:00
Fix warning: unused variable: window on non-mac OSs
This commit is contained in:
@@ -5,7 +5,7 @@ mod mac;
|
|||||||
|
|
||||||
use crate::commands::{set_theme, set_title};
|
use crate::commands::{set_theme, set_title};
|
||||||
use std::sync::atomic::AtomicBool;
|
use std::sync::atomic::AtomicBool;
|
||||||
use tauri::{generate_handler, plugin, plugin::TauriPlugin, Manager, Runtime};
|
use tauri::{Manager, Runtime, generate_handler, plugin, plugin::TauriPlugin};
|
||||||
|
|
||||||
pub trait AppHandleMacWindowExt {
|
pub trait AppHandleMacWindowExt {
|
||||||
/// Sets whether to use the native titlebar
|
/// Sets whether to use the native titlebar
|
||||||
@@ -14,7 +14,9 @@ pub trait AppHandleMacWindowExt {
|
|||||||
|
|
||||||
impl<R: Runtime> AppHandleMacWindowExt for tauri::AppHandle<R> {
|
impl<R: Runtime> AppHandleMacWindowExt for tauri::AppHandle<R> {
|
||||||
fn set_native_titlebar(&self, enable: bool) {
|
fn set_native_titlebar(&self, enable: bool) {
|
||||||
self.state::<PluginState>().native_titlebar.store(enable, std::sync::atomic::Ordering::Relaxed);
|
self.state::<PluginState>()
|
||||||
|
.native_titlebar
|
||||||
|
.store(enable, std::sync::atomic::Ordering::Relaxed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -23,17 +25,21 @@ pub(crate) struct PluginState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn init<R: Runtime>() -> TauriPlugin<R> {
|
pub fn init<R: Runtime>() -> TauriPlugin<R> {
|
||||||
plugin::Builder::new("yaak-mac-window")
|
let mut builder = plugin::Builder::new("yaak-mac-window")
|
||||||
.setup(move |app, _| {
|
.setup(move |app, _| {
|
||||||
app.manage(PluginState { native_titlebar: AtomicBool::new(false) });
|
app.manage(PluginState {
|
||||||
|
native_titlebar: AtomicBool::new(false),
|
||||||
|
});
|
||||||
Ok(())
|
Ok(())
|
||||||
})
|
})
|
||||||
.invoke_handler(generate_handler![set_title, set_theme])
|
.invoke_handler(generate_handler![set_title, set_theme]);
|
||||||
.on_window_ready(move |window| {
|
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
{
|
{
|
||||||
mac::setup_traffic_light_positioner(&window);
|
builder = builder.on_window_ready(move |window| {
|
||||||
}
|
mac::setup_traffic_light_positioner(&window);
|
||||||
})
|
});
|
||||||
.build()
|
}
|
||||||
|
|
||||||
|
builder.build()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user