qmlformat + fix build

This commit is contained in:
quadbyte 2025-08-10 11:59:54 -04:00
parent 2ed3488453
commit 61abcddeeb
9 changed files with 140 additions and 130 deletions

View file

@ -4,40 +4,39 @@ import Quickshell.Wayland
import qs.Services
Variants {
model: Quickshell.screens
model: Quickshell.screens
PanelWindow {
required property ShellScreen modelData
property string wallpaperSource: Qt.resolvedUrl("../../Assets/Tests/wallpaper.png")
PanelWindow {
required property ShellScreen modelData
property string wallpaperSource: Qt.resolvedUrl(
"../../Assets/Tests/wallpaper.png")
visible: wallpaperSource !== ""
color: "transparent"
screen: modelData
WlrLayershell.layer: WlrLayer.Background
WlrLayershell.exclusionMode: ExclusionMode.Ignore
WlrLayershell.namespace: "quickshell-wallpaper"
anchors {
bottom: true
top: true
right: true
left: true
}
margins {
top: 0
}
Image {
anchors.fill: parent
fillMode: Image.PreserveAspectCrop
source: wallpaperSource
visible: wallpaperSource !== ""
cache: true
smooth: true
mipmap: false
}
visible: wallpaperSource !== ""
color: "transparent"
screen: modelData
WlrLayershell.layer: WlrLayer.Background
WlrLayershell.exclusionMode: ExclusionMode.Ignore
WlrLayershell.namespace: "quickshell-wallpaper"
anchors {
bottom: true
top: true
right: true
left: true
}
margins {
top: 0
}
Image {
anchors.fill: parent
fillMode: Image.PreserveAspectCrop
source: wallpaperSource
visible: wallpaperSource !== ""
cache: true
smooth: true
mipmap: false
}
}
}

View file

@ -5,53 +5,53 @@ import Quickshell.Wayland
import qs.Services
Variants {
model: Quickshell.screens
model: Quickshell.screens
PanelWindow {
required property ShellScreen modelData
property string wallpaperSource: Qt.resolvedUrl("../../Assets/Tests/wallpaper.png")
PanelWindow {
required property ShellScreen modelData
property string wallpaperSource: Qt.resolvedUrl(
"../../Assets/Tests/wallpaper.png")
visible: wallpaperSource !== ""
color: "transparent"
screen: modelData
WlrLayershell.layer: WlrLayer.Background
WlrLayershell.exclusionMode: ExclusionMode.Ignore
WlrLayershell.namespace: "quickshell-overview"
anchors {
top: true
bottom: true
right: true
left: true
}
Image {
id: bgImage
anchors.fill: parent
fillMode: Image.PreserveAspectCrop
source: wallpaperSource
cache: true
smooth: true
mipmap: false
visible: wallpaperSource !== ""
}
MultiEffect {
id: overviewBgBlur
anchors.fill: parent
source: bgImage
blurEnabled: true
blur: 0.48
blurMax: 128
}
Rectangle {
anchors.fill: parent
color: Qt.rgba(Colors.backgroundPrimary.r, Colors.backgroundPrimary.g, Colors.backgroundPrimary.b, 0.5)
}
visible: wallpaperSource !== ""
color: "transparent"
screen: modelData
WlrLayershell.layer: WlrLayer.Background
WlrLayershell.exclusionMode: ExclusionMode.Ignore
WlrLayershell.namespace: "quickshell-overview"
anchors {
top: true
bottom: true
right: true
left: true
}
Image {
id: bgImage
anchors.fill: parent
fillMode: Image.PreserveAspectCrop
source: wallpaperSource
cache: true
smooth: true
mipmap: false
visible: wallpaperSource !== ""
}
MultiEffect {
id: overviewBgBlur
anchors.fill: parent
source: bgImage
blurEnabled: true
blur: 0.48
blurMax: 128
}
Rectangle {
anchors.fill: parent
color: Qt.rgba(Colors.backgroundPrimary.r, Colors.backgroundPrimary.g,
Colors.backgroundPrimary.b, 0.5)
}
}
}

View file

@ -66,37 +66,38 @@ NLoader {
anchors.fill: parent
antialiasing: true
renderTarget: Canvas.FramebufferObject
onPaint: function() {
const ctx = getContext("2d");
ctx.reset();
ctx.clearRect(0, 0, width, height);
onPaint: function () {
const ctx = getContext("2d")
ctx.reset()
ctx.clearRect(0, 0, width, height)
// Solid white base (alpha=1)
ctx.globalCompositeOperation = "source-over";
ctx.fillStyle = "#ffffffff";
ctx.fillRect(0, 0, width, height);
ctx.globalCompositeOperation = "source-over"
ctx.fillStyle = "#ffffffff"
ctx.fillRect(0, 0, width, height)
// Punch hole using destination-out with rounded rect path
const x = Math.round(root.borderWidth / 2);
const y = Math.round(root.borderWidth / 2);
const w = Math.max(0, width - root.borderWidth);
const h = Math.max(0, height - root.borderWidth);
const r = Math.max(0, Math.min(root.innerRadius, Math.min(w, h) / 2));
const x = Math.round(root.borderWidth / 2)
const y = Math.round(root.borderWidth / 2)
const w = Math.max(0, width - root.borderWidth)
const h = Math.max(0, height - root.borderWidth)
const r = Math.max(0, Math.min(root.innerRadius,
Math.min(w, h) / 2))
ctx.globalCompositeOperation = "destination-out";
ctx.fillStyle = "#ffffffff";
ctx.beginPath();
ctx.globalCompositeOperation = "destination-out"
ctx.fillStyle = "#ffffffff"
ctx.beginPath()
// rounded rectangle path using arcTo
ctx.moveTo(x + r, y);
ctx.lineTo(x + w - r, y);
ctx.arcTo(x + w, y, x + w, y + r, r);
ctx.lineTo(x + w, y + h - r);
ctx.arcTo(x + w, y + h, x + w - r, y + h, r);
ctx.lineTo(x + r, y + h);
ctx.arcTo(x, y + h, x, y + h - r, r);
ctx.lineTo(x, y + r);
ctx.arcTo(x, y, x + r, y, r);
ctx.closePath();
ctx.fill();
ctx.moveTo(x + r, y)
ctx.lineTo(x + w - r, y)
ctx.arcTo(x + w, y, x + w, y + r, r)
ctx.lineTo(x + w, y + h - r)
ctx.arcTo(x + w, y + h, x + w - r, y + h, r)
ctx.lineTo(x + r, y + h)
ctx.arcTo(x, y + h, x, y + h - r, r)
ctx.lineTo(x, y + r)
ctx.arcTo(x, y, x + r, y, r)
ctx.closePath()
ctx.fill()
}
onWidthChanged: requestPaint()
onHeightChanged: requestPaint()
@ -105,9 +106,13 @@ NLoader {
// Repaint mask when properties change
Connections {
target: root
function onBorderWidthChanged() { maskSource.requestPaint() }
function onRingColorChanged() { /* no-op for mask */ }
function onInnerRadiusChanged() { maskSource.requestPaint() }
function onBorderWidthChanged() {
maskSource.requestPaint()
}
function onRingColorChanged() {/* no-op for mask */ }
function onInnerRadiusChanged() {
maskSource.requestPaint()
}
}
// Texture for maskSource; hides the original
@ -133,4 +138,3 @@ NLoader {
}
}
}

View file

@ -0,0 +1,10 @@
import Quickshell
import qs.Modules.Bar
Variants {
model: Quickshell.screens
delegate: Bar {
modelData: item
}
}