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 import qs.Services
Variants { Variants {
model: Quickshell.screens model: Quickshell.screens
PanelWindow { PanelWindow {
required property ShellScreen modelData required property ShellScreen modelData
property string wallpaperSource: Qt.resolvedUrl("../../Assets/Tests/wallpaper.png") property string wallpaperSource: Qt.resolvedUrl(
"../../Assets/Tests/wallpaper.png")
visible: wallpaperSource !== "" visible: wallpaperSource !== ""
color: "transparent" color: "transparent"
screen: modelData screen: modelData
WlrLayershell.layer: WlrLayer.Background WlrLayershell.layer: WlrLayer.Background
WlrLayershell.exclusionMode: ExclusionMode.Ignore WlrLayershell.exclusionMode: ExclusionMode.Ignore
WlrLayershell.namespace: "quickshell-wallpaper" 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
}
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 import qs.Services
Variants { Variants {
model: Quickshell.screens model: Quickshell.screens
PanelWindow { PanelWindow {
required property ShellScreen modelData required property ShellScreen modelData
property string wallpaperSource: Qt.resolvedUrl("../../Assets/Tests/wallpaper.png") property string wallpaperSource: Qt.resolvedUrl(
"../../Assets/Tests/wallpaper.png")
visible: wallpaperSource !== "" visible: wallpaperSource !== ""
color: "transparent" color: "transparent"
screen: modelData screen: modelData
WlrLayershell.layer: WlrLayer.Background WlrLayershell.layer: WlrLayer.Background
WlrLayershell.exclusionMode: ExclusionMode.Ignore WlrLayershell.exclusionMode: ExclusionMode.Ignore
WlrLayershell.namespace: "quickshell-overview" 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)
}
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 anchors.fill: parent
antialiasing: true antialiasing: true
renderTarget: Canvas.FramebufferObject renderTarget: Canvas.FramebufferObject
onPaint: function() { onPaint: function () {
const ctx = getContext("2d"); const ctx = getContext("2d")
ctx.reset(); ctx.reset()
ctx.clearRect(0, 0, width, height); ctx.clearRect(0, 0, width, height)
// Solid white base (alpha=1) // Solid white base (alpha=1)
ctx.globalCompositeOperation = "source-over"; ctx.globalCompositeOperation = "source-over"
ctx.fillStyle = "#ffffffff"; ctx.fillStyle = "#ffffffff"
ctx.fillRect(0, 0, width, height); ctx.fillRect(0, 0, width, height)
// Punch hole using destination-out with rounded rect path // Punch hole using destination-out with rounded rect path
const x = Math.round(root.borderWidth / 2); const x = Math.round(root.borderWidth / 2)
const y = Math.round(root.borderWidth / 2); const y = Math.round(root.borderWidth / 2)
const w = Math.max(0, width - root.borderWidth); const w = Math.max(0, width - root.borderWidth)
const h = Math.max(0, height - 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 r = Math.max(0, Math.min(root.innerRadius,
Math.min(w, h) / 2))
ctx.globalCompositeOperation = "destination-out"; ctx.globalCompositeOperation = "destination-out"
ctx.fillStyle = "#ffffffff"; ctx.fillStyle = "#ffffffff"
ctx.beginPath(); ctx.beginPath()
// rounded rectangle path using arcTo // rounded rectangle path using arcTo
ctx.moveTo(x + r, y); ctx.moveTo(x + r, y)
ctx.lineTo(x + w - r, y); ctx.lineTo(x + w - r, y)
ctx.arcTo(x + w, y, x + w, y + r, r); ctx.arcTo(x + w, y, x + w, y + r, r)
ctx.lineTo(x + w, y + h - r); ctx.lineTo(x + w, y + h - r)
ctx.arcTo(x + w, y + h, x + w - r, y + h, r); ctx.arcTo(x + w, y + h, x + w - r, y + h, r)
ctx.lineTo(x + r, y + h); ctx.lineTo(x + r, y + h)
ctx.arcTo(x, y + h, x, y + h - r, r); ctx.arcTo(x, y + h, x, y + h - r, r)
ctx.lineTo(x, y + r); ctx.lineTo(x, y + r)
ctx.arcTo(x, y, x + r, y, r); ctx.arcTo(x, y, x + r, y, r)
ctx.closePath(); ctx.closePath()
ctx.fill(); ctx.fill()
} }
onWidthChanged: requestPaint() onWidthChanged: requestPaint()
onHeightChanged: requestPaint() onHeightChanged: requestPaint()
@ -105,9 +106,13 @@ NLoader {
// Repaint mask when properties change // Repaint mask when properties change
Connections { Connections {
target: root target: root
function onBorderWidthChanged() { maskSource.requestPaint() } function onBorderWidthChanged() {
function onRingColorChanged() { /* no-op for mask */ } maskSource.requestPaint()
function onInnerRadiusChanged() { maskSource.requestPaint() } }
function onRingColorChanged() {/* no-op for mask */ }
function onInnerRadiusChanged() {
maskSource.requestPaint()
}
} }
// Texture for maskSource; hides the original // 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") property string colorsFile: Quickshell.env("NOCTALIA_COLORS_FILE")
|| (settingsDir + "colors.json") || (settingsDir + "colors.json")
property var data: settingAdapter property var data: settingAdapter
// Needed to only have one NPanel loaded at a time. // Needed to only have one NPanel loaded at a time.
property var openPanel: null property var openPanel: null
@ -32,7 +32,6 @@ Singleton {
// Qt.callLater(function () { // Qt.callLater(function () {
// WallpaperManager.setCurrentWallpaper(settings.currentWallpaper, true); // WallpaperManager.setCurrentWallpaper(settings.currentWallpaper, true);
// }) // })
id: settingFileView id: settingFileView
path: settingsFile path: settingsFile

View file

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

View file

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

View file

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

View file

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