use noctalia screencorners

This commit is contained in:
lucy 2026-05-17 13:10:05 +02:00
commit bc0fab6cb0
3 changed files with 59 additions and 91 deletions

View file

@ -1,5 +1,6 @@
pragma ComponentBehavior: Bound pragma ComponentBehavior: Bound
import QtQuick import QtQuick
import QtQuick.Shapes
import Quickshell import Quickshell
import Quickshell.Wayland import Quickshell.Wayland
import qs import qs
@ -21,28 +22,20 @@ Item {
implicitHeight: Config.rounding implicitHeight: Config.rounding
color: "transparent" color: "transparent"
Canvas { Shape {
id: tlCanvas
anchors.fill: parent anchors.fill: parent
onWidthChanged: requestPaint() preferredRendererType: Shape.CurveRenderer
onPaint: { ShapePath {
var ctx = getContext("2d") fillColor: Qt.rgba(Colors.base00.r, Colors.base00.g, Colors.base00.b, Config.opacity)
var s = width strokeWidth: -1
ctx.clearRect(0, 0, s, s) startX: 0; startY: 0
var c = Colors.base00 PathLine { x: tlWin.implicitWidth; y: 0 }
ctx.fillStyle = Qt.rgba(c.r, c.g, c.b, Config.opacity) PathArc {
ctx.fillRect(0, 0, s, s) x: 0; y: tlWin.implicitHeight
ctx.globalCompositeOperation = "destination-out" radiusX: tlWin.implicitWidth; radiusY: tlWin.implicitHeight
ctx.beginPath() direction: PathArc.Counterclockwise
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 { PathLine { x: 0; y: 0 }
target: Config
function onOpacityChanged() { tlCanvas.requestPaint() }
} }
} }
} }
@ -64,29 +57,21 @@ Item {
implicitHeight: Config.rounding implicitHeight: Config.rounding
color: "transparent" color: "transparent"
Canvas { Shape {
id: trCanvas
anchors.fill: parent anchors.fill: parent
onWidthChanged: requestPaint() preferredRendererType: Shape.CurveRenderer
onPaint: { ShapePath {
var ctx = getContext("2d") fillColor: Qt.rgba(Colors.base00.r, Colors.base00.g, Colors.base00.b, Config.opacity)
var s = width strokeWidth: -1
ctx.clearRect(0, 0, s, s) startX: 0; startY: 0
var c = Colors.base00 PathLine { x: trWin.implicitWidth; y: 0 }
ctx.fillStyle = Qt.rgba(c.r, c.g, c.b, Config.opacity) PathLine { x: trWin.implicitWidth; y: trWin.implicitHeight }
ctx.fillRect(0, 0, s, s) PathArc {
// Punch out quarter-circle from inner corner (0, s) x: 0; y: 0
ctx.globalCompositeOperation = "destination-out" radiusX: trWin.implicitWidth; radiusY: trWin.implicitHeight
ctx.beginPath() direction: PathArc.Counterclockwise
ctx.moveTo(0, s)
ctx.arc(0, s, s, -Math.PI / 2, 0, false)
ctx.closePath()
ctx.fill()
ctx.globalCompositeOperation = "source-over"
} }
Connections { PathLine { x: 0; y: 0 }
target: Config
function onOpacityChanged() { trCanvas.requestPaint() }
} }
} }
} }
@ -107,29 +92,20 @@ Item {
implicitHeight: Config.rounding implicitHeight: Config.rounding
color: "transparent" color: "transparent"
Canvas { Shape {
id: blCanvas
anchors.fill: parent anchors.fill: parent
onWidthChanged: requestPaint() preferredRendererType: Shape.CurveRenderer
onPaint: { ShapePath {
var ctx = getContext("2d") fillColor: Qt.rgba(Colors.base00.r, Colors.base00.g, Colors.base00.b, Config.opacity)
var s = width strokeWidth: -1
ctx.clearRect(0, 0, s, s) startX: 0; startY: 0
var c = Colors.base00 PathArc {
ctx.fillStyle = Qt.rgba(c.r, c.g, c.b, Config.opacity) x: blWin.implicitWidth; y: blWin.implicitHeight
ctx.fillRect(0, 0, s, s) radiusX: blWin.implicitWidth; radiusY: blWin.implicitHeight
// Punch out quarter-circle from inner corner (s, 0) direction: PathArc.Counterclockwise
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 { PathLine { x: 0; y: blWin.implicitHeight }
target: Config PathLine { x: 0; y: 0 }
function onOpacityChanged() { blCanvas.requestPaint() }
} }
} }
} }
@ -150,29 +126,20 @@ Item {
implicitHeight: Config.rounding implicitHeight: Config.rounding
color: "transparent" color: "transparent"
Canvas { Shape {
id: brCanvas
anchors.fill: parent anchors.fill: parent
onWidthChanged: requestPaint() preferredRendererType: Shape.CurveRenderer
onPaint: { ShapePath {
var ctx = getContext("2d") fillColor: Qt.rgba(Colors.base00.r, Colors.base00.g, Colors.base00.b, Config.opacity)
var s = width strokeWidth: -1
ctx.clearRect(0, 0, s, s) startX: brWin.implicitWidth; startY: brWin.implicitHeight
var c = Colors.base00 PathLine { x: 0; y: brWin.implicitHeight }
ctx.fillStyle = Qt.rgba(c.r, c.g, c.b, Config.opacity) PathArc {
ctx.fillRect(0, 0, s, s) x: brWin.implicitWidth; y: 0
// Punch out quarter-circle from inner corner (0, 0) radiusX: brWin.implicitWidth; radiusY: brWin.implicitHeight
ctx.globalCompositeOperation = "destination-out" direction: PathArc.Counterclockwise
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 { PathLine { x: brWin.implicitWidth; y: brWin.implicitHeight }
target: Config
function onOpacityChanged() { brCanvas.requestPaint() }
} }
} }
} }

View file

@ -68,6 +68,7 @@ WrapperRectangle {
Layout.alignment: Qt.AlignBottom Layout.alignment: Qt.AlignBottom
text: root.notification?.body ? root.notification.body : '' text: root.notification?.body ? root.notification.body : ''
elide: Text.ElideRight elide: Text.ElideRight
maximumLineCount: 1
Layout.fillWidth: true Layout.fillWidth: true
opacity: 0.6 opacity: 0.6
} }

View file

@ -2,6 +2,6 @@
barHeight=34 barHeight=34
font=Maple Mono font=Maple Mono
fontSize=16 fontSize=16
opacity=1 opacity=0.5
roudning=20 roudning=16
wallpaper=@Variant(\0\0\0\x11\0\0\0)file:///home/lucy/.wall/walkingcastle.png) wallpaper=@Variant(\0\0\0\x11\0\0\0!file:///home/lucy/.wall/mooon.png)