repositories / dotfiles
dotfiles
bugabingas dorkfiles
owned by admin
quickshell/nuguland/Registry.qml
Rawpragma ComponentBehavior: Bound
import QtQuick
import "features/audio" as AudioFeature
import "features/brightness" as BrightnessFeature
import "features/clipboard" as ClipboardFeature
import "features/clock" as ClockFeature
import "features/config" as ConfigFeature
import "features/connectivity" as ConnectivityFeature
import "features/idle" as IdleFeature
import "features/launcher" as LauncherFeature
import "features/media" as MediaFeature
import "features/noko" as NokoFeature
import "features/notifications" as NotificationsFeature
import "features/osd" as OsdFeature
import "features/power" as PowerFeature
import "features/system" as SystemFeature
import "features/tray" as TrayFeature
import "features/vault" as VaultFeature
// The single registration site for registry features. Each entry creates its
// service at startup and binds its panel to typed dependencies; hosts read
// entries by kind and never name a registry feature. IPC stays explicit in shell.qml.
QtObject {
id: root
required property Theme theme
// Host services forwarded to feature services; null means unavailable.
// shell.qml binds every one; fixtures leave them null, except the niri
// integration fixture for the production services it proves natively.
property Lock lockService: null
property Niri niriService: null
property Privilege privilegeService: null
property SurfaceManager surfaces: null
// UPower and PowerProfiles singletons; QtObject is their most specific declarable type.
property QtObject upower: null
property QtObject powerProfiles: null
readonly property OsdFeature.Osd osd: OsdFeature.Osd {}
// Local time for the clock's bar control and panel; IPC reads it too.
readonly property ClockFeature.Time time: ClockFeature.Time {}
// CalDAV events and setup: the clock entry's service; IPC reads it too.
readonly property ClockFeature.CalDav clock: ClockFeature.CalDav {}
readonly property AudioFeature.Audio audio: AudioFeature.Audio {
osdService: root.osd
}
readonly property TrayFeature.Tray tray: TrayFeature.Tray {}
readonly property PowerFeature.Power power: PowerFeature.Power {
upower: root.upower
lockService: root.lockService
niriService: root.niriService
}
readonly property ClipboardFeature.Clipboard clipboard: ClipboardFeature.Clipboard {
surfaces: root.surfaces
niriService: root.niriService
}
readonly property LauncherFeature.Launcher launcher: LauncherFeature.Launcher {}
readonly property NotificationsFeature.Notifications notifications: NotificationsFeature.Notifications {}
readonly property MediaFeature.Media media: MediaFeature.Media {
osdService: root.osd
audioService: root.audio
}
// The ambient light sensor only brightness reads; IPC reaches it here too.
readonly property BrightnessFeature.AmbientLight ambientLight: BrightnessFeature.AmbientLight {
monitoring: root.brightness.sensorWanted
}
readonly property BrightnessFeature.Brightness brightness: BrightnessFeature.Brightness {
osdService: root.osd
niriService: root.niriService
privilegeService: root.privilegeService
ambientLightService: root.ambientLight
}
// Machine resources; AuroraBackdrop and the connectivity panel read it too.
readonly property SystemFeature.Resources system: SystemFeature.Resources {
powerProfiles: root.powerProfiles
isLaptopBattery: root.power.isLaptopBattery
healthPercentage: root.power.isLaptopBattery && root.power.batteryHealth >= 0 ? root.power.batteryHealth : null
batteryPercent: root.power.isLaptopBattery ? root.power.batteryPercent : null
batteryStatus: root.power.batteryStatus
}
// iwd wireless networks and the wired link: the connectivity entry's service;
// Diagnostics reads it too.
readonly property ConnectivityFeature.Network connectivity: ConnectivityFeature.Network {}
// Bluetooth adapter and devices; only the connectivity panel and IPC read it.
readonly property ConnectivityFeature.Bluetooth bluetooth: ConnectivityFeature.Bluetooth {}
// Local speech capture and transcription; Diagnostics and IPC read it too.
readonly property NokoFeature.Noko noko: NokoFeature.Noko {}
// Keep-awake idle inhibitor: the idle toggle's service; IPC reads it too.
readonly property IdleFeature.Idle idle: IdleFeature.Idle {}
// Vaultwarden through the isolated native boundary; copies pause clipboard
// capture. Diagnostics and IPC read it too; shell.qml locks it with the session.
readonly property VaultFeature.Vault vault: VaultFeature.Vault {
clipboardService: root.clipboard
}
readonly property ConfigFeature.Config config: ConfigFeature.Config {
theme: root.theme
entries: root.entries
onOpenRequested: if (root.surfaces)
root.surfaces.openRegisteredPopup("config")
}
readonly property list<FeatureEntry> entries: [
FeatureEntry {
name: "config"
service: root.config
width: 680
height: 600
barIcon: "\u{F0493}"
onOpening: root.config.setOpen(true)
onDismissed: root.config.setOpen(false)
configuration: ConfigFeature.AppearanceConfig {
service: root.config
}
panel: Component {
ConfigFeature.ConfigPanel {
theme: root.theme
configService: root.config
}
}
},
FeatureEntry {
name: "clock"
service: root.clock
configuration: ClockFeature.CalendarConfig {
service: root.clock
}
width: 760
height: 580
barLabel: root.time.compact
barTitle: "calendar"
barIcon: "\u{F00F0}"
barControl: Component {
ClockFeature.ClockBarControl {
theme: root.theme
}
}
// The panel's seconds tick only while it is open; every opening fetches
// the calendar, which refreshes every 15 minutes only while open.
onOpening: {
root.time.secondsShown = true;
root.clock.popupOpen = true;
root.clock.refresh();
}
onDismissed: {
root.time.secondsShown = false;
root.clock.popupOpen = false;
}
panel: Component {
ClockFeature.ClockPanel {
theme: root.theme
timeService: root.time
caldavService: root.clock
onConfigureRequested: root.config.requestSection("calendar")
width: parent ? parent.width : 0
}
}
},
FeatureEntry {
name: "launcher"
service: root.launcher
width: 760
height: 432
// The panel's sessionState: query, selection, scroll and the details disclosure it keeps current.
retainedState: ({
"query": "",
"selectedId": "",
"scrollY": 0,
"detailsExpanded": false
})
barLabel: "apps"
barTitle: "launcher"
barIcon: "\u{F003B}"
panel: Component {
LauncherFeature.LauncherPanel {
theme: root.theme
launcherService: root.launcher
}
}
},
FeatureEntry {
name: "media"
service: root.media
onOpening: root.media.panelOpen = true
onDismissed: root.media.panelOpen = false
width: 560
height: 420
empty: !root.media.hasPlayers
barActive: root.media.playing
barIcon: "\u{F0387}"
panel: Component {
MediaFeature.MediaPanel {
theme: root.theme
mediaService: root.media
width: parent ? parent.width : 0
}
}
},
FeatureEntry {
name: "noko"
service: root.noko
configuration: NokoFeature.NokoConfig {
service: root.noko
}
width: 640
height: 560
// Blocked setup keeps the name: strong warning emphasis says it, like
// system and power, and the vertical badge marks it. An armed wake
// word holds the microphone open: the activity dot, the microphone
// glyph on a vertical bar and the title say so without opening.
barTitle: root.noko.wakeListening ? "noko dictation · microphone on" : "noko dictation"
barIcon: root.noko.wakeListening ? "\u{F036C}" : "\u{F147D}"
barBadge: root.noko.blocked ? "!" : ""
barActive: root.noko.active
barStrong: root.noko.strong
barRole: root.noko.role
// From the start of a capture, while the engine still loads, to its text.
barBusy: root.noko.dictating
// History scroll stays as the user left it.
retainedState: ({
"scrollY": 0
})
// The engine is rechecked at startup, on each opening and on entering
// Config, and looked for updates at startup and at most daily on
// opening; nothing polls while the popup is closed.
onOpening: root.noko.refresh()
// The capture status tab on the focused output while starting,
// capturing or transcribing with the newest words, or briefly after
// finishing with the typed text or failing with the reason.
focusOverlayShown: root.noko.overlayState.length > 0
focusOverlay: Component {
NokoFeature.NokoFocusOverlay {
theme: root.theme
nokoService: root.noko
}
}
panel: Component {
NokoFeature.NokoPanel {
theme: root.theme
nokoService: root.noko
onConfigureRequested: root.config.requestSection("noko")
}
}
},
FeatureEntry {
name: "system"
service: root.system
onOpening: root.system.popupOpen = true
onDismissed: root.system.popupOpen = false
width: 780
// Current problems or all ok, live metrics with top processes, incident
// history, machine disclosure.
height: 600
// The machine and incident details disclosures stay as the user left them;
// without scrollY every opening starts at the lead (NL-SPEC-37DAB33A).
retainedState: ({
"machineExpanded": false,
"expandedIncident": ""
})
// Current problems only, never history: errors make the chip strong,
// warnings show a dot, both in the warning colour.
barActive: root.system.attention.length > 0
barStrong: root.system.attention === "error"
barRole: root.system.attention.length > 0 ? "warning" : "ui.accent"
barIcon: "\u{F029A}"
panel: Component {
SystemFeature.SystemPanel {
theme: root.theme
resourceService: root.system
width: parent ? parent.width : 0
}
}
},
FeatureEntry {
name: "clipboard"
service: root.clipboard
width: 520
height: 560
// The panel's sessionState: query, selection and scroll it keeps current.
retainedState: ({
"query": "",
"selectedId": "",
"scrollY": 0
})
barLabel: "clips"
// Private mode pauses capture: the chip keeps saying so after the popup
// closes, with the warning mark rather than the activity dot, so a
// forgotten pause reads at a glance; the vertical bar shows eye-off.
barTitle: root.clipboard.privateMode ? "clipboard paused" : "clipboard"
barActive: root.clipboard.privateMode
barRole: root.clipboard.privateMode ? "warning" : "ui.accent"
barIcon: root.clipboard.privateMode ? "\u{F161B}" : "\u{F0A38}"
panel: Component {
ClipboardFeature.ClipboardPanel {
theme: root.theme
clipboardService: root.clipboard
onPasteRequested: id => root.clipboard.paste(id)
width: parent ? parent.width : 0
}
}
},
FeatureEntry {
name: "vault"
service: root.vault
configuration: VaultFeature.VaultConfig {
service: root.vault
}
width: 840
height: 580
// The service retains query, selection and both scroll positions across
// close and reload; locking clears them.
retainedState: ({})
barActive: root.vault.unlocked
barIcon: "\u{F0BC5}"
// Browser context for search: the focused application at every opening.
onOpening: {
root.vault.panelOpen = true;
root.vault.prepareOpen(root.niriService ? root.niriService.focusedAppId : "");
}
onDismissed: root.vault.panelOpen = false
panel: Component {
VaultFeature.VaultPanel {
theme: root.theme
vaultService: root.vault
onConfigureRequested: root.config.requestSection("vault")
width: parent ? parent.width : 0
height: parent ? parent.height : 0
}
}
},
FeatureEntry {
name: "audio"
service: root.audio
width: 488
height: 520
empty: !root.audio.hasDevices
retainedState: ({
"scrollY": 0,
"expandedSink": "",
"expandedSource": ""
})
// Microphone or camera in use keeps the chip's name and width: the
// activity dot marks it, the tooltip says which, and on a vertical
// bar the camera, then microphone glyph replaces the speaker.
barTitle: {
const devices = [root.audio.cameraInUse ? "camera" : "", root.audio.microphoneInUse ? "microphone" : ""].filter(device => device.length > 0);
return devices.length > 0 ? `${devices.join(" and ")} in use` : "audio";
}
barIcon: barTitle.includes("camera") ? "\u{F05A0}" : (barTitle.includes("microphone") ? "\u{F036C}" : "\u{F057E}")
barActive: root.audio.privacyActive
panel: Component {
AudioFeature.AudioPanel {
theme: root.theme
audioService: root.audio
width: parent ? parent.width : 0
}
}
},
FeatureEntry {
name: "brightness"
service: root.brightness
width: 488
height: 420
barLabel: "light"
barTitle: "brightness"
barIcon: "\u{F00DF}"
// The open threshold editor, its drafts and expanded setup steps survive close and switch.
retainedState: ({
"scrollY": 0,
"expandedBucket": -1,
"lowerDraft": "",
"upperDraft": ""
})
// The sensor is probed only while the popup is open or adaptive mode needs it.
onOpening: root.brightness.panelOpen = true
onDismissed: root.brightness.panelOpen = false
panel: Component {
BrightnessFeature.BrightnessPanel {
theme: root.theme
brightnessService: root.brightness
onConfigureRequested: root.config.requestSection("light")
}
}
configuration: BrightnessFeature.LightConfig {
service: root.brightness
}
},
FeatureEntry {
name: "connectivity"
service: root.connectivity
onOpening: root.system.liveRates = true
onDismissed: root.system.liveRates = false
width: 620
height: 540
// The SSID whose drawer is open survives; its passphrase never does.
retainedState: ({
"scrollY": 0,
"expandedSsid": ""
})
barLabel: "network"
// Offline (no link of any kind: no wired carrier, no wireless network
// joined) needs the user: a warning-tinted strong chip and the wifi-off
// glyph. A wired link without wireless shows the ethernet glyph.
barTitle: root.connectivity.offline ? "network offline" : "network and bluetooth"
barIcon: root.connectivity.offline ? "\u{F05AA}" : (!root.connectivity.wifiJoined && root.connectivity.wiredState === "connected" ? "\u{F0200}" : "\u{F05A9}")
barActive: root.connectivity.offline
barStrong: root.connectivity.offline
barRole: root.connectivity.offline ? "warning" : "ui.accent"
panel: Component {
ConnectivityFeature.ConnectivityPanel {
theme: root.theme
resourceService: root.system
networkService: root.connectivity
bluetoothService: root.bluetooth
width: parent ? parent.width : 0
}
}
},
FeatureEntry {
name: "power"
service: root.power
width: 368
// The card fits session actions, the battery, device chips and an
// armed confirmation; many devices scroll.
height: 560
onDismissed: root.power.cancelAction()
// Only a low battery that is not charging asks for attention: a dot
// when low, a strong chip when critical, both in the warning colour.
barActive: root.power.batteryAttention.length > 0
barStrong: root.power.batteryAttention === "error"
barRole: root.power.batteryAttention.length > 0 ? "warning" : "ui.accent"
barTitle: root.power.batteryAttention.length > 0 ? "battery low" : "power"
// nf-md-battery_alert while low, nf-md-power otherwise.
barIcon: root.power.batteryAttention.length > 0 ? "\u{F0083}" : "\u{F0425}"
panel: Component {
PowerFeature.PowerPanel {
theme: root.theme
powerService: root.power
width: parent ? parent.width : 0
}
}
},
FeatureEntry {
name: "notifications"
service: root.notifications
width: 560
height: 460
// Reply drafts live in the service, so close and reopen keep them.
barLabel: "alerts"
// Do not disturb swallows toasts, so like keep-awake it takes strong
// emphasis while on, and the vertical bar shows the crossed bell
// (nf-md-bell_off), so a forgotten one is seen at a glance.
barTitle: root.notifications.dnd ? "do not disturb on" : "notifications"
barIcon: root.notifications.dnd ? "\u{F009B}" : "\u{F009C}"
barActive: root.notifications.unreadCount > 0 || root.notifications.dnd
barStrong: root.notifications.dnd
// Closing the history marks what it showed read: those cards turn
// neutral and the chip loses its dot until something new arrives.
onDismissed: root.notifications.markAllRead()
panel: Component {
NotificationsFeature.NotificationGroup {
theme: root.theme
notificationService: root.notifications
width: parent ? parent.width : 0
}
}
},
FeatureEntry {
name: "tray"
service: root.tray
width: 520
height: 440
empty: root.tray.itemCount === 0
barLabel: "tray"
barActive: root.tray.attentionCount > 0
// Attention matches the panel's warning-tinted card.
barRole: root.tray.attentionCount > 0 ? "warning" : "ui.accent"
barTitle: "app tray"
barIcon: "\u{F1296}"
barBadge: root.tray.attentionCount > 0 ? String(Math.min(root.tray.attentionCount, 99)) : ""
panel: Component {
TrayFeature.TrayPanel {
theme: root.theme
trayService: root.tray
width: parent ? parent.width : 0
}
}
},
FeatureEntry {
name: "idle"
kind: "toggle"
service: root.idle
// Keep-awake pops louder than a dot: a tinted, bordered chip while on.
barActive: root.idle.inhibited
barStrong: root.idle.inhibited
barTitle: "keep awake"
barIcon: "\u{F0176}"
onActivated: root.idle.toggle()
},
FeatureEntry {
name: "osd"
kind: "overlay"
service: root.osd
width: 316
overlayShown: root.osd.visibleState
panel: Component {
OsdFeature.OsdPanel {
theme: root.theme
osdService: root.osd
}
}
}
]
// Entries by controller kind: popups for SurfaceManager and PopupHost,
// overlays for OverlayHost, toggles for Bar. A kind without a host is a
// registration error.
readonly property var popups: root.ofKind("popup")
readonly property var overlays: root.ofKind("overlay")
readonly property var toggles: root.ofKind("toggle")
// Entries of any kind with a focus overlay, for OverlayHost.
readonly property var focusOverlays: Array.from(root.entries).filter(feature => feature.focusOverlay !== null)
// Popup entries with their own bar presentation, for Bar's end slot.
readonly property var barControls: root.popups.filter(feature => feature.barControl !== null)
// Names of the Bar's usage-ordered chips: popups without their own bar
// control, and toggles, in registration order (Usage's tie-break).
readonly property var chips: Array.from(root.entries).filter(feature => (feature.kind === "popup" && feature.barControl === null) || feature.kind === "toggle").map(feature => feature.name)
function ofKind(kind: string): var {
return Array.from(root.entries).filter(feature => feature.kind === kind);
}
function find(features: var, name: var): FeatureEntry {
const key = String(name);
for (const feature of features)
if (feature.name === key)
return feature;
return null;
}
// Popup entries only: the popup host can never open an overlay by name.
function popup(name: var): FeatureEntry {
return root.find(root.popups, name);
}
function overlay(name: var): FeatureEntry {
return root.find(root.overlays, name);
}
function toggle(name: var): FeatureEntry {
return root.find(root.toggles, name);
}
}