repositories / dotfiles
dotfiles
bugabingas dorkfiles
owned by admin
quickshell/nuguland/features/brightness/fixtures/load.qml
Rawimport QtQuick
import QtQuick.Window
import Quickshell
import "../../.." as N
import "../../../features/brightness" as BrightnessFeature
// `just load-test brightness`: the registry entry's own panel, bound to the
// brightness double the load harness overlays. The panel renders the double's
// display, follows it into a DDC setup state without global controls, and back.
// The entry's opening and dismissal start and stop sensor discovery.
// No backlight, DDC, sensor, compositor, input, or pixels.
ShellRoot {
id: root
readonly property N.FeatureEntry feature: registry.popup("brightness")
property int step: 0
// The overlaid doubles' fixture surface; production services have no setState.
readonly property var brightnessDouble: registry.brightness
readonly property var sensorDouble: registry.ambientLight
function finish(): void {
const panel = loader.item as BrightnessFeature.BrightnessPanel;
if (!panel || panel.contentHeight <= 0)
return;
if (root.step === 0 && panel.hasGlobal && panel.brightnessService.displays.length === 1 && root.feature.height === 420 && root.sensorDouble.monitoring) {
root.step = 1;
root.brightnessDouble.setState({
"displays": [
{
"id": "ddc:DP-1",
"name": "fixture monitor",
"controllable": false,
"issue": "needs setup"
}
],
"global": {
"mode": "none",
"level": 0,
"levels": []
},
"setup": {
"needed": true,
"available": true
}
});
} else if (root.step === 1 && !panel.hasGlobal && panel.brightnessService.setupNeeded && panel.brightnessService.displays.length === 1 && panel.brightnessService.displays[0].id === "ddc:DP-1") {
root.step = 2;
root.brightnessDouble.setState(null);
} else if (root.step === 2 && panel.hasGlobal && panel.brightnessService.displays[0].id === "fixture-display") {
root.step = 3;
root.feature.dismissed();
} else if (root.step === 3 && !root.sensorDouble.monitoring) {
console.log("load brightness: PASS");
Qt.quit();
}
}
// The host emits this when it opens the popup.
Component.onCompleted: root.feature.opening()
N.Theme {
id: nuguTheme
}
N.Registry {
id: registry
theme: nuguTheme
}
// Plain Window: Quickshell windows set input masks the offscreen platform rejects.
Window {
width: 472
height: 404
visible: true
color: "transparent"
Loader {
id: loader
anchors.fill: parent
sourceComponent: root.feature ? root.feature.panel : null
}
}
Timer {
interval: 25
running: true
repeat: true
onTriggered: root.finish()
}
Timer {
interval: 5000
running: true
onTriggered: {
console.error("ERROR load brightness: the panel never followed the double");
Qt.quit();
}
}
}