works with macos native ui

This commit is contained in:
Ultradesu
2025-07-22 12:50:01 +03:00
parent af6c4d7e61
commit 07ff4454d2
8 changed files with 4438 additions and 67 deletions

View File

@@ -2,6 +2,7 @@ mod client;
mod db;
mod server;
mod web;
mod gui;
use clap::Parser;
use env_logger;
@@ -31,6 +32,14 @@ struct Args {
#[arg(long, help = "Run in server mode")]
server: bool,
/// Run with GUI tray interface (default: false)
#[arg(long, help = "Run with GUI tray interface")]
gui: bool,
/// Run settings UI window (used with --gui)
#[arg(long, help = "Run settings UI window (used with --gui)")]
settings_ui: bool,
/// Update the known_hosts file with keys from the server after sending keys (default: false)
#[arg(
long,
@@ -128,10 +137,26 @@ async fn main() -> std::io::Result<()> {
let args = Args::parse();
// Check if we have the minimum required arguments
if !args.server && (args.host.is_none() || args.flow.is_none()) {
// Neither server mode nor client mode properly configured
eprintln!("Error: You must specify either server mode (--server) or client mode (--host and --flow)");
// Settings UI mode - just show settings window and exit
if args.settings_ui {
info!("Running settings UI window");
gui::run_settings_window();
return Ok(());
}
// GUI mode has priority
if args.gui {
info!("Running in GUI mode");
if let Err(e) = gui::run_gui().await {
error!("Failed to run GUI: {}", e);
}
return Ok(());
}
// Check if we have the minimum required arguments for server/client mode
if !args.server && !args.gui && (args.host.is_none() || args.flow.is_none()) {
// Neither server mode nor client mode nor GUI mode properly configured
eprintln!("Error: You must specify either server mode (--server), client mode (--host and --flow), or GUI mode (--gui)");
eprintln!();
eprintln!("Examples:");
eprintln!(
@@ -142,6 +167,14 @@ async fn main() -> std::io::Result<()> {
" Client mode: {} --host https://khm.example.com --flow work",
env!("CARGO_PKG_NAME")
);
eprintln!(
" GUI mode: {} --gui",
env!("CARGO_PKG_NAME")
);
eprintln!(
" Settings window: {} --gui --settings-ui",
env!("CARGO_PKG_NAME")
);
eprintln!();
eprintln!("Use --help for more information.");
std::process::exit(1);