use noctalia screencorners
This commit is contained in:
parent
7964387fc8
commit
bc0fab6cb0
3 changed files with 59 additions and 91 deletions
|
|
@ -1,5 +1,6 @@
|
|||
pragma ComponentBehavior: Bound
|
||||
import QtQuick
|
||||
import QtQuick.Shapes
|
||||
import Quickshell
|
||||
import Quickshell.Wayland
|
||||
import qs
|
||||
|
|
@ -21,28 +22,20 @@ Item {
|
|||
implicitHeight: Config.rounding
|
||||
color: "transparent"
|
||||
|
||||
Canvas {
|
||||
id: tlCanvas
|
||||
Shape {
|
||||
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)
|
||||
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() }
|
||||
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 }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -64,29 +57,21 @@ Item {
|
|||
implicitHeight: Config.rounding
|
||||
color: "transparent"
|
||||
|
||||
Canvas {
|
||||
id: trCanvas
|
||||
Shape {
|
||||
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() }
|
||||
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 }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -107,29 +92,20 @@ Item {
|
|||
implicitHeight: Config.rounding
|
||||
color: "transparent"
|
||||
|
||||
Canvas {
|
||||
id: blCanvas
|
||||
Shape {
|
||||
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() }
|
||||
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 }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -150,29 +126,20 @@ Item {
|
|||
implicitHeight: Config.rounding
|
||||
color: "transparent"
|
||||
|
||||
Canvas {
|
||||
id: brCanvas
|
||||
Shape {
|
||||
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() }
|
||||
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 }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ WrapperRectangle {
|
|||
}
|
||||
}
|
||||
ColumnLayout {
|
||||
spacing: 0
|
||||
spacing: 0
|
||||
StyledText {
|
||||
id: title
|
||||
Layout.bottomMargin: 0
|
||||
|
|
@ -68,6 +68,7 @@ WrapperRectangle {
|
|||
Layout.alignment: Qt.AlignBottom
|
||||
text: root.notification?.body ? root.notification.body : ''
|
||||
elide: Text.ElideRight
|
||||
maximumLineCount: 1
|
||||
Layout.fillWidth: true
|
||||
opacity: 0.6
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue