Files
quickshell_bar/widgets/Bar.qml
2026-05-31 09:28:44 +02:00

70 lines
1.7 KiB
QML

import QtQuick
import QtQuick.Layouts
import Quickshell
import "../config"
// One bar instance per monitor.
PanelWindow {
id: panel
required property var modelData
screen: modelData
color: "transparent"
// Auto-rotation flips the output transform and resizes this layer surface
// in place; the old buffer bleeds through the area that isn't fully
// repainted, leaving stale "garbage" pixels. Remapping the surface on any
// geometry change forces Sway to hand us a fresh, fully-painted buffer.
readonly property string geomKey: modelData
? (modelData.width + "x" + modelData.height)
: ""
onGeomKeyChanged: Qt.callLater(function () {
if (!panel.visible) return;
panel.visible = false;
panel.visible = true;
})
anchors {
top: true
left: true
right: true
}
implicitHeight: Theme.barHeight
// background strip
Rectangle {
anchors.fill: parent
color: Theme.barColor
}
// left: workspaces
Workspaces {
anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter
anchors.leftMargin: Theme.gap + 2
screen: panel.modelData
}
// center: clock
Clock {
anchors.centerIn: parent
}
// right: battery, system metrics, volume, tray
RowLayout {
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
anchors.rightMargin: Theme.gap + 2
spacing: Theme.gap
Battery {}
CpuGraph {}
CpuTemp {}
Ram {}
Disk {}
Network {}
Volume {}
Tray { panelWindow: panel }
}
}