From 4ebc4cd299cd92e02102b8b59d1590fabc115b45 Mon Sep 17 00:00:00 2001 From: Ly-sec Date: Tue, 12 Aug 2025 17:51:11 +0200 Subject: [PATCH] Make wallpapers rounded in WallpaperSelector --- Modules/Settings/Tabs/WallpaperSelector.qml | 51 +++++---------------- Widgets/NImageRounded.qml | 6 ++- 2 files changed, 16 insertions(+), 41 deletions(-) diff --git a/Modules/Settings/Tabs/WallpaperSelector.qml b/Modules/Settings/Tabs/WallpaperSelector.qml index 95a8976..281887d 100644 --- a/Modules/Settings/Tabs/WallpaperSelector.qml +++ b/Modules/Settings/Tabs/WallpaperSelector.qml @@ -53,42 +53,15 @@ Item { border.width: Math.max(1, Style.borderThin * scaling) clip: true - Image { + NImageRounded { id: currentWallpaperImage anchors.fill: parent anchors.margins: Style.marginSmall * scaling - source: Wallpapers.currentWallpaper - fillMode: Image.PreserveAspectCrop - asynchronous: true - cache: true - } - - // Fallback if no image - Rectangle { - anchors.fill: parent - anchors.margins: Style.marginSmall * scaling - color: Colors.backgroundTertiary - radius: Style.radiusSmall * scaling - visible: currentWallpaperImage.status !== Image.Ready - - ColumnLayout { - anchors.centerIn: parent - spacing: Style.marginSmall * scaling - - NText { - text: "image" - font.family: "Material Symbols Outlined" - font.pointSize: Style.fontSizeLarge * scaling - color: Colors.textSecondary - Layout.alignment: Qt.AlignHCenter - } - - NText { - text: "No wallpaper selected" - color: Colors.textSecondary - Layout.alignment: Qt.AlignHCenter - } - } + imagePath: Wallpapers.currentWallpaper + fallbackIcon: "image" + borderColor: Colors.outline + borderWidth: Math.max(1, Style.borderThin * scaling) + imageRadius: Style.radiusMedium * scaling } } @@ -180,14 +153,14 @@ Item { border.width: Math.max(1, Style.borderThin * scaling) clip: true - Image { + NImageRounded { anchors.fill: parent anchors.margins: Style.marginTiny * scaling - source: wallpaperPath - fillMode: Image.PreserveAspectCrop - asynchronous: true - cache: true - smooth: true + imagePath: wallpaperPath + fallbackIcon: "image" + borderColor: "transparent" + borderWidth: 0 + imageRadius: Style.radiusMedium * scaling } // Selection indicator diff --git a/Widgets/NImageRounded.qml b/Widgets/NImageRounded.qml index abef690..f1a37d9 100644 --- a/Widgets/NImageRounded.qml +++ b/Widgets/NImageRounded.qml @@ -5,8 +5,10 @@ import Quickshell.Widgets import qs.Services Rectangle { + id: root color: "transparent" - radius: width * 0.5 + property real imageRadius: width * 0.5 + radius: imageRadius readonly property real scaling: Scaling.scale(screen) property string imagePath: "" @@ -52,7 +54,7 @@ Rectangle { visible: false Rectangle { anchors.fill: parent - radius: img.width * 0.5 + radius: root.imageRadius } }