mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2025-12-06 05:25:41 -05:00
54 lines
1.8 KiB
QML
54 lines
1.8 KiB
QML
pragma Singleton
|
|
|
|
pragma ComponentBehavior: Bound
|
|
|
|
import Quickshell
|
|
import QtQuick
|
|
|
|
Singleton {
|
|
id: root
|
|
|
|
function init(leftModel, centerModel, rightModel, left, center, right) {
|
|
const dummy = {
|
|
widgetId: "dummy",
|
|
enabled: true,
|
|
size: 20,
|
|
selectedGpuIndex: 0,
|
|
pciId: "",
|
|
mountPath: "/",
|
|
minimumWidth: true
|
|
}
|
|
leftModel.append(dummy)
|
|
centerModel.append(dummy)
|
|
rightModel.append(dummy)
|
|
|
|
update(leftModel, left)
|
|
update(centerModel, center)
|
|
update(rightModel, right)
|
|
}
|
|
|
|
function update(model, order) {
|
|
model.clear()
|
|
for (var i = 0; i < order.length; i++) {
|
|
var widgetId = typeof order[i] === "string" ? order[i] : order[i].id
|
|
var enabled = typeof order[i] === "string" ? true : order[i].enabled
|
|
var size = typeof order[i] === "string" ? undefined : order[i].size
|
|
var selectedGpuIndex = typeof order[i] === "string" ? undefined : order[i].selectedGpuIndex
|
|
var pciId = typeof order[i] === "string" ? undefined : order[i].pciId
|
|
var mountPath = typeof order[i] === "string" ? undefined : order[i].mountPath
|
|
var minimumWidth = typeof order[i] === "string" ? undefined : order[i].minimumWidth
|
|
var item = {
|
|
widgetId: widgetId,
|
|
enabled: enabled
|
|
}
|
|
if (size !== undefined) item.size = size
|
|
if (selectedGpuIndex !== undefined) item.selectedGpuIndex = selectedGpuIndex
|
|
if (pciId !== undefined) item.pciId = pciId
|
|
if (mountPath !== undefined) item.mountPath = mountPath
|
|
if (minimumWidth !== undefined) item.minimumWidth = minimumWidth
|
|
|
|
model.append(item)
|
|
}
|
|
}
|
|
}
|