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
}
}

View file

@ -15,7 +15,7 @@ Singleton {
property string colorsFile: Quickshell.env("NOCTALIA_COLORS_FILE")
|| (settingsDir + "colors.json")
property var data: settingAdapter
// Needed to only have one NPanel loaded at a time.
property var openPanel: null
@ -32,7 +32,6 @@ Singleton {
// Qt.callLater(function () {
// WallpaperManager.setCurrentWallpaper(settings.currentWallpaper, true);
// })
id: settingFileView
path: settingsFile

View file

@ -9,9 +9,9 @@ Singleton {
property var date: new Date()
property string time: Settings.data.location.use12HourClock ? Qt.formatDateTime(
date,
"h:mm AP") : Qt.formatDateTime(
date, "HH:mm")
date,
"h:mm AP") : Qt.formatDateTime(
date, "HH:mm")
property string dateString: {
let now = date
let dayName = now.toLocaleDateString(Qt.locale(), "ddd")

View file

@ -69,8 +69,7 @@ Singleton {
if (Settings.data.wallpaper.isRandom && !randomWallpaperTimer.running) {
randomWallpaperTimer.start()
setRandomWallpaper()
} else if (!Settings.data.randomWallpaper
&& randomWallpaperTimer.running) {
} else if (!Settings.data.randomWallpaper && randomWallpaperTimer.running) {
randomWallpaperTimer.stop()
}
}

View file

@ -20,11 +20,13 @@ PanelWindow {
function show() {
// Ensure only one panel is visible at a time using Settings as ephemeral store
try {
if (Settings.openPanel && Settings.openPanel !== outerPanel && Settings.openPanel.hide) {
if (Settings.openPanel && Settings.openPanel !== outerPanel
&& Settings.openPanel.hide) {
Settings.openPanel.hide()
}
Settings.openPanel = outerPanel
} catch (e) {
// ignore
}
visible = true
@ -56,13 +58,19 @@ PanelWindow {
Component.onDestruction: {
try {
if (visible && Settings.openPanel === outerPanel) Settings.openPanel = null
} catch (e) {}
if (visible && Settings.openPanel === outerPanel)
Settings.openPanel = null
} catch (e) {
}
}
onVisibleChanged: function() {
onVisibleChanged: function () {
try {
if (!visible && Settings.openPanel === outerPanel) Settings.openPanel = null
} catch (e) {}
if (!visible && Settings.openPanel === outerPanel)
Settings.openPanel = null
} catch (e) {
}
}
}

View file

@ -1,6 +1,6 @@
// Disable reload popup
//@ pragma Env QS_NO_RELOAD_POPUP=1
import QtQuick
import Quickshell
import Quickshell.Io
@ -15,19 +15,10 @@ import qs.Services
ShellRoot {
id: root
Variants {
model: Quickshell.screens
delegate: Bar {
modelData: item
}
}
Background {}
Overview {}
ScreenCorner {}
ScreenCorners {}
Bars {}
DemoPanel {
id: demoPanel