Shaders: path from root for easier maintenance + cleanup fallback icons

This commit is contained in:
LemmyCook 2025-09-09 00:35:12 -04:00
parent 16bd4b41dc
commit 76ef2469e8
6 changed files with 25 additions and 23 deletions

View file

@ -8,7 +8,7 @@ Text {
property string icon: defaultIcon
text: {
if (Bootstrap.icons[icon] === undefined) {
if (icon === undefined || Bootstrap.icons[icon] === undefined) {
Logger.warn("Icon", `"${icon}"`, "doesn't exist in the bootstrap font")
Logger.callStack()
return Bootstrap.icons[defaultIcon]

View file

@ -46,18 +46,20 @@ Rectangle {
}
property real imageOpacity: root.opacity
fragmentShader: Qt.resolvedUrl("../Shaders/qsb/circled_image.frag.qsb")
fragmentShader: Qt.resolvedUrl(Quickshell.shellDir + "/Shaders/qsb/circled_image.frag.qsb")
supportsAtlasTextures: false
blending: true
}
// Fallback icon
NIcon {
anchors.centerIn: parent
icon: fallbackIcon
font.pointSize: fallbackIconSize
visible: fallbackIcon !== undefined && fallbackIcon !== "" && (imagePath === undefined || imagePath === "")
z: 0
Loader {
active: fallbackIcon !== undefined && fallbackIcon !== "" && (imagePath === undefined || imagePath === "")
sourceComponent: NIcon {
anchors.centerIn: parent
icon: fallbackIcon
font.pointSize: fallbackIconSize
z: 0
}
}
}

View file

@ -57,7 +57,7 @@ Rectangle {
property real itemHeight: root.height
property real cornerRadius: root.radius
property real imageOpacity: root.opacity
fragmentShader: Qt.resolvedUrl("../Shaders/qsb/rounded_image.frag.qsb")
fragmentShader: Qt.resolvedUrl(Quickshell.shellDir + "/Shaders/qsb/rounded_image.frag.qsb")
// Qt6 specific properties - ensure proper blending
supportsAtlasTextures: false
@ -72,12 +72,14 @@ Rectangle {
}
// Fallback icon
NIcon {
anchors.centerIn: parent
icon: fallbackIcon
font.pointSize: fallbackIconSize
visible: fallbackIcon !== undefined && fallbackIcon !== "" && (imagePath === undefined || imagePath === "")
z: 0
Loader {
active: fallbackIcon !== undefined && fallbackIcon !== "" && (imagePath === undefined || imagePath === "")
sourceComponent: NIcon {
anchors.centerIn: parent
icon: fallbackIcon
font.pointSize: fallbackIconSize
z: 0
}
}
}