更新代码格式

This commit is contained in:
Tlntin
2022-12-28 13:44:14 +08:00
parent aee2785183
commit 9e7e0a148d
2 changed files with 52 additions and 54 deletions

View File

@@ -10,7 +10,7 @@ use tauri::{
SystemTrayEvent, SystemTrayMenu, Window, WindowBuilder, WindowMenuEvent, WindowUrl, SystemTrayEvent, SystemTrayMenu, Window, WindowBuilder, WindowMenuEvent, WindowUrl,
}; };
mod pake; mod pake;
use pake::pake::PakeConfig; use pake::PakeConfig;
pub fn get_menu() -> Menu { pub fn get_menu() -> Menu {
// first menu // first menu

View File

@@ -1,8 +1,7 @@
pub mod pake { use serde::Deserialize;
use serde::Deserialize;
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
pub struct WindowConfig { pub struct WindowConfig {
pub url: String, pub url: String,
pub transparent: bool, pub transparent: bool,
pub fullscreen: bool, pub fullscreen: bool,
@@ -10,31 +9,31 @@ pub mod pake {
pub height: f64, pub height: f64,
pub resizable: bool, pub resizable: bool,
pub url_type: String, pub url_type: String,
} }
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
pub struct UserAgent { pub struct UserAgent {
pub macos: String, pub macos: String,
pub linux: String, pub linux: String,
pub windows: String, pub windows: String,
} }
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
pub struct FunctionON { pub struct FunctionON {
pub macos: bool, pub macos: bool,
pub linux: bool, pub linux: bool,
pub windows: bool, pub windows: bool,
} }
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
pub struct PakeConfig { pub struct PakeConfig {
pub windows: Vec<WindowConfig>, pub windows: Vec<WindowConfig>,
pub user_agent: UserAgent, pub user_agent: UserAgent,
pub menu: FunctionON, pub menu: FunctionON,
pub system_tray: FunctionON, pub system_tray: FunctionON,
} }
impl PakeConfig { impl PakeConfig {
pub fn show_menu(&self) -> bool { pub fn show_menu(&self) -> bool {
#[cfg(target_os = "macos")] #[cfg(target_os = "macos")]
let menu_status = self.menu.macos; let menu_status = self.menu.macos;
@@ -54,5 +53,4 @@ pub mod pake {
let tray_status = self.system_tray.windows; let tray_status = self.system_tray.windows;
tray_status tray_status
} }
}
} }