quickshell/modules/corners/ScreenCorners.qml
2026-05-17 13:10:05 +02:00

147 lines
5.2 KiB
QML

pragma ComponentBehavior: Bound
import QtQuick
import QtQuick.Shapes
import Quickshell
import Quickshell.Wayland
import qs
import qs.settings
Item {
Variants {
model: Quickshell.screens
delegate: WlrLayershell {
id: tlWin
required property var modelData
screen: modelData
visible: Config.rounding > 0
exclusionMode: ExclusionMode.Ignore
layer: WlrLayer.Overlay
anchors { top: true; left: true }
margins.top: Config.barHeight
implicitWidth: Config.rounding
implicitHeight: Config.rounding
color: "transparent"
Shape {
anchors.fill: parent
preferredRendererType: Shape.CurveRenderer
ShapePath {
fillColor: Qt.rgba(Colors.base00.r, Colors.base00.g, Colors.base00.b, Config.opacity)
strokeWidth: -1
startX: 0; startY: 0
PathLine { x: tlWin.implicitWidth; y: 0 }
PathArc {
x: 0; y: tlWin.implicitHeight
radiusX: tlWin.implicitWidth; radiusY: tlWin.implicitHeight
direction: PathArc.Counterclockwise
}
PathLine { x: 0; y: 0 }
}
}
}
}
// Top-right corners
Variants {
model: Quickshell.screens
delegate: WlrLayershell {
id: trWin
required property var modelData
screen: modelData
visible: Config.rounding > 0
exclusionMode: ExclusionMode.Ignore
layer: WlrLayer.Overlay
anchors { top: true; right: true }
margins.top: Config.barHeight
implicitWidth: Config.rounding
implicitHeight: Config.rounding
color: "transparent"
Shape {
anchors.fill: parent
preferredRendererType: Shape.CurveRenderer
ShapePath {
fillColor: Qt.rgba(Colors.base00.r, Colors.base00.g, Colors.base00.b, Config.opacity)
strokeWidth: -1
startX: 0; startY: 0
PathLine { x: trWin.implicitWidth; y: 0 }
PathLine { x: trWin.implicitWidth; y: trWin.implicitHeight }
PathArc {
x: 0; y: 0
radiusX: trWin.implicitWidth; radiusY: trWin.implicitHeight
direction: PathArc.Counterclockwise
}
PathLine { x: 0; y: 0 }
}
}
}
}
// Bottom-left corners
Variants {
model: Quickshell.screens
delegate: WlrLayershell {
id: blWin
required property var modelData
screen: modelData
visible: Config.rounding > 0
exclusionMode: ExclusionMode.Ignore
layer: WlrLayer.Overlay
anchors { bottom: true; left: true }
implicitWidth: Config.rounding
implicitHeight: Config.rounding
color: "transparent"
Shape {
anchors.fill: parent
preferredRendererType: Shape.CurveRenderer
ShapePath {
fillColor: Qt.rgba(Colors.base00.r, Colors.base00.g, Colors.base00.b, Config.opacity)
strokeWidth: -1
startX: 0; startY: 0
PathArc {
x: blWin.implicitWidth; y: blWin.implicitHeight
radiusX: blWin.implicitWidth; radiusY: blWin.implicitHeight
direction: PathArc.Counterclockwise
}
PathLine { x: 0; y: blWin.implicitHeight }
PathLine { x: 0; y: 0 }
}
}
}
}
// Bottom-right corners
Variants {
model: Quickshell.screens
delegate: WlrLayershell {
id: brWin
required property var modelData
screen: modelData
visible: Config.rounding > 0
exclusionMode: ExclusionMode.Ignore
layer: WlrLayer.Overlay
anchors { bottom: true; right: true }
implicitWidth: Config.rounding
implicitHeight: Config.rounding
color: "transparent"
Shape {
anchors.fill: parent
preferredRendererType: Shape.CurveRenderer
ShapePath {
fillColor: Qt.rgba(Colors.base00.r, Colors.base00.g, Colors.base00.b, Config.opacity)
strokeWidth: -1
startX: brWin.implicitWidth; startY: brWin.implicitHeight
PathLine { x: 0; y: brWin.implicitHeight }
PathArc {
x: brWin.implicitWidth; y: 0
radiusX: brWin.implicitWidth; radiusY: brWin.implicitHeight
direction: PathArc.Counterclockwise
}
PathLine { x: brWin.implicitWidth; y: brWin.implicitHeight }
}
}
}
}
}