Files
Aurora/config/aurora/modules/Bar.qml
2026-03-15 20:08:48 -05:00

197 lines
5.1 KiB
QML

import Quickshell // for PanelWindow
import QtQuick // for Text
import QtQuick.Shapes
import QtQuick.Controls
import QtQuick.Layouts
import Quickshell.Io
import Quickshell.Widgets
import Quickshell.Wayland
import Quickshell.Hyprland
PanelWindow {
property real radius: 10
onRadiusChanged: Hyprland.dispatch("exec hyprctl keyword decoration:rounding " + radius)
anchors {
top: true
left: true
right: true
bottom: true
}
Component.onCompleted: {
Hyprland.dispatch("exec hyprctl keyword monitor " + Hyprland.monitorFor(root.screen).name + ",addreserved," + topEx + "," + botEx + "," + leftEx + "," + rightEx)
Hyprland.dispatch("exec hyprctl keyword decoration:rounding " + radius)
}
property int topEx: topRect.reserve
property int botEx: botRect.reserve
property int leftEx: leftRect.reserve
property int rightEx: rightRect.reserve
id: root
exclusionMode: ExclusionMode.Ignore
WlrLayershell.layer: WlrLayer.Top
//color: Pywal.special.background
color: "transparent"
mask: Region {
Region {
item: topRect.topRectArea
}
Region {
item: leftRect
}
Region {
item: topRect.midFO.visible ? topRect.midFO : leftRect
}
Region {
item: dash.visible ? dash : leftRect
}
}
BarBottom {
id: botRect
}
BarLeft {
id: leftRect
window: root
}
BarRight {
id: rightRect
}
Shape {
x: leftRect.x + leftRect.width - 1
y: topRect.cornerY
ShapePath {
strokeWidth: 4
strokeColor: Pywal.special.background
fillColor: Pywal.special.background
startX: 0; startY: 0
PathLine { relativeX: 0; relativeY: radius }
PathArc {
radiusX: radius
radiusY: -radius
relativeX: radius
relativeY: -radius
}
PathLine { relativeX: -radius; relativeY: 0 }
}
}
Shape {
x: rightRect.x + 1
y: topRect.cornerY
ShapePath {
strokeWidth: 4
strokeColor: Pywal.special.background
fillColor: Pywal.special.background
startX: 0; startY: 0
PathLine { relativeX: 0; relativeY: radius }
PathArc {
direction: PathArc.Counterclockwise
radiusX: radius
radiusY: radius
relativeX: -radius
relativeY: -radius
}
PathLine { relativeX: radius; relativeY: 0 }
}
}
Shape {
x: leftRect.x + leftRect.width - 1
y: botRect.y + 1
ShapePath {
strokeWidth: 4
strokeColor: Pywal.special.background
fillColor: Pywal.special.background
startX: 0; startY: 0
PathLine { relativeX: 0; relativeY: -radius }
PathArc {
direction: PathArc.Counterclockwise
radiusX: radius
radiusY: radius
relativeX: radius
relativeY: radius
}
PathLine { relativeX: -radius; relativeY: 0 }
}
}
Shape {
x: rightRect.x + 1
y: botRect.y + 1
ShapePath {
strokeWidth: 4
strokeColor: Pywal.special.background
fillColor: Pywal.special.background
startX: 0; startY: 0
PathLine { relativeX: 0; relativeY: -radius }
PathArc {
radiusX: radius
radiusY: -radius
relativeX: -radius
relativeY: radius
}
PathLine { relativeX: radius; relativeY: 0 }
}
}
BarTop {
id: topRect
x: leftRect.x + leftRect.width
width: rightRect.x - x
//y: topRect.y + topRect.height - 1
window: root
radius: root.radius
onShowDashChanged: dash.visible = showDash
}
onTopExChanged: Hyprland.dispatch("exec hyprctl keyword monitor " + Hyprland.monitorFor(root.screen).name + ",addreserved," + topEx + "," + botEx + "," + leftEx + "," + rightEx)
onBotExChanged: Hyprland.dispatch("exec hyprctl keyword monitor " + Hyprland.monitorFor(root.screen).name + ",addreserved," + topEx + "," + botEx + "," + leftEx + "," + rightEx)
onRightExChanged: Hyprland.dispatch("exec hyprctl keyword monitor " + Hyprland.monitorFor(root.screen).name + ",addreserved," + topEx + "," + botEx + "," + leftEx + "," + rightEx)
onLeftExChanged: Hyprland.dispatch("exec hyprctl keyword monitor " + Hyprland.monitorFor(root.screen).name + ",addreserved," + topEx + "," + botEx + "," + leftEx + "," + rightEx)
Dashboard {
id: dash
x: root.screen.width / 2 - width / 2
y: topRect.reserve - 1
onVisibleChanged: topRect.showDash = visible
//onEntered: topRect.midFO.visible = true
onHoveredChanged: topRect.midFO.visible = !hovered
radius: root.radius
}
}