182 lines
6.3 KiB
QML
182 lines
6.3 KiB
QML
pragma ComponentBehavior: Bound
|
|
import QtQuick
|
|
import Quickshell
|
|
import Quickshell.Wayland
|
|
import qs
|
|
import qs.settings
|
|
|
|
Item {
|
|
// Top-left corners
|
|
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"
|
|
|
|
Canvas {
|
|
id: tlCanvas
|
|
anchors.fill: parent
|
|
onWidthChanged: requestPaint()
|
|
onPaint: {
|
|
var ctx = getContext("2d")
|
|
var s = width
|
|
ctx.clearRect(0, 0, s, s)
|
|
var c = Colors.base00
|
|
ctx.fillStyle = Qt.rgba(c.r, c.g, c.b, Config.opacity)
|
|
ctx.fillRect(0, 0, s, s)
|
|
// Punch out quarter-circle from inner corner (s, s)
|
|
ctx.globalCompositeOperation = "destination-out"
|
|
ctx.beginPath()
|
|
ctx.moveTo(s, s)
|
|
ctx.arc(s, s, s, Math.PI, 3 * Math.PI / 2, false)
|
|
ctx.closePath()
|
|
ctx.fill()
|
|
ctx.globalCompositeOperation = "source-over"
|
|
}
|
|
Connections {
|
|
target: Config
|
|
function onOpacityChanged() { tlCanvas.requestPaint() }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// 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"
|
|
|
|
Canvas {
|
|
id: trCanvas
|
|
anchors.fill: parent
|
|
onWidthChanged: requestPaint()
|
|
onPaint: {
|
|
var ctx = getContext("2d")
|
|
var s = width
|
|
ctx.clearRect(0, 0, s, s)
|
|
var c = Colors.base00
|
|
ctx.fillStyle = Qt.rgba(c.r, c.g, c.b, Config.opacity)
|
|
ctx.fillRect(0, 0, s, s)
|
|
// Punch out quarter-circle from inner corner (0, s)
|
|
ctx.globalCompositeOperation = "destination-out"
|
|
ctx.beginPath()
|
|
ctx.moveTo(0, s)
|
|
ctx.arc(0, s, s, -Math.PI / 2, 0, false)
|
|
ctx.closePath()
|
|
ctx.fill()
|
|
ctx.globalCompositeOperation = "source-over"
|
|
}
|
|
Connections {
|
|
target: Config
|
|
function onOpacityChanged() { trCanvas.requestPaint() }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// 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"
|
|
|
|
Canvas {
|
|
id: blCanvas
|
|
anchors.fill: parent
|
|
onWidthChanged: requestPaint()
|
|
onPaint: {
|
|
var ctx = getContext("2d")
|
|
var s = width
|
|
ctx.clearRect(0, 0, s, s)
|
|
var c = Colors.base00
|
|
ctx.fillStyle = Qt.rgba(c.r, c.g, c.b, Config.opacity)
|
|
ctx.fillRect(0, 0, s, s)
|
|
// Punch out quarter-circle from inner corner (s, 0)
|
|
ctx.globalCompositeOperation = "destination-out"
|
|
ctx.beginPath()
|
|
ctx.moveTo(s, 0)
|
|
ctx.arc(s, 0, s, Math.PI / 2, Math.PI, false)
|
|
ctx.closePath()
|
|
ctx.fill()
|
|
ctx.globalCompositeOperation = "source-over"
|
|
}
|
|
Connections {
|
|
target: Config
|
|
function onOpacityChanged() { blCanvas.requestPaint() }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// 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"
|
|
|
|
Canvas {
|
|
id: brCanvas
|
|
anchors.fill: parent
|
|
onWidthChanged: requestPaint()
|
|
onPaint: {
|
|
var ctx = getContext("2d")
|
|
var s = width
|
|
ctx.clearRect(0, 0, s, s)
|
|
var c = Colors.base00
|
|
ctx.fillStyle = Qt.rgba(c.r, c.g, c.b, Config.opacity)
|
|
ctx.fillRect(0, 0, s, s)
|
|
// Punch out quarter-circle from inner corner (0, 0)
|
|
ctx.globalCompositeOperation = "destination-out"
|
|
ctx.beginPath()
|
|
ctx.moveTo(0, 0)
|
|
ctx.arc(0, 0, s, 0, Math.PI / 2, false)
|
|
ctx.closePath()
|
|
ctx.fill()
|
|
ctx.globalCompositeOperation = "source-over"
|
|
}
|
|
Connections {
|
|
target: Config
|
|
function onOpacityChanged() { brCanvas.requestPaint() }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|