sddm: add preview for KDE's login screen settings

414ff8c · Gabriel Morell · 2026-09-29 20:05

8 files +43 -0

Files changed

modified README.md
+5 −0
@@ -51,6 +51,11 @@ Installing a package does not switch to its theme:
51 51 # SDDM
52 52 printf '[Theme]\nCurrent=neiam\n' | sudo tee /etc/sddm.conf.d/neiam.conf
53 53
54 +KDE's login screen settings show `sddm/theme/preview.png`; re-render it
55 +after changing the theme or its art:
56 +
57 + QT_QPA_PLATFORM=offscreen qml6 tools/sddm-preview.qml
58 +
54 59 Try the login screen without switching to it:
55 60
56 61 sddm-greeter-qt6 --test-mode --theme sddm/theme
modified sddm/Cargo.toml
+1 −0
@@ -24,6 +24,7 @@ assets = [
24 24 { source = "theme/*.qml", dest = "/usr/share/sddm/themes/neiam/", mode = "0644" },
25 25 { source = "theme/metadata.desktop", dest = "/usr/share/sddm/themes/neiam/metadata.desktop", mode = "0644" },
26 26 { source = "theme/theme.conf", dest = "/usr/share/sddm/themes/neiam/theme.conf", mode = "0644" },
27 + { source = "theme/preview.png", dest = "/usr/share/sddm/themes/neiam/preview.png", mode = "0644" },
27 28 { source = "theme/backgrounds/*", dest = "/usr/share/sddm/themes/neiam/backgrounds/", mode = "0644" },
28 29 { source = "../README.md", dest = "/usr/share/doc/sddm-theme-neiam/README.md", doc = true, mode = "0644" },
29 30 ]
modified sddm/theme/metadata.desktop
+1 −0
@@ -4,6 +4,7 @@ Description=neiam device login
4 4 Author=Gabe
5 5 Type=sddm-theme
6 6 Version=0.1.0
7 +Screenshot=preview.png
7 8 MainScript=Main.qml
8 9 ConfigFile=theme.conf
9 10 Theme-Id=neiam
modified ?
+0 −0

Binary file — not rendered.

added tools/sddm-preview.qml
+36 −0
@@ -0,0 +1,36 @@
1 +// Renders sddm/theme/preview.png, the image KDE's login screen settings
2 +// show for this theme. Re-run after changing the theme or its art:
3 +//
4 +// QT_QPA_PLATFORM=offscreen qml6 tools/sddm-preview.qml
5 +//
6 +// The greeter's context objects are stood in for by ids here, which
7 +// Main.qml resolves through the Loader's context.
8 +import QtQuick 2.15
9 +import QtQuick.Window 2.15
10 +
11 +Window {
12 + width: 1920; height: 1080; visible: true
13 +
14 + QtObject { id: config
15 + property string backgrounds: "1920x1080"
16 + property string background: "#651d1d"
17 + property string foreground: "#fef3c7" }
18 + QtObject { id: sddm
19 + property string hostName: "neiam"
20 + property bool canPowerOff: true; property bool canReboot: true; property bool canSuspend: true
21 + signal loginFailed(); signal loginSucceeded()
22 + function login(u, p, s) {} }
23 + QtObject { id: userModel; property string lastUser: "" }
24 + ListModel { id: sessionModel; property int lastIndex: 0
25 + ListElement { name: "Plasma (Wayland)" } ListElement { name: "Plasma (X11)" } }
26 +
27 + Loader { id: theme; anchors.fill: parent; source: "../sddm/theme/Main.qml" }
28 +
29 + Timer {
30 + interval: 1000; running: true
31 + onTriggered: theme.item.grabToImage(function (result) {
32 + result.saveToFile(Qt.resolvedUrl("../sddm/theme/preview.png").toString().replace("file://", ""))
33 + Qt.quit()
34 + }, Qt.size(960, 540))
35 + }
36 +}

Parents: e74691a