Luigit
repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by admin

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

Raw
import QtQuick
import QtQuick.Window
import Quickshell
import "../../.." as N
import "../../../features/config" as ConfigFeature

ShellRoot {
    id: root
    property int entered: 0
    property int left: 0
    N.Theme {
        id: nuguTheme
    }
    N.Registry {
        id: registry
        theme: nuguTheme
    }
    Connections {
        target: registry.popup("config").configuration
        function onEntered() {
            root.entered++;
        }
        function onLeft() {
            root.left++;
        }
    }
    Window {
        visible: true
        width: 632
        height: 552
        Loader {
            id: loader
            anchors.fill: parent
            sourceComponent: registry.popup("config").panel
        }
    }
    Timer {
        interval: 100
        running: true
        onTriggered: {
            const panel = loader.item as ConfigFeature.ConfigPanel;
            if (!panel || panel.naturalHeight <= 0 || !["appearance", "calendar", "light"].every(name => registry.config.sections.some(section => section.name === name)))
                return;
            registry.popup("config").opening();
            registry.config.selectSection("light");
            registry.popup("config").dismissed();
            if (root.entered === 1 && root.left === 1 && !registry.brightness.panelOpen) {
                console.log("load config: PASS");
                Qt.quit();
            }
        }
    }
}