Skip to content

Commit d9d1468

Browse files
authored
Merge pull request #4 from derryl/claude-init
Add CLAUDE.md and streamline README for end users
2 parents 31c83cc + 2a3ead2 commit d9d1468

3 files changed

Lines changed: 106 additions & 75 deletions

File tree

CLAUDE.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Project Overview
6+
7+
A development environment for building and customizing SDDM login themes for KDE Plasma 6. Themes are written in pure QtQuick/QML (no KDE Plasma library dependencies) and can be previewed in a standalone window without restarting SDDM.
8+
9+
## Commands
10+
11+
### Live preview (primary development loop)
12+
```sh
13+
./scripts/preview.sh # preview the default theme
14+
./scripts/preview.sh -theme <name> # preview a specific theme
15+
qml6 preview/Preview.qml # one-shot preview (no file watching)
16+
```
17+
18+
### Lint (static analysis + runtime type check)
19+
```sh
20+
./scripts/lint-qml.sh # lint all themes
21+
./scripts/lint-qml.sh -theme <name> # lint a specific theme
22+
```
23+
CI runs this on every push/PR. It runs `qmllint` for static analysis, then launches the preview under `xvfb` for 3 seconds to catch runtime type errors (`Unable to assign`, `ReferenceError`, `TypeError`).
24+
25+
### Full-fidelity SDDM test
26+
```sh
27+
./scripts/test-sddm.sh # test default theme with real SDDM greeter
28+
./scripts/test-sddm.sh -theme <name>
29+
```
30+
31+
## Architecture
32+
33+
### Theme structure
34+
Themes live under `themes/<name>/`. The default theme is at `themes/default/`.
35+
36+
Each theme contains:
37+
- `Main.qml` — SDDM entry point; root `Item` that uses SDDM-injected context properties
38+
- `theme.conf` — all configurable values (colors, fonts, background, clock format, screen dimensions)
39+
- `metadata.desktop` — SDDM theme registration metadata
40+
- `components/` — UI components (Clock, LoginForm, SessionSelector, PowerBar)
41+
- `assets/` — background image and other static assets
42+
43+
### Preview harness
44+
`preview/Preview.qml` mirrors `Main.qml` layout but replaces SDDM context properties with mock objects (`mockSddm`, `mockConfig`, `mockUserModel`, `mockSessionModel`, `mockKeyboard`). The preview script symlinks the selected theme's `components/` and `assets/` into `preview/` so relative QML imports resolve correctly.
45+
46+
In preview mode, use password `test` for successful login; any other password triggers "Login Failed".
47+
48+
### SDDM context properties
49+
SDDM injects five globals that themes depend on: `sddm`, `config`, `userModel`, `sessionModel`, `keyboard`. Components receive these as explicit properties rather than accessing globals directly, making them portable between Main.qml (real SDDM) and Preview.qml (mocks).
50+
51+
### QML style
52+
All scripts set `QT_QUICK_CONTROLS_STYLE=Basic` to avoid Breeze/Plasma-specific errors outside a full Plasma session.
53+
54+
## Key Conventions
55+
56+
- Pure QtQuick only — no `org.kde.plasma.*`, `org.kde.breeze.components`, or `Kirigami` imports
57+
- Components take dependencies as explicit props (not SDDM context property access)
58+
- `qmllint` warnings about unresolved SDDM globals are expected and tolerated; only actual errors fail CI
59+
- All config values come through `theme.conf` and are accessed via `config.<key>` in QML

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 Derryl Carter
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 26 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -6,99 +6,57 @@ Build and customize your KDE login screen without having to actually reinstall t
66

77
This project gives you a live-preview development environment for SDDM themes on KDE Plasma 6. Edit QML, tweak colors, swap backgrounds -- and see every change instantly in a standalone window. When you're happy with the result, install it as your real login screen with one command.
88

9-
**Who is this for?** Anyone who wants to customize their KDE/SDDM login screen -- whether you're importing an existing theme to tweak it, or building one from scratch.
10-
11-
## What's Inside
12-
13-
```
14-
kde-lockscreen-builder/
15-
├── Main.qml # SDDM entry point (the actual theme)
16-
├── metadata.desktop # Theme registration (Theme-API 2.0, Qt6)
17-
├── theme.conf # All configurable values: colors, fonts, background, clock
18-
├── components/
19-
│ ├── Clock.qml # Date/time display
20-
│ ├── LoginForm.qml # Username + password fields, login button
21-
│ ├── SessionSelector.qml # Desktop session dropdown
22-
│ └── PowerBar.qml # Suspend / reboot / shutdown buttons
23-
├── preview/
24-
│ └── Preview.qml # Mock harness — previews your theme without SDDM
25-
├── scripts/
26-
│ ├── preview.sh # File-watcher: auto-restarts preview on every save
27-
│ └── test-sddm.sh # Full-fidelity SDDM greeter test
28-
├── assets/
29-
│ └── background.jpg # Your background image
30-
└── faces/
31-
└── .face.icon # Default user avatar placeholder
32-
```
9+
## Quick Start
3310

34-
## Prerequisites
11+
### Prerequisites
3512

3613
- KDE Plasma 6 with SDDM
3714
- Qt 6 (`qt6-declarative` package -- provides `qml6`)
3815
- `entr` for file-watching (`sudo pacman -S entr` on Arch)
3916

40-
## Quick Start
17+
### Start from the included starter theme
4118

42-
### Option A: Start From the Included Starter Theme
43-
44-
The repo ships with a minimal, clean theme that works out of the box. Clone and preview it immediately:
19+
The repo ships with a minimal, clean theme that works out of the box:
4520

4621
```sh
4722
git clone https://github.com/derryl/kde-lockscreen-builder.git
4823
cd kde-lockscreen-builder
49-
cp /path/to/your/wallpaper.jpg assets/background.jpg
24+
cp /path/to/your/wallpaper.jpg themes/default/assets/background.jpg
5025
./scripts/preview.sh
5126
```
5227

5328
Edit any `.qml` file or `theme.conf`, save, and the preview window restarts automatically.
5429

55-
### Option B: Import an Existing Theme
56-
57-
Already have a theme you want to modify? Copy its files into this project to get the live-preview workflow:
58-
59-
1. Clone this repo:
60-
61-
```sh
62-
git clone https://github.com/derryl/kde-lockscreen-builder.git
63-
cd kde-lockscreen-builder
64-
```
65-
66-
2. Copy the theme's files over the project files. SDDM themes typically have a `Main.qml`, `metadata.desktop`, `theme.conf`, and asset directories -- replace the ones in this repo with yours:
30+
### Or import an existing theme
6731

68-
```sh
69-
# Example: importing from an installed SDDM theme
70-
cp -r /usr/share/sddm/themes/some-theme/* .
71-
```
32+
Already have a theme you want to modify? You can find community themes on the [KDE Store](https://store.kde.org/browse?cat=101&ord=rating), or copy one that's already installed on your system:
7233

73-
3. Launch the preview:
74-
75-
```sh
76-
./scripts/preview.sh
77-
```
34+
```sh
35+
# Example: importing from an installed SDDM theme
36+
cp -r /usr/share/sddm/themes/some-theme/* themes/default/
37+
./scripts/preview.sh
38+
```
7839

79-
If the imported theme uses KDE/Plasma-specific QML imports (e.g. `org.kde.plasma.*`), the standalone preview won't be able to render those parts. You can still use `./scripts/test-sddm.sh` for full-fidelity testing, or incrementally replace those imports with pure QtQuick equivalents.
40+
If the imported theme uses KDE/Plasma-specific QML imports (e.g. `org.kde.plasma.*`), the standalone preview won't render those parts. You can still use `./scripts/test-sddm.sh` for full-fidelity testing, or incrementally replace those imports with pure QtQuick equivalents.
8041

8142
## Development Workflow
8243

83-
### Live Preview (primary loop)
84-
85-
`preview/Preview.qml` mocks all SDDM-provided objects (`sddm`, `userModel`, `sessionModel`, `config`, `keyboard`) so your theme renders in a standalone window -- no real SDDM greeter needed.
44+
### Live preview
8645

8746
```sh
88-
./scripts/preview.sh
47+
./scripts/preview.sh # preview the default theme
48+
./scripts/preview.sh -theme <name> # preview a specific theme under themes/
8949
```
9050

91-
This watches all `.qml`, `.conf`, and image files using `entr`. On every save, the preview window is killed and relaunched automatically.
51+
This watches all `.qml`, `.conf`, and image files. On every save, the preview window restarts automatically. In preview mode, type the password `test` to simulate a successful login.
9252

9353
You can also launch the preview once without file-watching:
9454

9555
```sh
9656
qml6 preview/Preview.qml
9757
```
9858

99-
In preview mode, type the password `test` to simulate a successful login. Any other password triggers the "Login Failed" notification.
100-
101-
### Full-Fidelity SDDM Test
59+
### Full-fidelity SDDM test
10260

10361
Periodically verify your theme against the real SDDM greeter:
10462

@@ -140,7 +98,7 @@ Changes to `theme.conf` are picked up by the file watcher just like QML changes.
14098

14199
## Installing Your Theme
142100

143-
When you're satisfied with your theme, install it so SDDM uses it at your real login screen. SDDM themes live in `/usr/share/sddm/themes/`.
101+
SDDM themes live in `/usr/share/sddm/themes/`.
144102

145103
### 1. Choose a theme name
146104

@@ -155,19 +113,17 @@ Theme-Id=my-login-theme
155113
**Symlink (recommended during development)** -- lets you keep editing and see changes on next login:
156114

157115
```sh
158-
sudo ln -sf "$(pwd)" /usr/share/sddm/themes/my-login-theme
116+
sudo ln -sf "$(pwd)/themes/default" /usr/share/sddm/themes/my-login-theme
159117
```
160118

161119
**Copy (for a final install):**
162120

163121
```sh
164-
sudo cp -r . /usr/share/sddm/themes/my-login-theme
122+
sudo cp -r themes/default /usr/share/sddm/themes/my-login-theme
165123
```
166124

167125
### 3. Activate the theme
168126

169-
Tell SDDM to use your theme:
170-
171127
```sh
172128
sudo mkdir -p /etc/sddm.conf.d
173129
sudo tee /etc/sddm.conf.d/theme.conf > /dev/null <<EOF
@@ -180,21 +136,16 @@ Or use the GUI: **System Settings > Colors & Themes > Login Screen (SDDM)**.
180136

181137
### 4. Verify
182138

183-
Run the full-fidelity test against the installed path to confirm everything works:
184-
185139
```sh
186140
sddm-greeter-qt6 --test-mode --theme /usr/share/sddm/themes/my-login-theme
187141
```
188142

189-
## Architecture Notes
190-
191-
The included starter theme is built with **pure QtQuick** -- no imports from `org.kde.plasma.*`, `org.kde.breeze.components`, or `Kirigami`. This means:
192-
193-
- Total control over every visual element
194-
- No dependency on KDE Plasma libraries at the SDDM level
195-
- Easy mocking: only 5 SDDM globals need stubs (`sddm`, `config`, `userModel`, `sessionModel`, `keyboard`)
143+
## Useful Links
196144

197-
Components receive their dependencies as explicit properties rather than relying on SDDM context properties directly, making them testable in the preview harness and reusable across themes.
145+
- [SDDM Theming Guide](https://github.com/sddm/sddm/wiki/Theming) -- API reference for the SDDM context properties (`sddm`, `userModel`, `sessionModel`, etc.) and theme structure
146+
- [KDE Store: SDDM Login Themes](https://store.kde.org/browse?cat=101&ord=rating) -- community-made themes to use as starting points or inspiration
147+
- [Qt QML Documentation](https://doc.qt.io/qt-6/qtqml-index.html) -- language reference for QML
148+
- [Qt Quick Documentation](https://doc.qt.io/qt-6/qtquick-index.html) -- the UI framework used by SDDM themes
198149

199150
## License
200151

0 commit comments

Comments
 (0)