1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
//! Tray icons for the Hyprforge suite, over `org.kde.StatusNotifierItem`.
//!
//! A tray icon is a D-Bus object, not a toolkit widget. That is what makes
//! this possible inside a suite that forbids GTK and Qt everywhere: the
//! icon is a *name*, resolved by whichever bar is running against the
//! user's own icon theme, and this crate owns no pixels at all.
//!
//! The library half knows nothing about Wi-Fi or Bluetooth — it is the
//! protocol and the item model. `src/bin/trayd.rs` is what joins it to
//! `hyprforge-network`, `hyprforge-bluetooth`, `hyprforge-power`,
//! hyprsunset and `hyprforge-displayd` — see its own module doc.
//!
//! # Two ways to serve a right-click menu
//!
//! The menu is drawn by `hyprforge-traymenu`, a sibling `PopupApp`
//! binary that this crate's `ItemInterface::context_menu` (in `sni.rs`)
//! spawns and hands the menu to over a pipe — see `launch`'s own module
//! doc for the whole sequence. That is what makes the menu themed like
//! the rest of the suite, anchored below the bar at the icon that was
//! clicked, with a configurable offset — none of which
//! `com.canonical.dbusmenu` gives a daemon any say over, since drawing
//! and positioning are entirely the host's job under that protocol.
//!
//! The popup needs Hyprland (it reads the monitors through `hyprctl`) and
//! a bar that calls `ContextMenu` on an item that declares no `Menu`
//! property. Where either is missing, this crate serves
//! `com.canonical.dbusmenu` instead ([`dbusmenu`]), and the bar draws the
//! menu itself, styled and placed however its tray module chooses. Which
//! one is a `tray.toml` choice, `auto` by default — see
//! [`prefs::MenuMode`]. An earlier version served only the popup, so a bar
//! on another compositor showed icons with no menu at all; every
//! component of this suite has to work with its siblings, and its
//! compositor, absent.
//!
//! `menu` and `item` are the plain-data model of what a menu and an item
//! are, with no D-Bus in sight. Both paths serve the same `Menu`, with the
//! same row ids and the same action strings, and `hyprforge-traymenu`
//! depends on this crate for exactly those two modules.
pub use OPENED_PREFIX;
pub use ;
pub use ;
pub use ;