pispas_tray_app/
lib.rs

1//! # `pispas_tray_app` — Windows system-tray companion
2//!
3//! Small GUI process that lives in the Windows notification area ("system
4//! tray") and acts as the user-facing front for the background
5//! [`pispas_modules`](../pispas_modules/index.html) service.
6//!
7//! ## What it does
8//!
9//! * Shows a tray icon whose colour/state reflects the health of the
10//!   `pispas-modules` service: green when `BASE/CHECK` over
11//!   `wss://local.unpispas.es:<port>` succeeds, red when it fails.
12//! * Right-click menu:
13//!   * **Open configurator** — launches
14//!     [`pispas-configurator-html`](../pispas_configurator_html/index.html).
15//!   * **Restart service** — calls the elevator (see CLAUDE.md §6) to
16//!     bounce the Windows service.
17//!   * **Quit** — closes the tray only (the service keeps running).
18//! * Surfaces balloon notifications when the underlying service emits an
19//!   error (printer unreachable, cert expired, etc.).
20//!
21//! ## IPC with `pispas-modules`
22//!
23//! The tray talks to the service through the **same WebSocket** that web
24//! clients use:
25//!
26//! ```text
27//!   tray-app  --wss://local.unpispas.es:<port>-->  pispas-modules
28//!             <---  BASE / CHECK / PING  -----
29//! ```
30//!
31//! This keeps everything on one code path — if the tray can reach the
32//! service, so can the browser.
33//!
34//! For platform-specific bits, see [`pispas_tray::PisPasTrayIcon`] and
35//! [`tray_utils`]. The binary entry point lives in `main.rs` alongside
36//! this file.
37
38pub mod tray_utils;
39pub mod pispas_tray;
40
41mod os_type {
42
43    pub mod prelude {
44        pub use crate::tray_utils::{load_icon, open_window};
45        pub use crate::pispas_tray::{PisPasTrayIcon, TrayIconResult};
46    }
47}
48
49
50
51pub const TRY_ICON_LOG_FILE: &str = "tray-app.log";
52pub use os_type::*;