mirror of
https://github.com/house-of-vanity/khm.git
synced 2025-08-21 14:27:14 +00:00
UI tray app added
* Works with egui --------- Co-authored-by: Ultradesu <ultradesu@hexor.cy>
This commit is contained in:
committed by
GitHub
parent
af6c4d7e61
commit
99a277088a
43
src/gui/mod.rs
Normal file
43
src/gui/mod.rs
Normal file
@@ -0,0 +1,43 @@
|
||||
use log::info;
|
||||
|
||||
// Modules
|
||||
mod api;
|
||||
mod admin;
|
||||
mod common;
|
||||
|
||||
#[cfg(feature = "gui")]
|
||||
mod settings;
|
||||
#[cfg(feature = "gui")]
|
||||
mod tray;
|
||||
|
||||
// Re-exports for backward compatibility and external usage
|
||||
#[cfg(feature = "gui")]
|
||||
pub use settings::run_settings_window;
|
||||
#[cfg(feature = "gui")]
|
||||
pub use tray::run_tray_app;
|
||||
|
||||
// User events for GUI communication
|
||||
#[cfg(feature = "gui")]
|
||||
#[derive(Debug)]
|
||||
pub enum UserEvent {
|
||||
TrayIconEvent,
|
||||
MenuEvent(tray_icon::menu::MenuEvent),
|
||||
ConfigFileChanged,
|
||||
UpdateMenu,
|
||||
}
|
||||
|
||||
/// Run GUI application in tray mode
|
||||
#[cfg(feature = "gui")]
|
||||
pub async fn run_gui() -> std::io::Result<()> {
|
||||
info!("Starting KHM tray application");
|
||||
run_tray_app().await
|
||||
}
|
||||
|
||||
/// Stub function when GUI is disabled
|
||||
#[cfg(not(feature = "gui"))]
|
||||
pub async fn run_gui() -> std::io::Result<()> {
|
||||
return Err(std::io::Error::new(
|
||||
std::io::ErrorKind::Unsupported,
|
||||
"GUI features not compiled. Install system dependencies and rebuild with --features gui"
|
||||
));
|
||||
}
|
Reference in New Issue
Block a user