Luigit
repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by admin

quickshell/nuguland/features/idle/fixtures/load.qml

Raw
import QtQuick
import Quickshell
import "../../.." as N

// `just load-test idle`: the registry's toggle entry bound to the Idle double the
// load harness overlays. The chip starts quiet; each `activated` toggles the
// service through the registry and the bar fields follow. No Bar, compositor,
// input, or pixels.
ShellRoot {
    id: root

    readonly property N.FeatureEntry feature: registry.toggle("idle")
    // The overlaid double's fixture surface; production Idle has no `toggles`.
    readonly property var idleDouble: registry.idle

    function quiet(): bool {
        return !root.feature.barActive && !root.feature.barStrong && !root.idleDouble.inhibited;
    }

    function check(): void {
        const feature = root.feature;
        if (!feature || feature.kind !== "toggle" || feature.panel !== null || registry.popup("idle") !== null || feature.barLabel !== "idle" || !root.quiet()) {
            console.error("ERROR load idle: the toggle entry did not register quiet, without a panel");
            Qt.quit();
            return;
        }
        feature.activated();
        if (!feature.barActive || !feature.barStrong || !root.idleDouble.inhibited || root.idleDouble.toggles !== 1) {
            console.error("ERROR load idle: activation did not keep the system awake");
            Qt.quit();
            return;
        }
        feature.activated();
        if (!root.quiet() || root.idleDouble.toggles !== 2) {
            console.error("ERROR load idle: a second activation did not restore normal idle");
            Qt.quit();
            return;
        }
        console.log("load idle: PASS");
        Qt.quit();
    }

    N.Theme {
        id: nuguTheme
    }

    N.Registry {
        id: registry

        theme: nuguTheme
    }

    Component.onCompleted: Qt.callLater(root.check)
}