ff20423a84327c7dbd50877c17b1c861af9b20a7
Hyprland was treating multi-output rustlock unlocks as client crashes and showing its "lockscreen died" failsafe instead of unlocking. Two issues: 1. Order. ext-session-lock-v1 recommends destroying every ext_session_lock_surface_v1 before issuing unlock_and_destroy on ext_session_lock_v1. rustlock did the opposite. Move lock_surfaces.clear() into handle_auth_result so it runs before session_lock.unlock(), and drop the now-redundant clear from the auth-feedback callback. 2. Drain. After unlock_and_destroy the compositor sends keyboard/pointer leave events and delete_id acks; if the client disconnects before processing them, Hyprland treats the disconnect as unclean. Add a conn.roundtrip() after the main loop to drain those events before exit. Single-output setups tolerate both of these (which is why the bug does not show up on the upstream author's laptop). The failsafe only reproduces with multiple outputs.
🔒 RustLock
A high-performance Wayland screen locker written in Rust, inspired by swaylock-effects.
✨ Features
- ⚡ Performance: Written in safe Rust, optimized binary size (~2.4MB without networking, ~4MB with)
- 🎨 Visual Effects:
- Gaussian blur (configurable radius and passes)
- Vignette effect (configurable base and factor)
- Pixelate, Swirl, and Melting effects
- Smooth fade-in animation
- 🔐 Password Indicator:
- Circular ring with configurable radius and thickness
- Dynamic key highlight segments that rotate with each keystroke
- Full password editing with cursor navigation (arrow keys, Home/End)
- Visual cursor indicator between dots
- Caps lock indicator
- 🕐 Information Display:
- Centered clock (HH:MM format)
- Full date
- System uptime
- 📻 Media & System Status (optional):
- MPRIS media player integration with album art
- Battery percentage and charging status
- WiFi SSID and signal strength
- Bluetooth connected devices
- Keyboard layout indicator
- 🔑 Session Management:
- F1: Suspend
- F2: Reboot
- F3: Power Off
- 📸 Screenshot Support:
- Captures desktop background before locking
- Custom background image support
- 🔐 Authentication:
- PAM-based authentication
- Configurable grace period (any key press within N seconds unlocks without password)
- 🎯 Customization:
- Custom icons for WiFi, Bluetooth, Battery
- Theme presets (modern, pixel, glass)
- Configuration via config file or CLI
🚀 Usage
Basic Example
rustlock --screenshots --effect-blur 7x5 --effect-vignette 0.5:0.5
Full Configuration
rustlock \
--screenshots \
--clock \
--indicator \
--indicator-radius 100 \
--indicator-thickness 7 \
--effect-blur 7x5 \
--effect-vignette 0.5:0.5 \
--ring-color 785412 \
--key-hl-color 4EAC41 \
--line-color 00000000 \
--inside-color 00000088 \
--separator-color 00000000 \
--grace 2 \
--fade-in 0.2
Session Controls
When locked, use function keys to control the system:
- F1: Suspend to RAM
- F2: Reboot
- F3: Power Off
Password Entry
Use arrow keys to move the cursor while entering your password:
- Left/Right arrows: Move cursor one position
- Home: Move to start
- End: Move to end
- Delete: Delete character at cursor
- Ctrl+U: Clear entire password
⚙️ Configuration
Options can be provided via command line or a configuration file at ~/.config/rustlock/config.toml. CLI arguments take precedence over config file, which takes precedence over theme defaults.
Options
| Option | Description |
|---|---|
| General | |
--screenshots |
Capture desktop background before locking |
--image <PATH> |
Use custom background image instead of screenshot |
--clock |
Display centered clock and date |
--indicator |
Show password entry ring (default: true) |
--indicator-radius <N> |
Ring radius in pixels (default: 100) |
--indicator-thickness <N> |
Ring thickness in pixels (default: 7) |
| Effects | |
--effect-blur <R>x<P> |
Gaussian blur: radius x passes (e.g., 7x5) |
--effect-pixelate |
Pixelate effect |
--effect-swirl |
Swirl distortion effect |
--effect-melting |
Melting distortion effect |
--effect-vignette <B>:<F> |
Vignette: base:factor (e.g., 0.5:0.5) |
| Colors | |
--ring-color <RRGGBB[AA]> |
Outer ring color (hex, optional alpha) |
--key-hl-color <RRGGBB[AA]> |
Key highlight segment color |
--line-color <RRGGBB[AA]> |
Separator line color |
--inside-color <RRGGBB[AA]> |
Inner circle color |
--separator-color <RRGGBB[AA]> |
Ring separator color |
| Display Options | |
--show-media |
Show MPRIS media info (default: true) |
--show-battery |
Show battery status (default: true) |
--show-network |
Show WiFi status (default: true) |
--show-bluetooth |
Show Bluetooth status (default: true) |
--show-keyboard-layout |
Show keyboard layout indicator (default: true) |
--show-album-art |
Show album art (default: true) |
--hide-password |
Hide password dots (default: false, dots are shown) |
| Custom Icons | |
--wifi-icon <PATH> |
Custom WiFi icon (PNG/SVG) |
--bluetooth-icon <PATH> |
Custom Bluetooth icon (PNG/SVG) |
--battery-icon <PATH> |
Custom battery icon (PNG/SVG) |
| Other | |
--grace <SECONDS> |
Grace period in seconds (default: 2) |
--fade-in <SECONDS> |
Fade-in animation duration (default: 0.2) |
--pam-service <NAME> |
PAM service name (default: "rustlock") |
--config <PATH> |
Path to config file |
--theme <NAME> |
Theme preset: modern, pixel, glass |
--debug |
Enable debug logging |
--log-file |
Write logs to ~/.rustlock.log |
📦 Installation
Using Nix (Recommended)
nix-shell -p rustlock
Or with flakes:
nix run github:yourusername/rustlock
From Source
cargo build --release
The binary will be available at target/release/rustlock.
Build Options
-
With networking (default): Includes reqwest for album art fetching
cargo build --release --features networking -
Without networking: Smaller binary (~2.4MB)
cargo build --release --no-default-features
📄 License
GPL v3
Languages
Rust
99.4%
Nix
0.6%