Two of Section E's small wins. panama-webapp gives a site its own icon, its own window with no browser chrome, and its own launcher entry, which is most of what "installed" means in practice and what both macOS and Windows now ship. It scrapes the site's apple-touch-icon, falls back twice, and never fails an install over a favicon: a web app with a generic icon still works. Names are slugged, so "../../../../tmp/pwn" lands inside the applications directory as tmp-pwn rather than anywhere else, and remove refuses anything without the marker it writes -- sharing a name with a real application must not delete that application. A browser that cannot do app mode is told so rather than handed something that opens an ordinary window and pretends. The charger now announces itself through StatusEvents, which was already the right layer and only wanted a producer. Ambient priority, so Do Not Disturb quiets it, because a charger is exactly what DND is for. A critically low battery is published at a priority DND does not silence, because the one message you must not miss is the one saying the machine is about to stop. Both join the existing silent-startup window rather than announcing the state they found. The keyboard-layout toast the plan also listed is deliberately not built. Hyprland exposes the active keymap but not a change event Quickshell already consumes, so it would need either polling or new event plumbing, and this machine has one layout and could not test it.
49 lines
2.8 KiB
Bash
Executable File
49 lines
2.8 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
set -euo pipefail
|
|
|
|
repo_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
|
|
events="$repo_dir/config/dot/quickshell/services/StatusEvents.qml"
|
|
focus="$repo_dir/config/dot/quickshell/services/FocusSession.qml"
|
|
devices="$repo_dir/config/dot/quickshell/services/DeviceEvents.qml"
|
|
privacy="$repo_dir/config/dot/quickshell/services/PrivacyState.qml"
|
|
|
|
fail() {
|
|
printf 'curated-events policy: %s\n' "$1" >&2
|
|
exit 1
|
|
}
|
|
|
|
rg -q 'action === "open-workspace"' "$events" || fail 'broker cannot route a retained workspace action'
|
|
rg -q 'actionId: "open-workspace"' "$focus" || fail 'focus completion does not retain an actionable workspace destination'
|
|
rg -q 'actionData: String\(finishedWorkspaceId\)' "$focus" || fail 'focus completion omits its workspace id'
|
|
rg -q 'id: discoverySettle' "$devices" || fail 'device discovery has no silent initialization window'
|
|
! rg -Uq 'Component\.onCompleted:[^{\n]*\{[^}]*outputInitialized = true' "$devices" || fail 'output monitoring announces initial discovery'
|
|
rg -Uq 'function clearFixture\(\): void \{[^}]*initialized = false' "$privacy" || fail 'leaving a fixture can emit a false privacy transition'
|
|
|
|
# ── The power transitions ────────────────────────────────────────────────────
|
|
#
|
|
# The charger is a device transition like any other, and joins the same silent
|
|
# startup window: without it, plugging in during login would announce itself
|
|
# while the desktop was still drawing.
|
|
#
|
|
# The two priorities are the actual policy. Do Not Disturb silences anything
|
|
# below importantPriority, which is right for a charger and wrong for a battery
|
|
# that is about to run out -- the one message you must not miss is the one
|
|
# saying the machine is about to stop.
|
|
rg -q 'key: "device-power"' "$devices" \
|
|
|| fail 'nothing announces the charger being connected or removed'
|
|
rg -q 'key: "battery-critical"' "$devices" \
|
|
|| fail 'nothing announces a critically low battery'
|
|
# Bounded any-character rather than "not a brace": the glyph values are
|
|
# \u{...} escapes, so a brace appears between the key and its priority.
|
|
rg -Uq 'key: "device-power"(.|\n){0,400}?priority: StatusEvents\.ambientPriority' "$devices" \
|
|
|| fail 'the charger is not ambient, so Do Not Disturb would not quiet it'
|
|
rg -Uq 'key: "battery-critical"(.|\n){0,400}?priority: StatusEvents\.criticalPriority' "$devices" \
|
|
|| fail 'a critically low battery is silenced by Do Not Disturb'
|
|
rg -q 'root.previousAcOnline = Battery.acOnline;' "$devices" \
|
|
|| fail 'power monitoring does not seed its previous state in the settle window'
|
|
! rg -Uq 'Component\.onCompleted:[^{\n]*\{[^}]*powerInitialized = true' "$devices" \
|
|
|| fail 'power monitoring announces its initial state'
|
|
|
|
printf 'curated-events policy: PASS\n'
|