Files
glassMxrph/docs/architecture.md
T
mxandClaude Opus 5.5 395de70b26 Add native notifications with OSD-style banners and a Control Center module
glassMxrph now owns org.freedesktop.Notifications. Banners drop out of the
bar like the OSD; Control Center stacks history per app like macOS
Notification Center. Do Not Disturb lives in the shell and falls back to
SwayNC while another daemon holds the bus name.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 14:47:40 +02:00

9.4 KiB

Architecture

shell.qml composes modules and exposes IPC; it contains no feature layout. Directory singletons use explicit qmldir registration.

  • services/ConfigService.qml: XDG persistence, defaults and validation.
  • services/ConfigLogic.js: pure merge/validation/update functions, tested separately.
  • theme/ThemeManager.qml: resolves custom, Qt system and Matugen accent sources.
  • theme/Theme.qml: semantic color, shape and motion tokens. Literal theme colors live here.
  • theme/MatugenService.qml: watches validated JSON; retains the last valid palette.
  • core/ShellState.qml: settings routing and active-monitor selection.
  • core/ModuleRegistry.qml: allowlisted bar component URLs; configuration cannot load arbitrary QML.
  • components/: reusable glass primitives.
  • bar/: ordered modules, assigned through configuration to left/center/right.
  • settings/: appearance, tray, dock and about pages.

Phase 1 directly consumes the single native Hyprland model: no subprocess polling. Later services encapsulate media, applications, networking and metrics for all views. Desktop widgets are user-placed (widgets/); none are shown by default. Dock defaults to bottom.

Unknown configuration keys survive saves. Arrays preserve user order rather than index-merging defaults. Future schema migrations must be explicit, tested and must not silently replace pinned apps or configured module arrays. Unknown future schema versions are rejected without overwriting the file.

Distribution boundaries: QML contains no package manager, host name, monitor name, or machine path. Packaging lives under packaging/; ZaneyOS selection belongs in the user's external repository. Optional capabilities must degrade visibly and safely.

Future palette generation: wallpaper event → debounced Matugen job → validate staging JSON → atomic promotion → FileView reload → ThemeManager. One global palette follows a configured monitor. Job generations prevent stale jobs replacing newer requests. Current music artwork must never change the global accent.

Phase 2 tray

TrayService owns the one native SystemTray model, active icon/menu, hover dismissal and popup registry. TrayModule renders only registered SNI items on each bar. TrayMenus owns one root popup and a Hyprland focus grab for outside dismissal. Each submenu uses a lazily instantiated QsMenuOpener and an anchored popup; dormant menus do not retain openers or animation timers. Compositor constraints flip/slide popups at screen edges. The menu stack is closed when its tray delegate disappears or Settings opens. Tray clicks never call the system-area action.

GlassMenu and GlassMenuItem are shared presentation components. TrayMenuItem adapts real QsMenuEntry state; triggering calls the entry's actual triggered() signal. The app remains authoritative for checked state. Empty/asynchronous menus show status text, not made-up application actions.

The optional GLASSMXRPH_TESTING=1 driver imports QtTest for event simulation on fixture icons. It is unloaded in normal operation; QtTest is not a runtime dependency. The fixture runs in a private DBus session and never activates real user applications.

Phase 3 dock

ApplicationsService owns the shared native desktop-entry catalog and launches. HyprlandService adapts the one native toplevel model; focus/close use Wayland handles with validated Hyprland address dispatch as fallback. AppMatching.js and DockGeometry.js contain independently tested pure logic. DockModel groups windows and saved pins; keyed ScriptModel delegates preserve icon identity when focus or geometry changes. DockState owns the single chooser/ context popup and coordinates exclusivity with tray menus and Settings.

ScreenService resolves configured outputs in logical per-screen coordinates. Dock manages placement, edge input and hide transitions. Intelligent mode alone enables a shared 500 ms native geometry refresh; there is no subprocess polling. DockItem handles pointer interactions, neighbour magnification and indicators. DockContextMenu and WindowChooser use the shared glass menu presentation.

Config schema 3 adds defaults without replacing saved pins, module arrays or unknown keys. Invalid object/array types are rejected instead of reset silently. QtTest is loaded only with GLASSMXRPH_DOCK_TESTING=1. The disposable fixture uses Quickshell's AppId pragma and FloatingWindow API.

Phase 4 launcher

Launcher owns only presentation, input and selection. AppSearch consumes the existing shared ApplicationsService; CommandSearch consumes CommandRegistry. Both use pure SearchLogic scoring over pre-normalized catalog fields. Result work stops while the launcher is closed; no subprocess or duplicate application scan is introduced. Launches go through ApplicationsService.

SettingsRegistry defines canonical page IDs, command aliases, labels and phase availability. Settings and CommandRegistry share it, so palette destinations are also reachable normally. Code-owned command extensions may register callbacks; query text is never shell-evaluated. Future pages are explicitly labelled.

LauncherState supplies IPC and owns the window reference. ShellState coordinates opening/closing and captures ScreenService's active output. ScreenService consumes native monitor-focus events eagerly; no focus polling is needed. Dock/tray popups and Settings are dismissed when opening the launcher. Appearance and search preferences are shared ConfigService/Theme values. Width and delayed height animations form the opening search pill and respect reduced motion.

Phase 5 providers

WallpaperService owns discovery, gallery and wallpaper changes. MatugenService observes the selected palette output and serializes generation through ProviderJob, discarding stale results. A short-lived Python helper handles filesystem/provider operations and generated palette files. Settings controls share ConfigService and Theme; Media preferences are ready for the next phase.

Phase 6 media

MediaService is the sole owner of the native MPRIS model, player selection, guarded actions and a shared 500 ms position sampler. It reads Quickshell's locally extrapolated position; it does not poll DBus or spawn playerctl. Sampling stops without visible progress consumers or when paused. MediaCard is shared by Settings and controlcenter/modules/Media.qml; Now Playing uses the same service.

CavaService runs one optional process for all visualizer consumers. The bundled raw configuration leaves audio input selection to Cava, emits 24 bars at 30 fps, and never alters the user's Cava configuration. Its Python launcher execs Cava in place and reports missing executables. Playback pause, hidden views or disabling Cava stop the process; failures do not cause restart loops. Song artwork never changes the global accent.

Phase 7 system controls

ControlCenter is an active-monitor overlay with a registry-driven module layout. ShellState coordinates its visibility with existing shell popups. AudioService, NetworkService and BluetoothService adapt native Quickshell event-driven models. SystemService serializes one-shot JSON provider jobs for visible display/DND/power controls, polling every five seconds only while needed. PowerService owns pending confirmation; it exposes no direct destructive IPC action. The helper also enforces confirmation before logout/reboot/shutdown and uses argv arrays with timeouts.

The same modules are reused by detailed Settings pages. Wi-Fi credentials pass to NetworkManager's native API, not subprocess arguments or shell preferences. BlueZ pairing uses the existing manager. No pairing daemon is registered.

Phase 8 telemetry

MetricsService owns a single demand-driven streaming Python collector. MetricsCard, bar MetricsModule and Settings share its snapshot; no UI component polls sensors. The collector owns monotonic CPU/network deltas and rate-limited GPU/storage reads. A bounded CPU history is kept by the service; missing and stale values remain explicit.

Phase 9 polish

Theme owns contrast selection and reduced-motion intensity. Shared glass components add inexpensive highlights and reversible motion without per-panel blur effects. ScreenService validates captured output references. MetricsService owns bounded restart backoff. The optional compositor example and read-only doctor keep host integration separate from UI state.

Notifications

NotificationService owns the one native NotificationServer (org.freedesktop.Notifications), history (the server's tracked notifications), the banner queue and Do Not Disturb, which is persisted as notifications.doNotDisturb. The server is loaded lazily while enabled. Only one process can own the bus name: the system helper reports the owner, and while another daemon (e.g. SwayNC) holds it the shell stays inactive, says so, and the DND tile controls SwayNC instead.

NotificationPopups shows banners in a bar drawer like the OSD and yields its spot while the OSD is up. Banners time out into history, pause while hovered, and are cleared when Control Center opens. controlcenter/modules/Notifications.qml stacks history per app (macOS Notification Center); NotificationCard is shared by both. Critical notifications stay until dismissed and may break through DND. tests/notifications_runtime.py runs on a private session bus.