Files
glassMxrph/quickshell/widgets/faces/ImageFace.qml
T
mxandClaude Opus 5.5 99e64a7713 Add glassMxrph shell sources
Initial commit of the Quickshell desktop suite: bar, dock, launcher,
settings, Control Center, dashboard, OSD, lock screen, desktop widgets,
plugin host with the vendored Noctalia/Omarchy compatibility layer,
helpers, packaging, tests and phase documentation.

Includes the optimization work so far: usage widgets and dashboard
gauges no longer animate continuously, desktop widgets pause while
covered, system controls stop flickering on background polls, dock app
matching uses an indexed catalog, and workspace ghosts are created only
for occupied slots.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-07 22:36:17 +02:00

55 lines
1.7 KiB
QML

import QtQuick
import QtQuick.Effects
import "../../theme"
// A picture from disk: rounded, square or circular.
Face {
id: root
readonly property string path: options.path || ""
Image {
id: picture
anchors.fill: parent
visible: false
source: root.path ? "file://" + encodeURI(root.path).replace(/#/g, "%23").replace(/\?/g, "%3F") : ""
sourceSize: Qt.size(Math.max(1, root.width) * 2, Math.max(1, root.height) * 2)
fillMode: Image.PreserveAspectCrop
asynchronous: true
}
Item {
id: shape
anchors.centerIn: parent
width: root.variant === "round" ? Math.min(root.width, root.height) : root.width
height: root.variant === "round" ? width : root.height
visible: false
layer.enabled: true
Rectangle {
anchors.fill: parent
radius: root.variant === "round" ? width / 2 : root.variant === "rect" ? 0 : Theme.radius
}
}
MultiEffect {
anchors.fill: parent
source: picture
maskEnabled: true
maskSource: shape
visible: picture.status === Image.Ready
}
Rectangle {
anchors.fill: shape
visible: picture.status !== Image.Ready
radius: root.variant === "round" ? width / 2 : root.variant === "rect" ? 0 : Theme.radius
color: Theme.fill
border.width: 1
border.color: Theme.border
Text {
anchors.centerIn: parent
width: parent.width - 20
horizontalAlignment: Text.AlignHCenter
wrapMode: Text.Wrap
text: root.path ? "Cannot load image" : "Right-click to choose an image"
color: Theme.textSecondary
font.pixelSize: 11
}
}
}