Make wallpapers rounded in WallpaperSelector

This commit is contained in:
Ly-sec 2025-08-12 17:51:11 +02:00
parent bd056cc981
commit 4ebc4cd299
2 changed files with 16 additions and 41 deletions

View file

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

View file

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