Add quiet System Health entry points

This commit is contained in:
Gabriel Brown
2026-08-18 10:19:03 -04:00
parent 8a0a09dbb4
commit d855a26bd9
7 changed files with 245 additions and 2 deletions
+123
View File
@@ -7,6 +7,7 @@ set -euo pipefail
repo_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
settings_dir="$repo_dir/config/dot/quickshell/modules/settings"
bar_dir="$repo_dir/config/dot/quickshell/modules/bar"
fail() {
printf 'health UI contract: %s\n' "$1" >&2
@@ -16,6 +17,21 @@ fail() {
for file in HealthPage.qml HealthSummary.qml HealthCheckRow.qml; do
[[ -f "$settings_dir/$file" ]] || fail "$file is missing"
done
[[ -f "$bar_dir/HealthIndicator.qml" ]] || fail 'HealthIndicator.qml is missing'
python3 - "$bar_dir/Bar.qml" <<'PY' || fail 'health indicator is not immediately before activity in the bar'
import re
import sys
source = open(sys.argv[1], encoding="utf-8").read()
match = re.search(r'HealthIndicator\s*\{.*?\}\s*ActivityIndicator\s*\{', source, re.S)
assert match is not None
PY
! rg -n '#[0-9a-fA-F]{3,8}' "$bar_dir/HealthIndicator.qml" >/dev/null \
|| fail 'health indicator introduced colors outside Theme'
! rg -n 'Behavior|Animation|Transition|pulse|shimmer' "$bar_dir/HealthIndicator.qml" >/dev/null \
|| fail 'health indicator introduced motion'
[[ ! -e "$settings_dir/ServicesPage.qml" ]] || fail 'ServicesPage.qml still exists'
rg -Fq 'HealthPage 1.0 HealthPage.qml' "$settings_dir/qmldir" \
|| fail 'HealthPage is not registered in the Settings QML module'
@@ -108,6 +124,8 @@ import Quickshell
import Quickshell.Io
import QtQuick
import "modules/bar" as BarModule
import qs.config
import qs.modules.settings
import qs.services
@@ -130,6 +148,11 @@ ShellRoot {
id: settingsShell
anchors.fill: parent
}
BarModule.HealthIndicator {
id: healthIndicator
objectName: "health-indicator"
}
}
IpcHandler {
@@ -142,6 +165,58 @@ ShellRoot {
function request(id: string): bool {
return settingsShell.requestHealthAction(id);
}
function indicatorMode(mode: string): bool {
const checkStatus = mode === "healthy" ? "ok" : (mode === "unconfigured" ? "unconfigured" : mode);
const overallStatus = mode === "warning" || mode === "error" ? mode : "healthy";
const snapshot = {
schemaVersion: 1,
generatedAt: "2026-08-18T12:00:00Z",
summary: {
status: overallStatus,
healthy: mode === "healthy" ? 1 : 0,
warnings: mode === "warning" ? 1 : 0,
errors: mode === "error" ? 1 : 0,
unconfigured: mode === "unconfigured" ? 1 : 0
},
context: { session: "hyprland", versions: [] },
checks: [{
id: "desktop.vicinae",
group: "desktop-foundation",
title: "Vicinae",
status: checkStatus,
detail: "Fixture observation."
}]
};
return Health.consumeSnapshot(JSON.stringify(snapshot), Health.acceptedGeneration + 1);
}
function indicatorState(): string {
return JSON.stringify({
visible: healthIndicator.visible,
width: healthIndicator.width,
implicitWidth: healthIndicator.implicitWidth,
issueCount: healthIndicator.issueCount,
statusText: healthIndicator.statusText,
accessibleLabel: healthIndicator.accessibleLabel,
tooltipText: healthIndicator.tooltipText,
warningTone: healthIndicator.tone === Theme.warn,
errorTone: healthIndicator.tone === Theme.danger,
activeFocusOnTab: healthIndicator.activeFocusOnTab
});
}
function activateIndicator(): string {
ShellState.settingsPage = "home";
ShellState.settingsOpen = false;
const generation = Health.generation;
healthIndicator.activated();
return JSON.stringify({
page: ShellState.settingsPage,
settingsOpen: ShellState.settingsOpen,
refreshRequested: Health.generation > generation || Health.queuedRefresh
});
}
}
}
QML
@@ -231,6 +306,54 @@ jq -e '
' \
>/dev/null <<<"$confirmation_state" || fail 'Quickshell restart did not open confirmation sheet'
for hidden_mode in healthy unconfigured; do
[[ "$(run ipc call health-ui-test indicatorMode "$hidden_mode")" == "true" ]] \
|| fail "$hidden_mode indicator fixture was rejected"
hidden_state="$(run ipc call health-ui-test indicatorState)"
jq -e '
.visible == false
and .width == 0
and .implicitWidth == 0
and .issueCount == 0
' >/dev/null <<<"$hidden_state" \
|| fail "$hidden_mode state reserved bar space: $hidden_state"
done
[[ "$(run ipc call health-ui-test indicatorMode warning)" == "true" ]] \
|| fail 'warning indicator fixture was rejected'
warning_state="$(run ipc call health-ui-test indicatorState)"
jq -e '
.visible == true
and .width > 0
and .implicitWidth > 0
and .issueCount == 1
and .statusText == "1 system health issue"
and .accessibleLabel == "System Health: 1 issue needs attention"
and .tooltipText == "System Health: 1 issue needs attention"
and .warningTone == true
and .errorTone == false
and .activeFocusOnTab == true
' >/dev/null <<<"$warning_state" || fail "warning indicator is not the approved amber accessible capsule: $warning_state"
[[ "$(run ipc call health-ui-test indicatorMode error)" == "true" ]] \
|| fail 'error indicator fixture was rejected'
error_state="$(run ipc call health-ui-test indicatorState)"
jq -e '
.visible == true
and .issueCount == 1
and .accessibleLabel == "System Health: 1 issue requires action"
and .tooltipText == "System Health: 1 issue requires action"
and .warningTone == false
and .errorTone == true
' >/dev/null <<<"$error_state" || fail "error indicator is not the approved red accessible capsule: $error_state"
activation_state="$(run ipc call health-ui-test activateIndicator)"
jq -e '
.page == "services"
and .settingsOpen == true
and .refreshRequested == true
' >/dev/null <<<"$activation_state" || fail "indicator activation did not open and refresh System Health: $activation_state"
if rg -i 'QQml|ReferenceError|TypeError|binding loop|failed to load component' "$shell_log"; then
fail 'isolated fixture emitted QML errors or warnings'
fi