repositories / dotfiles
dotfiles
bugabingas dorkfiles
owned by admin
pi/agent/skills/optional/quickshell/examples/07-composite-bar/Bar.qml
Raw// 07-composite-bar/Bar.qml
import QtQuick
import QtQuick.Layouts
import Quickshell
import Quickshell.Services.Pipewire
import Quickshell.Services.UPower
import Quickshell.Hyprland
import Quickshell.Widgets
PanelWindow {
id: bar
anchors { top: true; left: true; right: true }
implicitHeight: 36
color: "#cc1e1e2e"
readonly property var sinkAudio: Pipewire.defaultAudioSink ? Pipewire.defaultAudioSink.audio : null
// Keep Pipewire nodes alive for state binding.
PwObjectTracker { objects: [ Pipewire.defaultAudioSink ] }
SystemClock { id: clock; precision: SystemClock.Seconds }
RowLayout {
anchors.fill: parent
anchors.leftMargin: 12
anchors.rightMargin: 12
spacing: 16
// Left: Hyprland workspace indicator (live from Hyprland IPC).
Text {
color: "white"
font.pointSize: 11
text: Hyprland.focusedWorkspace ? `${Hyprland.focusedWorkspace.id}` : "?"
}
Item { Layout.fillWidth: true }
// Center: SystemClock live time.
Text {
color: "white"
font.pointSize: 11
text: Qt.formatDateTime(clock.date, "HH:mm:ss")
}
Item { Layout.fillWidth: true }
// Right cluster: battery + volume.
Text {
color: "white"
font.pointSize: 11
text: UPower.displayDevice ? `${Math.floor(UPower.displayDevice.chargePercentage * 100)}%` : "n/a"
}
IconImage {
implicitSize: 16
source: Quickshell.iconPath(
bar.sinkAudio && bar.sinkAudio.muted
? "audio-volume-muted-symbolic"
: "audio-volume-high-symbolic"
)
}
Text {
color: "white"
font.pointSize: 11
text: `${Math.floor((bar.sinkAudio ? bar.sinkAudio.volume : 0) * 100)}%`
}
}
}