mirror of
https://github.com/tinyhumansai/openhuman.git
synced 2026-07-30 23:14:37 +00:00
- Introduced detailed architecture overview outlining system components and entry points. - Documented state management using Redux Toolkit and Redux-Persist, including store configuration and slice structures. - Described services layer architecture, detailing API client, socket service, and MTProto service functionalities. - Explained the Model Context Protocol (MCP) system, including tool categories and implementation examples. - Outlined routing structure and page components, emphasizing protected and public routes. - Organized reusable components by feature, detailing their structure and usage. - Provided insights into provider management for service lifecycle and shared state. This documentation enhances understanding of the application's structure and improves onboarding for new developers, ensuring clarity in the system's design and functionality.
81 lines
2.0 KiB
Rust
81 lines
2.0 KiB
Rust
use tauri::{AppHandle, Manager};
|
|
|
|
/// Show the main window
|
|
#[tauri::command]
|
|
pub fn show_window(app: AppHandle) {
|
|
if let Some(window) = app.get_webview_window("main") {
|
|
let _ = window.show();
|
|
let _ = window.unminimize();
|
|
let _ = window.set_focus();
|
|
}
|
|
}
|
|
|
|
/// Hide the main window
|
|
#[tauri::command]
|
|
pub fn hide_window(app: AppHandle) {
|
|
if let Some(window) = app.get_webview_window("main") {
|
|
let _ = window.hide();
|
|
}
|
|
}
|
|
|
|
/// Toggle window visibility
|
|
#[tauri::command]
|
|
pub fn toggle_window(app: AppHandle) {
|
|
if let Some(window) = app.get_webview_window("main") {
|
|
match window.is_visible() {
|
|
Ok(true) => {
|
|
let _ = window.hide();
|
|
}
|
|
Ok(false) | Err(_) => {
|
|
let _ = window.show();
|
|
let _ = window.unminimize();
|
|
let _ = window.set_focus();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
/// Check if window is visible
|
|
#[tauri::command]
|
|
pub fn is_window_visible(app: AppHandle) -> bool {
|
|
app.get_webview_window("main")
|
|
.and_then(|w| w.is_visible().ok())
|
|
.unwrap_or(false)
|
|
}
|
|
|
|
/// Minimize the main window
|
|
#[tauri::command]
|
|
pub fn minimize_window(app: AppHandle) {
|
|
if let Some(window) = app.get_webview_window("main") {
|
|
let _ = window.minimize();
|
|
}
|
|
}
|
|
|
|
/// Maximize or unmaximize the main window
|
|
#[tauri::command]
|
|
pub fn maximize_window(app: AppHandle) {
|
|
if let Some(window) = app.get_webview_window("main") {
|
|
if window.is_maximized().unwrap_or(false) {
|
|
let _ = window.unmaximize();
|
|
} else {
|
|
let _ = window.maximize();
|
|
}
|
|
}
|
|
}
|
|
|
|
/// Close the main window (triggers minimize on macOS if configured)
|
|
#[tauri::command]
|
|
pub fn close_window(app: AppHandle) {
|
|
if let Some(window) = app.get_webview_window("main") {
|
|
let _ = window.close();
|
|
}
|
|
}
|
|
|
|
/// Set window title
|
|
#[tauri::command]
|
|
pub fn set_window_title(app: AppHandle, title: String) {
|
|
if let Some(window) = app.get_webview_window("main") {
|
|
let _ = window.set_title(&title);
|
|
}
|
|
}
|