quickshell: right-edge dropdowns with concave curve to screen edge

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
rope 2026-05-27 09:53:58 +01:00
parent de3aa43cf9
commit c2bd45944f

View file

@ -1185,8 +1185,8 @@ in
anchor.adjustment: PopupAdjustment.Slide anchor.adjustment: PopupAdjustment.Slide
visible: false visible: false
color: "transparent" color: "transparent"
implicitWidth: alignRight ? fullWidth + 8 : fullWidth + 16 implicitWidth: alignRight ? fullWidth + 8 + 8 : fullWidth + 16
implicitHeight: fullHeight + 4 implicitHeight: alignRight ? fullHeight + 4 + 8 : fullHeight + 4
onVisibleChanged: { onVisibleChanged: {
if (visible) { if (visible) {
@ -1242,7 +1242,7 @@ in
} }
} }
// Right ear (hidden when aligned right edge takes over) // Right ear (for centered dropdowns)
Item { Item {
anchors.left: _dropdownRect.right anchors.left: _dropdownRect.right
anchors.top: parent.top anchors.top: parent.top
@ -1265,9 +1265,42 @@ in
} }
} }
// Right-edge strip fills from dropdown to screen edge
Rectangle {
visible: dropdown.alignRight
anchors.left: _dropdownRect.right
anchors.top: parent.top
anchors.right: parent.right
height: _dropdownRect.height
color: Theme.barBg
}
// Right-edge bottom ear concave curve at bottom of right edge strip
Item {
visible: dropdown.alignRight && _dropdownRect.height > 0
anchors.right: parent.right
anchors.top: _dropdownRect.bottom
width: 8
height: 8
clip: true
Canvas {
width: 8; height: 8
onPaint: {
var ctx = getContext("2d");
ctx.clearRect(0, 0, 8, 8);
ctx.fillStyle = Theme.barBg;
ctx.beginPath();
ctx.moveTo(8, 0); ctx.lineTo(8, 8);
ctx.arc(0, 0, 8, 0, Math.PI / 2, false);
ctx.closePath(); ctx.fill();
}
}
}
Rectangle { Rectangle {
id: _dropdownRect id: _dropdownRect
anchors.right: dropdown.alignRight ? parent.right : undefined anchors.right: dropdown.alignRight ? parent.right : undefined
anchors.rightMargin: dropdown.alignRight ? 8 : 0
anchors.horizontalCenter: dropdown.alignRight ? undefined : parent.horizontalCenter anchors.horizontalCenter: dropdown.alignRight ? undefined : parent.horizontalCenter
anchors.top: parent.top anchors.top: parent.top
width: dropdown.fullWidth width: dropdown.fullWidth
@ -1275,7 +1308,7 @@ in
color: Theme.barBg color: Theme.barBg
radius: 8 radius: 8
topLeftRadius: 0 topLeftRadius: 0
topRightRadius: dropdown.alignRight ? 0 : 0 topRightRadius: 0
bottomRightRadius: dropdown.alignRight ? 0 : 8 bottomRightRadius: dropdown.alignRight ? 0 : 8
clip: true clip: true