This repository has been archived on 2026-11-02. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
dotfiles/mutable_config/quickshell/components/Bar/Bar.qml
T
2026-08-26 23:22:11 +02:00

110 lines
3.1 KiB
QML

import QtQuick
import Quickshell
import Quickshell.Wayland
import Quickshell.Hyprland
import Quickshell.Io
import "../Shared"
PanelWindow {
id: barWindow
// Reference to global state
property QtObject rootState
anchors {
top: true
left: true
right: true
}
margins {
top: Theme.geometry.padding
left: Theme.geometry.padding
right: Theme.geometry.padding
}
exclusiveZone: implicitHeight + margins.top + Theme.geometry.padding
implicitHeight: 40
color: "transparent"
WlrLayershell.layer: WlrLayer.Top
WlrLayershell.namespace: "quickshell-bar"
// Left Pill (Workspaces + Battery)
Rectangle {
id: leftPill
anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter
height: parent.height
width: leftPillRow.width + Theme.geometry.padding * 2
radius: Theme.geometry.pillRadius
color: Theme.colors.surface
border.color: Theme.colors.border
border.width: 1
Row {
id: leftPillRow
anchors.centerIn: parent
spacing: Theme.geometry.spacing
// Workspaces
Row {
spacing: Theme.geometry.spacing
Repeater {
model: Hyprland.workspaces.values
delegate: Rectangle {
width: 24
height: 24
radius: 12
color: modelData.active ? Theme.colors.primary : Theme.colors.surfaceHover
Text {
anchors.centerIn: parent
text: modelData.id
color: modelData.active ? Theme.colors.background : Theme.colors.text
font.family: Theme.font.family
font.pixelSize: 12
font.bold: modelData.active
}
MouseArea {
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
onClicked: modelData.activate()
}
}
}
}
}
}
// Center Pill (Clock)
Rectangle {
id: centerPill
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
height: parent.height
width: clockText.width + Theme.geometry.padding * 4
radius: Theme.geometry.pillRadius
color: Theme.colors.surface
border.color: Theme.colors.border
border.width: 1
SystemClock {
id: clock
precision: SystemClock.Minutes
}
Text {
id: clockText
anchors.centerIn: parent
text: Qt.formatDateTime(clock.date, "hh:mm") // 24h format
color: Theme.colors.text
font.family: Theme.font.family
font.bold: true
}
}
}