Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Services Overview

Services are the backend layer of ashell. They manage communication with system APIs and produce events that modules consume. Services have no UI.

Available Services

ServiceLocationBackendProtocolRequired Package
Compositorservices/compositor/Hyprland / NiriIPC socketHyprland or Niri
Audioservices/audio.rsPulseAudiolibpulse C libraryPulseAudio or PipeWire-Pulse
Brightnessservices/brightness.rssysfs + logindFile I/O + D-Bussystemd-logind
Bluetoothservices/bluetooth/BlueZD-Busbluez
Networkservices/network/NetworkManager / IWDD-Busnetworkmanager or iwd
MPRISservices/mpris/Media playersD-BusMPRIS-compatible player
Trayservices/tray/StatusNotifierItemD-Bus
UPowerservices/upower/UPower daemonD-Busupower
Privacyservices/privacy.rsPipeWirePipeWire portalspipewire
Idle Inhibitorservices/idle_inhibitor.rssystemd-logindD-Bussystemd-logind
Logindservices/logind.rssystemd-logindD-Bussystemd-logind
Throttleservices/throttle.rs(utility)Stream adapter
XDG Iconsservices/xdg_icons.rs(utility)XDG icon theme

Shared Icon Resolution

services/xdg_icons.rs is a shared helper (not an event-producing service) used by both the tray and the workspaces module to turn an identifier into a displayable icon. Given a name it resolves an XdgIcon (Image, Svg, or a NerdFont glyph fallback) via the XDG icon theme, a fuzzy/prefix match against the installed icon set, and a .desktop StartupWMClass index.

Each consumer keeps its own concern on top of this core: the tray handles raw D-Bus pixmaps, while the workspaces module lowercases the window class before lookup. Results are memoized in a process-wide cache, and the underlying indexes are built lazily; warm_cache_async pre-builds them off the UI thread when a consumer is active.

Services vs. Modules

AspectModuleService
Has UIYes (view())No
Interacts with systemNo (consumes services)Yes
Has Message typeYesHas UpdateEvent + ServiceEvent
Defined byConventionReadOnlyService / Service trait
Runs onMain thread (iced event loop)Async (tokio) or dedicated thread

Service Communication Pattern

Service (async/background)
    │
    ▼ ServiceEvent<S>
Module subscription
    │
    ▼ Module::Message
App::update()
    │
    ▼ Service::command() (for bidirectional services)
Service (executes command, returns result)

Threading Model

  • Main thread: iced event loop + rendering
  • Tokio runtime: Most services (D-Bus watchers, timers, IPC)
  • Dedicated OS thread: PulseAudio mainloop (libpulse requires its own event loop)
  • Communication: tokio::sync::mpsc channels between threads, iced channel() for subscriptions