app menu window

This commit is contained in:
2025-12-08 21:49:30 +08:00
parent 9c4a407820
commit 76d19aa5e6
17 changed files with 301 additions and 147 deletions

View File

@@ -0,0 +1,43 @@
use tauri::Manager;
use tracing::{error, info};
use crate::get_app_handle;
static APP_MENU_WINDOW_LABEL: &str = "app_menu";
pub fn open_app_menu_window() {
let app_handle = get_app_handle();
let existing_webview_window = app_handle.get_window(APP_MENU_WINDOW_LABEL);
if let Some(window) = existing_webview_window {
window.show().unwrap();
return;
}
match tauri::WebviewWindowBuilder::new(
app_handle,
APP_MENU_WINDOW_LABEL,
tauri::WebviewUrl::App("/app-menu".into()),
)
.title("Friendolls")
.inner_size(600.0, 500.0)
.resizable(true)
.decorations(true)
.transparent(true)
.shadow(true)
.visible(true)
.skip_taskbar(false)
.always_on_top(false)
.visible_on_all_workspaces(false)
.build()
{
Ok(window) => {
info!("{} window builder succeeded", APP_MENU_WINDOW_LABEL);
window
}
Err(e) => {
error!("Failed to build {} window: {}", APP_MENU_WINDOW_LABEL, e);
return;
}
};
}

View File

@@ -1,5 +1,5 @@
pub mod app_menu;
pub mod auth;
pub mod cursor;
pub mod preferences;
pub mod scene;
pub mod ws;

View File

@@ -1,35 +0,0 @@
use tracing::{error, info};
use crate::get_app_handle;
pub fn create_preferences_window() {
let webview_window = match tauri::WebviewWindowBuilder::new(
get_app_handle(),
"preferences",
tauri::WebviewUrl::App("/preferences".into()),
)
.title("Friendolls Preferences")
.inner_size(600.0, 500.0)
.resizable(true)
.decorations(true)
.transparent(false)
.shadow(true)
.visible(true)
.skip_taskbar(false)
.always_on_top(false)
.visible_on_all_workspaces(false)
.build()
{
Ok(window) => {
info!("Preferences window builder succeeded");
window
}
Err(e) => {
error!("Failed to build Preferences window: {}", e);
return;
}
};
#[cfg(debug_assertions)]
webview_window.open_devtools();
}

View File

@@ -22,10 +22,18 @@ pub fn overlay_fullscreen(window: &tauri::Window) -> Result<(), tauri::Error> {
Ok(())
}
pub fn create_scene_window() {
pub fn open_scene_window() {
let app_handle = get_app_handle();
let existing_webview_window = app_handle.get_window(SCENE_WINDOW_LABEL);
if let Some(window) = existing_webview_window {
window.show().unwrap();
return;
}
info!("Starting scene creation...");
let webview_window = match tauri::WebviewWindowBuilder::new(
get_app_handle(),
app_handle,
SCENE_WINDOW_LABEL,
tauri::WebviewUrl::App("/scene".into()),
)