bookclerk_tray
In-process system tray for bookclerkd (opens the web UI in a browser).
- Linux: StatusNotifierItem via
ksni(no GTK/WebKit) - Windows / macOS:
tray-iconwith default features disabled (no GTK)
| Item | Kind | Summary |
|---|---|---|
TrayConfig |
struct | Configuration for the in-process tray (no child bookclerkd process). |
run_blocking |
function | Run the tray on the current thread until the user chooses Quit tray. |
spawn |
function | Start the tray on a dedicated OS thread (safe beside the Tokio HTTP runtime). |
SharedTrayConfig |
type alias | Shared tray config so the daemon can refresh base_url after listen rebinds. |
pub struct TrayConfig {
pub base_url: String,
pub auth_enabled: bool,
pub operator_token: Option<String>,
}
Configuration for the in-process tray (no child bookclerkd process).
Fields
base_url: Daemon HTTP base URL (e.g.http://127.0.0.1:8787).auth_enabled: When true, operator-token auth is required for tray actions.operator_token: Operator bearer token used for authenticated daemon calls.
pub fn base_url(listen: &str) -> String
Builds an HTTP base URL from a daemon listen address.
listen-host:portor an absolutehttp(s)://URL (trailing/stripped).
Absolute base URL with an http:// scheme when listen was host-only.
pub fn ui_url(&self) -> String
Open the UI via a loopback handoff URL that sets the session cookie.
The durable operator token is never placed in the URL. Self::open_ui
POSTs /api/auth/tray-handoff/prepare with Bearer first, then opens the
returned one-time ?code= GET (Linux xdg-open does not need a fragment).
pub fn open_ui(&self) -> Result<()>
Opens the daemon web UI in the default browser.
Returns an error when prepare fails or the OS cannot launch a browser.
pub fn trigger_scan(&self) -> Result<()>
POSTs an authenticated library scan request to the daemon.
Returns an error when the HTTP request fails or the daemon rejects it.
pub fn copy_sign_in_link(&self)
Copy a loopback sign-in link to the clipboard (never the durable token).
pub fn set_listen(&mut self, listen: &str)
Updates the configured daemon listen address used to derive Self::base_url.
listen- Daemon listen address (host:portor URL).
pub fn set_base_url(&mut self, base_url: impl Into<String>)
Overrides the daemon HTTP base URL used for subsequent calls.
base_url- Absolute HTTP base URL for the daemon.
Implements: Clone, Debug
pub fn run_blocking(config: SharedTrayConfig) -> Result<()>
Run the tray on the current thread until the user chooses Quit tray.
config- Loaded Bookclerk configuration.
The successful result value for this operation.
Returns an error when the underlying I/O, parse, network, or store operation fails.
pub fn spawn(config: SharedTrayConfig) -> JoinHandle<Result<()>>
Start the tray on a dedicated OS thread (safe beside the Tokio HTTP runtime).
config- Loaded Bookclerk configuration.
The successful result value for this operation.
Returns an error when the underlying I/O, parse, network, or store operation fails.
Panics when an internal invariant does not hold.
pub type SharedTrayConfig = Arc<Mutex<TrayConfig>>;
Shared tray config so the daemon can refresh base_url after listen rebinds.
Generated from crates/bookclerk-tray at main · View as Markdown