Add a palette-themed hyprlock lock screen

Themed through the same template pipeline as everything else: clock,
date, username and password-field colors come from theme/colors.toml,
background is a re-encoded, size-capped copy of the active wallpaper
(handles both an oversized original and a GIF saved under the .png-
named active wallpaper file). Bound to Mod+L, guarded against double-
invocation. Animations are disabled - this GPU/driver combo crashes
hyprlock's fade-in otherwise, regardless of what background is set.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
nico
2026-11-05 17:38:26 +01:00
parent a511d29e1f
commit 6373ed38ec
9 changed files with 238 additions and 10 deletions

5
.gitignore vendored
View File

@@ -30,6 +30,11 @@
# double this repo's size with identical bytes.
/sddm/aether-rice/wallpaper.png
# A re-encoded, size-capped copy of hypr/wallpaper.png for hyprlock's background,
# refreshed by render.py's render_lock_wallpaper() - regenerated from the tracked
# wallpaper on every render, no reason to track the derived bytes too.
/hypr/lockscreen-wallpaper.jpg
# Python bytecode cache (theme/presets.py imports theme/render.py as a module)
__pycache__/

View File

@@ -28,6 +28,7 @@ bash /tmp/install.sh --deps # same, plus installs dependencies via pacman (Arc
| Cursor | Custom Arch-logo cursor set (pointer, text, resize, wait spinner, …) in the rice palette — artwork in [`shapes.py`](hypr/cursor/shapes.py), [`build.py`](hypr/cursor/build.py) installs a Hyprcursor and an XCursor theme to `~/.local/share/icons/ArchLogo` |
| Notifications | [mako](mako/) — themed from the palette, same as the rest |
| Theming | [`theme/`](theme/) — homegrown palette-driven theme generator (`render.py`), controlled from the Quickshell desktop widget or the CLI |
| Lock screen | [hyprlock](https://github.com/hyprwm/hyprlock) — same palette/wallpaper pipeline as everything else, see Lock screen below |
| Qt/GTK theming | qt6ct, nwg-look |
| File manager | Thunar (GTK3; themed via the same pipeline — see Theming below). Was Dolphin, dropped over an [unfixed upstream bug](https://discuss.kde.org/t/dolphin-how-can-i-override-the-new-highlight-color/38640) forcing Breeze's stock blue for selection outside a full Plasma session |
| Mouse control | Standalone Quickshell widget ([`MouseWidget.qml`](quickshell/default/MouseWidget.qml)) — battery, DPI, poll rate, idle timeout, low-battery threshold, via [OpenRazer](https://openrazer.github.io/), optional/hardware-specific — see Peripheral widgets below |
@@ -116,6 +117,15 @@ A few icon colors in the bar are deliberately hardcoded rather than bound to the
It's a blue theme (`#1793d1` accent on a dark `#1a1b26` background) built around the stock default Hyprland wallpaper — the anime girl waiting at the train stop with the glowing blue Hyprland-logo cats. Every accent color across the bar, Rofi, Kitty, and the rest was picked to match that wallpaper's palette rather than the other way around.
## Lock screen
[hyprlock](https://github.com/hyprwm/hyprlock) is themed through the same template pipeline as everything else: [`theme/templates/hyprlock/`](theme/templates/hyprlock/) renders `~/.config/hypr/hyprlock.conf` from the active palette (clock, date, username, and password-field colors). Bound to `Mod + L` (`hypr/hyprland.lua`), guarded with a `pgrep -x hyprlock` check so pressing it again while already locked doesn't spawn a second instance on top of the first.
- **Background** is a dedicated, re-encoded copy of the wallpaper, not the live wallpaper file directly — `render.render_lock_wallpaper()` runs `ffmpeg` over it on every render and every wallpaper change, taking a single frame and capping its size, to `~/.config/hypr/lockscreen-wallpaper.jpg` (gitignored, regenerated from the tracked wallpaper rather than committed itself). This sidesteps two things hyprlock's own background loader doesn't handle well: an animated GIF saved under this rice's `.png`-named active wallpaper file (`ffmpeg` content-sniffs the real format regardless of the name), and originals far larger than a lock screen needs (one of this rice's own wallpapers is 8K).
- **Colors** use a new `.hexa:ALPHA` template placeholder, not the existing `.rgba:ALPHA` every other app's templates use: hyprlock's config language only parses hex color forms (`rgb(RRGGBB)` / `rgba(RRGGBBAA)`, alpha as a hex byte appended, no commas) — the CSS-decimal `rgba(r, g, b, ALPHA)` string `.rgba` produces for everything else is silently invalid here.
- **Animations are disabled** (`animations { enabled = false }`) — on this GPU/driver combination, hyprlock's fade-in timer touches a screencopy-related resource that fails to initialize at startup regardless of what background is actually configured, crashing the process right after it logs "Starting fade in". Disabling the animation is what stops it; a static background path alone (as opposed to a live `screenshot` background) is not enough on its own.
- A few hyprlock config keys only exist as CLI flags in this version, not config-file options (`--grace`, `--no-fade-in`) — writing them under `general { }` instead just logs a non-fatal "config option does not exist" warning and ignores them. Check `hyprlock --help` and its own shipped sample config (`/usr/share/hypr/hyprlock.conf`) against any config found online, this file included.
## Peripheral widgets
Two more standalone Quickshell windows (same pattern as the theme widget: independent of `Bar.qml`, pinned to the top-left corner, Bottom wlr layer) control RGB/sensor peripherals over their own daemons instead of the palette. Both are entirely optional and hardware-specific — each hides itself (`visible: available`) if its daemon isn't reachable, so they're a no-op on a machine without this exact hardware, not an error.
@@ -181,6 +191,7 @@ Notable quirks:
|---|---|
| `Mod + Q` | Close active window |
| `Mod + Shift + E` | Exit Hyprland |
| `Mod + L` | Lock screen |
| `Mod + F` | Toggle fullscreen |
| `Mod + V` | Toggle floating |
| `Mod + P` | Toggle pseudotiling |
@@ -217,9 +228,9 @@ Notable quirks:
## Requirements
Beyond Hyprland itself, the bar's scripts expect: `quickshell`, `nmcli`, `wpctl`, `nvidia-smi` (GPU stats — no-ops gracefully if absent), `sensors` (lm_sensors, for CPU temperature), `python3`, and `curl` (for the network widget's public-IP lookup). The theme widget's wallpaper picker additionally needs `zenity` (native file picker) and `swaybg`; an animated GIF wallpaper additionally needs `awww` (optional - only touched when the active wallpaper is a GIF). The mouse and RGB widgets are both fully optional, hardware-specific, and need their own one-time setup beyond a package install — see Peripheral widgets above, not covered by `install.sh --deps`.
Beyond Hyprland itself, the bar's scripts expect: `quickshell`, `nmcli`, `wpctl`, `nvidia-smi` (GPU stats — no-ops gracefully if absent), `sensors` (lm_sensors, for CPU temperature), `python3`, and `curl` (for the network widget's public-IP lookup). The theme widget's wallpaper picker additionally needs `zenity` (native file picker) and `swaybg`; an animated GIF wallpaper additionally needs `awww` (optional - only touched when the active wallpaper is a GIF). The mouse and RGB widgets are both fully optional, hardware-specific, and need their own one-time setup beyond a package install — see Peripheral widgets above, not covered by `install.sh --deps`. The lock screen needs `hyprlock` and `ffmpeg` (the latter to re-encode the wallpaper for it).
This is an Arch + Hyprland rice through and through, so the list below is Arch-authoritative — everything in the pacman column is a plain `extra`/`multilib` package on current Arch, nothing needs an AUR helper. `apt`/`dnf` columns are best-effort: Hyprland and its ecosystem (Hyprland itself, `quickshell`, `hyprcursor`) move fast and generally aren't in Debian/Ubuntu's or Fedora's stock repos, so those need a third-party repo (Fedora: the [`solopasha/hyprland` COPR](https://copr.fedorainfracloud.org/coprs/solopasha/hyprland/) covers most of it) or building from source — a blank cell means "no known repo package, check the project's own install docs". Snap has essentially no coverage here (this is all system/Wayland-level tooling, not the kind of app snap packages); where an optional app happens to have one, it's noted below the table instead.
This is an Arch + Hyprland rice through and through, so the list below is Arch-authoritative — everything in the pacman column is a plain `extra`/`multilib` package on current Arch, nothing needs an AUR helper. `apt`/`dnf` columns are best-effort: Hyprland and its ecosystem (Hyprland itself, `quickshell`, `hyprcursor`, `hyprlock`) move fast and generally aren't in Debian/Ubuntu's or Fedora's stock repos, so those need a third-party repo (Fedora: the [`solopasha/hyprland` COPR](https://copr.fedorainfracloud.org/coprs/solopasha/hyprland/) covers most of it) or building from source — a blank cell means "no known repo package, check the project's own install docs". Snap has essentially no coverage here (this is all system/Wayland-level tooling, not the kind of app snap packages); where an optional app happens to have one, it's noted below the table instead.
| Program | What it's for | pacman | apt | dnf |
|---|---|---|---|---|
@@ -233,6 +244,8 @@ This is an Arch + Hyprland rice through and through, so the list below is Arch-a
| `thunar` (+ `thunar-volman`, `thunar-archive-plugin`, `tumbler`, `gvfs`) | File manager, mounting, archives, thumbnails | `thunar thunar-volman thunar-archive-plugin tumbler gvfs` | `thunar thunar-volman thunar-archive-plugin tumbler gvfs` | `thunar thunar-volman thunar-archive-plugin tumbler gvfs` |
| `swaybg` | Wallpaper (static) | `swaybg` | `swaybg` | `swaybg` |
| `awww` | Wallpaper (animated GIF only, optional) | `awww` | build from [source](https://codeberg.org/LGFae/awww) | build from [source](https://codeberg.org/LGFae/awww) |
| `hyprlock` | Lock screen | `hyprlock` | build from [source](https://github.com/hyprwm/hyprlock) | build from [source](https://github.com/hyprwm/hyprlock) |
| `ffmpeg` | Re-encodes the wallpaper for the lock screen's background | `ffmpeg` | `ffmpeg` | `ffmpeg` (RPM Fusion) |
| `hyprcursor` (`hyprcursor-util`) | Cursor theme build | `hyprcursor` | — | `hyprcursor` (COPR) |
| `librsvg` (`rsvg-convert`) | Cursor theme build | `librsvg` | `librsvg2-bin` | `librsvg2-tools` |
| `grim` + `slurp` | Screenshots | `grim slurp` | `grim slurp` | `grim slurp` |
@@ -270,19 +283,20 @@ sudo pacman -S --needed hyprland sddm xdg-desktop-portal-hyprland quickshell kit
papirus-icon-theme ttf-jetbrains-mono-nerd
# Debian/Ubuntu (apt) - covers everything except Hyprland/quickshell/hyprcursor/
# cliphist, which need a third-party repo or a source build on this base
# cliphist/hyprlock, which need a third-party repo or a source build on this base
sudo apt install kitty rofi mako-notifier thunar thunar-volman thunar-archive-plugin \
tumbler gvfs xarchiver swaybg librsvg2-bin grim slurp \
tumbler gvfs xarchiver swaybg librsvg2-bin grim slurp ffmpeg \
wl-clipboard zenity network-manager network-manager-gnome wireplumber pavucontrol \
blueman brightnessctl playerctl lm-sensors nvidia-utils-535 curl python3 \
qt6ct materia-gtk-theme papirus-icon-theme sddm
# Fedora (dnf) - add the solopasha/hyprland COPR first for Hyprland/hyprcursor/
# xdg-desktop-portal-hyprland; quickshell/cliphist/nwg-look/materia-gtk-theme still need a build
# xdg-desktop-portal-hyprland; quickshell/cliphist/nwg-look/materia-gtk-theme/hyprlock
# still need a build. ffmpeg needs the RPM Fusion free repo (not in Fedora's base repos)
sudo dnf copr enable solopasha/hyprland
sudo dnf install hyprland xdg-desktop-portal-hyprland hyprcursor kitty rofi mako thunar \
thunar-volman thunar-archive-plugin tumbler gvfs gvfs-mtp gvfs-smb xarchiver \
swaybg librsvg2-tools grim slurp wl-clipboard zenity NetworkManager \
swaybg librsvg2-tools grim slurp wl-clipboard zenity ffmpeg NetworkManager \
network-manager-applet wireplumber pavucontrol blueman brightnessctl playerctl \
lm_sensors xorg-x11-drv-nvidia-cuda curl python3 qt6ct papirus-icon-theme sddm
```

View File

@@ -341,6 +341,10 @@ hl.bind(mainMod .. " + " .. "Q", hl.dsp.window.close())
hl.bind(mainMod .. " + " .. "SHIFT" .. " + " .. "E", hl.dsp.exit())
-- pgrep guard: pressing the bind again (or anything re-triggering it) while hyprlock is
-- already running must not spawn a second instance on top of the first.
hl.bind(mainMod .. " + " .. "L", hl.dsp.exec_cmd("pgrep -x hyprlock || hyprlock"))
hl.bind(mainMod .. " + " .. "F", hl.dsp.window.fullscreen())
hl.bind(mainMod .. " + " .. "V", hl.dsp.window.float())

86
hypr/hyprlock.conf Normal file
View File

@@ -0,0 +1,86 @@
# Generated by theme/render.py from the active palette.
# Edit the template at ~/.config/theme/templates/hyprlock/hyprlock.conf, not the output.
#
# hyprlock's config language only reliably parses its hex color forms here -
# rgb(RRGGBB)/rgba(RRGGBBAA), no commas, alpha as a hex byte appended - not the CSS
# decimal rgba(r, g, b, a) form render.py's .rgba placeholder produces for every other
# app. Hence .hexa below instead of .rgba.
#
# Animations stay disabled: on this GPU/driver, hyprlock's fade-in timer touches a
# screencopy resource that fails to set up at startup regardless of what background is
# actually configured, crashing it right after "Starting fade in" - disabling the
# animation is what stops that, not just avoiding a live screenshot background.
$font = JetBrainsMono Nerd Font
general {
hide_cursor = false
}
animations {
enabled = false
}
background {
monitor =
path = /home/nico/.config/hypr/lockscreen-wallpaper.jpg
color = rgb(1a1b26)
blur_passes = 3
blur_size = 8
}
input-field {
monitor =
size = 20%, 5%
outline_thickness = 3
inner_color = rgba(1a1b268c)
outer_color = rgba(1793d1ff)
check_color = rgba(1793d1ff)
fail_color = rgba(f7768eff)
font_color = rgba(c0caf5ff)
fade_on_empty = false
rounding = 15
font_family = $font
placeholder_text = Password
fail_text = Wrong password
dots_spacing = 0.3
position = 0, -150
halign = center
valign = center
}
# Username
label {
monitor =
text = cmd[update:3600000] whoami
font_size = 16
font_family = $font
color = rgba(1793d1ff)
position = 0, -90
halign = center
valign = center
}
# Clock
label {
monitor =
text = $TIME
font_size = 90
font_family = $font
color = rgba(c0caf5ff)
position = 0, 110
halign = center
valign = center
}
# Date
label {
monitor =
text = cmd[update:60000] date +"%A, %d %B %Y"
font_size = 20
font_family = $font
color = rgba(565f89ff)
position = 0, 10
halign = center
valign = center
}

View File

@@ -82,10 +82,10 @@ if [ "$INSTALL_DEPS" = 1 ]; then
echo "Installing dependencies via pacman (see README.md for apt/dnf equivalents)..."
sudo pacman -S --needed hyprland sddm xdg-desktop-portal-hyprland quickshell kitty rofi \
mako thunar thunar-volman thunar-archive-plugin tumbler gvfs gvfs-mtp gvfs-smb \
xarchiver swaybg awww hyprcursor librsvg grim slurp wl-clipboard cliphist zenity \
networkmanager network-manager-applet wireplumber pavucontrol blueman brightnessctl \
playerctl lm_sensors nvidia-utils curl python qt6ct nwg-look materia-gtk-theme \
papirus-icon-theme ttf-jetbrains-mono-nerd
xarchiver swaybg awww hyprlock ffmpeg hyprcursor librsvg grim slurp wl-clipboard \
cliphist zenity networkmanager network-manager-applet wireplumber pavucontrol \
blueman brightnessctl playerctl lm_sensors nvidia-utils curl python qt6ct nwg-look \
materia-gtk-theme papirus-icon-theme ttf-jetbrains-mono-nerd
else
echo "--deps only knows pacman (Arch). See the Requirements section in README.md for apt/dnf." >&2
fi

View File

@@ -29,6 +29,7 @@ TEMPLATES = os.path.join(HERE, "templates")
SDDM_THEME_SRC = os.path.expanduser("~/.config/sddm/aether-rice")
SDDM_THEME_DEST = "/usr/share/sddm/themes/aether-rice"
WALLPAPER = os.path.expanduser("~/.config/hypr/wallpaper.png")
LOCK_WALLPAPER = os.path.expanduser("~/.config/hypr/lockscreen-wallpaper.jpg")
PLACEHOLDER = re.compile(r"\{([a-zA-Z0-9_]+)(?:\.([a-zA-Z0-9_]+))?(?::([^}]+))?\}")
@@ -68,6 +69,12 @@ def substitute(text, colors):
if fmt == "rgb":
r, g, b = hex_to_rgb(value)
return f"{r},{g},{b}"
if fmt == "hexa":
# hyprlock's hyprlang-based config only reliably parses the hex color form
# (rgba(RRGGBBAA), no commas, alpha as a hex byte) - the CSS-decimal .rgba
# above silently produces the wrong syntax there.
alpha_byte = format(round(max(0.0, min(1.0, float(arg))) * 255), "02x")
return value.lstrip("#") + alpha_byte
sys.exit(f"render.py: unknown placeholder format '.{fmt}' in template")
return PLACEHOLDER.sub(repl, text)
@@ -87,6 +94,27 @@ def render_all(colors):
icon_theme.render(colors)
print(f"rendered gtk3-icons -> {icon_theme.DEST_THEME}")
sync_sddm_theme()
render_lock_wallpaper()
def render_lock_wallpaper():
"""Re-encodes the active wallpaper into a small, guaranteed-real JPEG for hyprlock.
hyprlock's own background path loader doesn't survive everything the wallpaper
picker allows here: a GIF saved under a .png name (ffmpeg content-sniffs the real
format regardless of the name, confirmed directly), or a multi-thousand-pixel
original. -frames:v 1 takes a single frame from either a still image or a GIF, and
the scale filter caps the output size instead of handing hyprlock whatever the
original happens to be.
"""
if not os.path.isfile(WALLPAPER):
return
subprocess.run([
"ffmpeg", "-y", "-i", WALLPAPER, "-frames:v", "1",
"-vf", "scale='min(2560,iw)':'min(1440,ih)':force_original_aspect_ratio=decrease",
LOCK_WALLPAPER,
], check=False, capture_output=True, timeout=15)
print(f"rendered lockscreen-wallpaper -> {LOCK_WALLPAPER}")
def sync_sddm_theme():

View File

@@ -0,0 +1,4 @@
{
"template": "hyprlock.conf",
"destination": "~/.config/hypr/hyprlock.conf"
}

View File

@@ -0,0 +1,86 @@
# Generated by theme/render.py from the active palette.
# Edit the template at ~/.config/theme/templates/hyprlock/hyprlock.conf, not the output.
#
# hyprlock's config language only reliably parses its hex color forms here -
# rgb(RRGGBB)/rgba(RRGGBBAA), no commas, alpha as a hex byte appended - not the CSS
# decimal rgba(r, g, b, a) form render.py's .rgba placeholder produces for every other
# app. Hence .hexa below instead of .rgba.
#
# Animations stay disabled: on this GPU/driver, hyprlock's fade-in timer touches a
# screencopy resource that fails to set up at startup regardless of what background is
# actually configured, crashing it right after "Starting fade in" - disabling the
# animation is what stops that, not just avoiding a live screenshot background.
$font = JetBrainsMono Nerd Font
general {
hide_cursor = false
}
animations {
enabled = false
}
background {
monitor =
path = {home}/.config/hypr/lockscreen-wallpaper.jpg
color = rgb({background.strip})
blur_passes = 3
blur_size = 8
}
input-field {
monitor =
size = 20%, 5%
outline_thickness = 3
inner_color = rgba({popup_color.hexa:0.55})
outer_color = rgba({accent.hexa:1.0})
check_color = rgba({accent.hexa:1.0})
fail_color = rgba({color1.hexa:1.0})
font_color = rgba({foreground.hexa:1.0})
fade_on_empty = false
rounding = 15
font_family = $font
placeholder_text = Password
fail_text = Wrong password
dots_spacing = 0.3
position = 0, -150
halign = center
valign = center
}
# Username
label {
monitor =
text = cmd[update:3600000] whoami
font_size = 16
font_family = $font
color = rgba({accent.hexa:1.0})
position = 0, -90
halign = center
valign = center
}
# Clock
label {
monitor =
text = $TIME
font_size = 90
font_family = $font
color = rgba({foreground.hexa:1.0})
position = 0, 110
halign = center
valign = center
}
# Date
label {
monitor =
text = cmd[update:60000] date +"%A, %d %B %Y"
font_size = 20
font_family = $font
color = rgba({color8.hexa:1.0})
position = 0, 10
halign = center
valign = center
}

View File

@@ -105,6 +105,7 @@ def restart_wallpaper_daemon():
render.sync_sddm_theme() # wallpaper.py never calls render.py, so this doesn't
# happen automatically otherwise - the login screen's
# background would just keep showing whatever it last was.
render.render_lock_wallpaper() # same reasoning, for hyprlock's background
def cmd_list():