Skip to main content

Crate crabshell_services

Crate crabshell_services 

Source
Expand description

The services a Crabshell bar reads: the clock, Sway’s and Hyprland’s workspaces, audio, the tray, power, notifications, the installed applications, PAM, greetd, a polkit agent and HTTP GET.

The shell calls provide once, with its root context and event loop. After that, any context hands out services through ServicesExt, such as cx.clock(Precision::Minute). Each service starts the first time a config asks for it and is shared by every caller, so two outputs never mean two connections. Its signals belong to the root context’s owner: bars on every output share them, and they go when the shell does.

Asked for on a context the shell didn’t set up, as in a ui test, a service logs once and hands out a value that never changes.

Structs§

Audio
The audio service, from cx.audio(). Cloning it is cheap.
AudioNode
A sink or a source: where sound goes out, such as speakers, or comes in, such as a microphone.
AudioStream
An app playing sound: one of the server’s sink inputs.
AuthRequest
A request from polkit: a program asked to do action_id, and polkit wants a user to prove they may.
Backlight
A backlight in /sys/class/backlight.
Bluetooth
Bluetooth from BlueZ, from cx.bluetooth(). Cloning it is cheap.
BluetoothAdapter
A Bluetooth radio BlueZ knows.
BluetoothAgent
The shell’s Bluetooth pairing agent, from cx.bluetooth_agent(). A clone is cheap and shares the one agent.
BluetoothDevice
A device BlueZ knows: one paired before, or one discovery found.
Brightness
Screen brightness, from cx.brightness(). Cloning it is cheap.
DesktopAction
Something more an application can do, as a launcher’s menu offers it.
DesktopEntries
The installed applications, from cx.desktop_entries(). Cloning it is cheap.
DesktopEntry
An installed application, from its desktop entry.
FileError
Why a file can’t be read, from FileView::error, as Quickshell’s FileViewError.
FileView
A text file, from cx.file_view(path). Its text is read at once and again when it changes on disk. A clone is cheap and shares it.
FolderEntry
A file, directory or link in a folder, from FolderView::entries.
FolderView
A folder’s entries, from cx.folder_view(path), read at the next flush and again when the folder changes. A Copy handle, like a signal.
GreetMessage
An informative or error message greetd sent while a session was made.
Greetd
greetd, from cx.greetd(). A clone is cheap and shares it.
Http
A GET request, from cx.http_get(url). It is a Copy handle, like a signal, and goes with the context that asked.
HttpError
Why a request failed, from Http::error.
Hyprland
The Hyprland service, from cx.hyprland(). A clone is cheap and shares the one connection.
HyprlandEvent
One line from Hyprland’s event socket, such as workspacev2>>2,2, as Quickshell’s HyprlandEvent.
HyprlandMonitor
One of Hyprland’s monitors, as j/monitors describes it.
HyprlandToplevel
One of Hyprland’s windows, as j/clients describes it.
HyprlandWorkspace
One of Hyprland’s workspaces, as j/workspaces describes it.
Locale
The names dates are written with in a locale.
Logind
logind, from cx.logind(). Cloning it is cheap.
MenuEntry
One entry of a Menu.
Mpris
The media players, from cx.mpris(). A clone is cheap and shares the one connection.
Network
Networking from NetworkManager, from cx.network(). Cloning it is cheap.
NetworkDevice
A network device NetworkManager manages, other than loopback.
Niri
The niri service, from cx.niri(). A clone is cheap and shares the one connection.
NiriKeyboardLayouts
niri’s keyboard layouts.
NiriWindow
One of niri’s windows, as its IPC describes it.
NiriWorkspace
One of niri’s workspaces, as its IPC describes it.
Notification
One notification an app sent.
Notifications
The notifications, from cx.notifications(). A clone is cheap and shares the one server.
PairingRequest
What BlueZ asks the shell during a pairing, from BluetoothAgent::request.
Pam
Authentication through a PAM service, from cx.pam(service), as a lock screen does. A clone is cheap and shares it.
Player
A media player and its track, as MPRIS describes them. Text is cut to 4 KiB.
PolkitAgent
The shell’s polkit agent, from cx.polkit_agent(). A clone is cheap and shares the one agent.
PowerDevice
A battery or power supply UPower knows.
PowerProfiles
The power profile, from cx.power_profiles(). Cloning it is cheap.
Process
A program the shell runs, from cx.process(command). A clone is cheap and shares it.
SavedConnection
A connection NetworkManager saved, as for a Wi-Fi network joined before.
Sink
The default sink: where sound goes unless an app picks another.
Socket
A connection to a Unix socket, from cx.socket(path). It connects at once, passes each line it reads to on_line, and writes what write is given. A clone is cheap and shares the connection.
SocketServer
A server on a Unix socket, from cx.socket_server(path), as Quickshell’s SocketServer. It listens from the start and hands each client that connects to on_connection as a Socket. A clone is cheap and shares the server.
Sway
The Sway service, from cx.sway(). A clone is cheap and shares the one connection.
SwayEvent
One event from Sway, as Quickshell’s I3Event, for Sway::on_event.
SwayOutput
One of Sway’s outputs, a monitor, as GET_OUTPUTS describes it and as Quickshell’s I3Monitor does.
SystemStats
The system’s load, from cx.system_stats(period).
Temperature
A temperature sensor’s reading, from SystemStats::temperatures.
Tray
The system tray: one icon button per tray item, in the order the items registered. A left click activates an item, or opens its menu when the item is only a menu. A right click opens the menu, a middle click is the item’s secondary activation, and scrolling over an icon scrolls it.
TrayHost
The tray, from cx.tray(). A clone is cheap and shares the one connection.
TrayItem
One app’s tray icon, as its StatusNotifierItem describes it.
TrayMenu
A tray item’s open menu, from TrayHost::menu.
UPower
UPower’s batteries and power supplies, from cx.upower(). Cloning it is cheap.
WifiNetwork
A Wi-Fi network a device sees.
Workspace
One of Sway’s workspaces, as GET_WORKSPACES describes it.

Enums§

AudioChannel
Where a channel plays, as PulseAudio’s channel map names it, with Quickshell’s names for PwAudioChannel.
AuthState
Where a request’s conversation is.
BatteryState
How a battery is doing, from UPower’s State.
BluetoothAdapterState
Whether an adapter is on, from BlueZ’s PowerState.
BluetoothDeviceState
Whether a device is connected, from BlueZ’s Connected and the calls made through Bluetooth.
CloseReason
Why a notification closed, from Notifications::on_closed. Its app hears the same in NotificationClosed.
ConnectionFailReason
Why a device’s last try to connect failed, from the reason NetworkManager gave with its Failed state.
Connectivity
How far the host reaches, from NetworkManager’s Connectivity.
DeviceKind
What a power device is, from UPower’s Type.
FileErrorKind
The kinds of FileError.
GreetState
Where a session being made stands.
HttpErrorKind
The kinds of HttpError.
LoopStatus
What a player does at the end, from MPRIS’s LoopStatus.
MenuToggle
What a toggling menu entry shows.
NetworkKind
What a network device is, from NetworkManager’s DeviceType.
NetworkState
How a network device is doing, from NetworkManager’s State.
PairingKind
What a PairingRequest wants, and the answer it takes.
PamError
Where an attempt that ended in PamResult::Error went wrong.
PamMessage
A line PAM sent during an attempt, from Pam::messages, cut to 4 KiB.
PamResult
How an attempt ended.
PamState
Where an authentication is, from Pam::state.
PeakTarget
What a peak meter listens to, for Audio::peaks.
PerformanceDegradation
Why the performance profile runs slower than it could, from the daemon’s PerformanceDegraded.
PlaybackStatus
Whether a player plays, from MPRIS’s PlaybackStatus.
PowerProfile
A power profile power-profiles-daemon can set.
Precision
How often a clock changes.
SwayEventKind
A kind of event Sway sends, for Sway::on_event. sway-ipc(7) says what each one’s data holds.
Timeout
How long a notification’s popup shows, as its app asks.
TrayCategory
What kind of app a tray item is, from its Category, so a bar can group or order its items.
TrayStatus
Whether a tray item wants to be seen.
Urgency
How urgent a notification is, from its urgency hint.
WifiMode
What a Wi-Fi device does, from NetworkManager’s NM80211Mode.
WifiSecurity
How a Wi-Fi network is secured, from its access point’s flags.

Traits§

IntoCommand
What cx.process and cx.exec_detached run: a Command, or the program and its arguments as a list, such as ["sleep", "30"], as Quickshell’s command is.
ServicesExt
The services a context hands out.

Functions§

provide
Makes the services reachable from cx and every context made from it. The shell calls this once, with its root context and its event loop.