-
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathsettings.rs
More file actions
44 lines (37 loc) · 1.2 KB
/
settings.rs
File metadata and controls
44 lines (37 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
use anyhow::anyhow;
use tauri::{AppHandle, Manager, Window, WindowBuilder, WindowUrl};
#[cfg(target_os = "macos")]
use tauri::TitleBarStyle;
use crate::window;
use super::TransparentWindow;
pub fn create(app: &AppHandle) -> anyhow::Result<Window> {
#[cfg(target_os = "macos")]
let settings_window =
WindowBuilder::new(app, window::SETTINGS, WindowUrl::App(Default::default()))
.visible(false)
.closable(true)
.transparent(true)
.always_on_top(true)
.title("Settings - Commit")
.title_bar_style(TitleBarStyle::Overlay)
.initialization_script("window.__COMMIT__ = { page: 'settings' };")
.build()?;
// not macos
#[cfg(not(target_os = "macos"))]
let settings_window =
WindowBuilder::new(app, window::SETTINGS, WindowUrl::App(Default::default()))
.visible(false)
.closable(true)
.transparent(true)
.always_on_top(true)
.title("Settings - Commit")
.initialization_script("window.__COMMIT__ = { page: 'settings' };")
.build()?;
settings_window.make_transparent().map_err(|_| {
anyhow!("Unsupported platform! 'apply_vibrancy' is only supported on macOS")
})?;
Ok(settings_window)
}
pub fn get(app: &AppHandle) -> Option<Window> {
app.get_window(window::SETTINGS)
}