fix corners
This commit is contained in:
parent
3a6ba994c5
commit
a53616523b
1 changed files with 53 additions and 63 deletions
|
|
@ -3,10 +3,8 @@ import Quickshell
|
||||||
import Quickshell.Wayland
|
import Quickshell.Wayland
|
||||||
import "." as M
|
import "." as M
|
||||||
|
|
||||||
// Empty region = no input area — clicks pass through to windows below
|
|
||||||
|
|
||||||
// Draws rounded black corners at the edges of each screen.
|
// Draws rounded black corners at the edges of each screen.
|
||||||
// Disabled when screenRadius is 0 (the default).
|
// Disabled when screenRadius is 0.
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
|
|
@ -14,74 +12,66 @@ Item {
|
||||||
|
|
||||||
readonly property int _r: M.Theme.screenRadius
|
readonly property int _r: M.Theme.screenRadius
|
||||||
|
|
||||||
Repeater {
|
component Corner: PanelWindow {
|
||||||
model: root._r > 0 ? [
|
id: win
|
||||||
{ top: true, left: true, right: false, bottom: false, corner: 0 },
|
|
||||||
{ top: true, left: false, right: true, bottom: false, corner: 1 },
|
|
||||||
{ top: false, left: true, right: false, bottom: true, corner: 2 },
|
|
||||||
{ top: false, left: false, right: true, bottom: true, corner: 3 }
|
|
||||||
] : []
|
|
||||||
|
|
||||||
delegate: PanelWindow {
|
property int corner: 0
|
||||||
id: cornerWindow
|
|
||||||
|
|
||||||
required property var modelData
|
screen: root.screen
|
||||||
|
visible: root._r > 0
|
||||||
|
color: "transparent"
|
||||||
|
|
||||||
screen: root.screen
|
WlrLayershell.layer: WlrLayer.Overlay
|
||||||
color: "transparent"
|
WlrLayershell.exclusiveZone: 0
|
||||||
|
WlrLayershell.namespace: "nova-corners"
|
||||||
|
mask: Region {}
|
||||||
|
|
||||||
WlrLayershell.layer: WlrLayer.Overlay
|
implicitWidth: root._r
|
||||||
WlrLayershell.exclusiveZone: 0
|
implicitHeight: root._r
|
||||||
WlrLayershell.namespace: "nova-corners"
|
|
||||||
mask: Region {}
|
|
||||||
|
|
||||||
anchors.top: cornerWindow.modelData.top
|
Canvas {
|
||||||
anchors.left: cornerWindow.modelData.left
|
anchors.fill: parent
|
||||||
anchors.right: cornerWindow.modelData.right
|
onPaint: {
|
||||||
anchors.bottom: cornerWindow.modelData.bottom
|
const r = root._r;
|
||||||
|
const ctx = getContext("2d");
|
||||||
|
ctx.clearRect(0, 0, r, r);
|
||||||
|
ctx.fillStyle = "black";
|
||||||
|
ctx.beginPath();
|
||||||
|
|
||||||
implicitWidth: root._r
|
switch (win.corner) {
|
||||||
implicitHeight: root._r
|
case 0: // top-left
|
||||||
|
ctx.moveTo(0, 0);
|
||||||
Canvas {
|
ctx.lineTo(r, 0);
|
||||||
anchors.fill: parent
|
ctx.arc(r, r, r, -Math.PI / 2, Math.PI, true);
|
||||||
onPaint: {
|
ctx.closePath();
|
||||||
const r = root._r;
|
break;
|
||||||
const ctx = getContext("2d");
|
case 1: // top-right
|
||||||
ctx.clearRect(0, 0, r, r);
|
ctx.moveTo(r, 0);
|
||||||
ctx.fillStyle = "black";
|
ctx.lineTo(0, 0);
|
||||||
ctx.beginPath();
|
ctx.arc(0, r, r, -Math.PI / 2, 0, false);
|
||||||
|
ctx.closePath();
|
||||||
switch (cornerWindow.modelData.corner) {
|
break;
|
||||||
case 0: // top-left
|
case 2: // bottom-left
|
||||||
ctx.moveTo(0, 0);
|
ctx.moveTo(0, r);
|
||||||
ctx.lineTo(r, 0);
|
ctx.lineTo(0, 0);
|
||||||
ctx.arc(r, r, r, -Math.PI / 2, Math.PI, true);
|
ctx.arc(r, 0, r, Math.PI, Math.PI / 2, true);
|
||||||
ctx.closePath();
|
ctx.closePath();
|
||||||
break;
|
break;
|
||||||
case 1: // top-right
|
case 3: // bottom-right
|
||||||
ctx.moveTo(r, 0);
|
ctx.moveTo(r, r);
|
||||||
ctx.lineTo(0, 0);
|
ctx.lineTo(r, 0);
|
||||||
ctx.arc(0, r, r, -Math.PI / 2, 0, false);
|
ctx.arc(0, 0, r, 0, Math.PI / 2, false);
|
||||||
ctx.closePath();
|
ctx.closePath();
|
||||||
break;
|
break;
|
||||||
case 2: // bottom-left
|
|
||||||
ctx.moveTo(0, r);
|
|
||||||
ctx.lineTo(0, 0);
|
|
||||||
ctx.arc(r, 0, r, Math.PI, Math.PI / 2, true);
|
|
||||||
ctx.closePath();
|
|
||||||
break;
|
|
||||||
case 3: // bottom-right
|
|
||||||
ctx.moveTo(r, r);
|
|
||||||
ctx.lineTo(r, 0);
|
|
||||||
ctx.arc(0, 0, r, 0, Math.PI / 2, false);
|
|
||||||
ctx.closePath();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
ctx.fill();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ctx.fill();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Corner { corner: 0; anchors.top: true; anchors.left: true }
|
||||||
|
Corner { corner: 1; anchors.top: true; anchors.right: true }
|
||||||
|
Corner { corner: 2; anchors.bottom: true; anchors.left: true }
|
||||||
|
Corner { corner: 3; anchors.bottom: true; anchors.right: true }
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue