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 / Niri / MangoWC / generic WaylandIPC socket / mmsg / Wayland protocolsHyprland, Niri, MangoWC, or any Wayland compositor (generic fallback)
Audioservices/audio.rsPulseAudiolibpulse C libraryPulseAudio or PipeWire-Pulse
Brightnesscrates/ashell-services/src/brightness/ (iced glue in services/brightness.rs)sysfs + logindFile I/O + D-Bussystemd-logind
Bluetoothcrates/ashell-services/src/bluetooth/ (iced glue in services/bluetooth.rs)BlueZD-Busbluez
Networkservices/network/NetworkManager / IWDD-Busnetworkmanager or iwd
MPRISservices/mpris/Media playersD-BusMPRIS-compatible player
Trayservices/tray/StatusNotifierItemD-Bus—
UPowercrates/ashell-services/src/upower/ (iced glue in services/upower.rs)UPower daemonD-Busupower
Notificationsservices/notifications/Notification serverD-Bus—
Privacycrates/ashell-services/src/privacy.rs (iced glue in services/privacy.rs)PipeWire + /dev/video0PipeWire registry + inotifypipewire
Idle Inhibitorcrates/ashell-services/src/idle_inhibitor.rs (iced glue in services/idle_inhibitor.rs)Wayland idle-inhibit-unstable-v1Wayland protocol—
Logindcrates/ashell-services/src/logind.rs (iced glue in services/logind.rs)systemd-logindD-Bussystemd-logind
Throttlecrates/ashell-services/src/throttle.rs(utility)Stream adapter—
XDG Iconscrates/ashell-services/src/xdg_icons.rs (iced glue in services/xdg_icons.rs)(utility)XDG icon theme—

Shared Icon Resolution

xdg_icons is a shared helper (not an event-producing service) used by the tray and the workspaces module to turn an identifier into a displayable icon. Given a name, the ashell-services crate resolves the path of an image or SVG file via the XDG icon theme, then a .desktop index (by StartupWMClass and file name), then a fuzzy/prefix match against the installed icon set. Notifications use only the theme lookup, theme_icon_path.

It returns an IconFile, the path tagged as Image or Svg. The glue in services/xdg_icons.rs turns it into an XdgIcon (Image, Svg, or a NerdFont glyph fallback).

Each consumer keeps its own concern on top of this core: the tray handles raw D-Bus pixmaps and looks names up in the item’s own IconThemePath first (get_icon_from_theme_path, not cached, since apps rewrite those directories), while the workspaces module lowercases the window class before lookup. Theme lookups 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