pub trait ServicesExt {
// Required methods
fn clock(&self, precision: Precision) -> ReadSignal<Zoned>;
fn sway(&self) -> Sway;
fn audio(&self) -> Audio;
fn tray(&self) -> TrayHost;
}Expand description
The services a context hands out.
Required Methods§
Sourcefn clock(&self, precision: Precision) -> ReadSignal<Zoned>
fn clock(&self, precision: Precision) -> ReadSignal<Zoned>
The time, truncated to precision: it changes on each whole second
or minute and holds the one just passed, in the system time zone.
Every caller asking for the same precision gets the same signal.
A minute clock wakes the shell once a minute and at no other time. After a suspend, and when timedated changes the time zone, it is right again at once. A zone changed any other way shows from the next tick.
Sourcefn sway(&self) -> Sway
fn sway(&self) -> Sway
Sway’s workspaces, over the IPC socket at $SWAYSOCK. Every caller
shares one connection, made on the first call.
The list is empty while Sway isn’t there. When SWAYSOCK is unset
or the first connect fails, it stays empty and the service never
wakes the shell. When a working connection closes, the list is
empty until a reconnect, tried every 2 s, works. While connected,
it wakes the shell only when Sway sends something.
Sourcefn audio(&self) -> Audio
fn audio(&self) -> Audio
The audio server’s default sink, with its volume and mute. Every caller shares one connection, which starts on the loop’s next turn and never waits for the server. It wakes the shell only when the server reports a change.
With no server, the sink is None and the service tries again
every 2 s, for up to a minute after startup and after each drop of
a working connection. Then it stops, logs that once and never wakes
the shell again; a restart tries again.
Sourcefn tray(&self) -> TrayHost
fn tray(&self) -> TrayHost
The system tray: every app’s StatusNotifierItem on the session bus. Every caller shares one connection, which starts on the loop’s next turn and never waits for the bus.
The shell runs the StatusNotifierWatcher while no other program does, and otherwise reads the list from the one that runs, taking over when it leaves. With no session bus the list stays empty and the service never wakes the shell. It wakes the shell only when something arrives on the bus for it.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".