Commit Graph

32 Commits

Author SHA1 Message Date
Matthias Hörmann 9171f0771a fix: properly unlock on niri by flushing Wayland connection before exit
The ext-session-lock-v1 protocol does not guarantee a `finished` event
after the client calls `unlock_and_destroy` — that event is only sent
when the compositor independently terminates the lock. Waiting for it
caused rustlock to hang forever on niri (and any spec-compliant
compositor).

The previous attempt to fix this by setting exit=true immediately broke
unlocking because the while loop stopped calling event_loop.dispatch,
leaving the unlock_and_destroy bytes unflushed in the client-side
Wayland send buffer and never reaching the compositor.

Store the Connection in WaylandLock and explicitly call conn.flush()
after session_lock.unlock(), ensuring the unlock request is sent before
we exit.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-26 08:33:51 +01:00
jory 601c9677b7 Probably fix release.yml
Code Quality / quality-checks (push) Has been cancelled
Release / release-build (, arch, default) (push) Has been cancelled
Release / release-build (, debian, default) (push) Has been cancelled
Release / release-build (, fedora, default) (push) Has been cancelled
Release / release-build (, ubuntu, default) (push) Has been cancelled
Release / release-build (--no-default-features, ubuntu, no-networking) (push) Has been cancelled
Release / release (push) Has been cancelled
Security Scan / security-audit (push) Has been cancelled
v1.0
2026-03-17 22:30:11 +01:00
jory 4d90e52c36 Probably fix release.yml
Code Quality / quality-checks (push) Has been cancelled
Security Scan / security-audit (push) Has been cancelled
2026-03-17 22:22:48 +01:00
jory 55c8fc0a4f refactor: Simplify deny.toml configuration
Release / release-build (, arch, default) (push) Has been cancelled
Release / release-build (, debian, default) (push) Has been cancelled
Release / release-build (, fedora, default) (push) Has been cancelled
Release / release-build (, ubuntu, default) (push) Has been cancelled
Release / release-build (--no-default-features, ubuntu, no-networking) (push) Has been cancelled
Release / release (push) Has been cancelled
2026-03-17 22:06:34 +01:00
jory aa59067bb3 fix: replace vulnerable users crate with whoami
Code Quality / quality-checks (push) Has been cancelled
Security Scan / security-audit (push) Has been cancelled
The users crate (RUSTSEC-2025-0040) has an unfixable vulnerability.
Replace it with the maintained whoami crate for getting the current
username. Also remove metrics.yml workflow as it provided no value.
2026-03-17 21:46:09 +01:00
jory c05d987ff1 fix(ci): update depgraph argument and formatting
Code Quality / quality-checks (push) Has been cancelled
Metrics Collection / collect-metrics (push) Has been cancelled
- metrics.yml: use correct --dedup-transitive-deps flag
- render.rs: apply cargo fmt fixes
2026-03-17 20:51:14 +01:00
jory a5115c0a15 Fixed typo in metrics.yml
Metrics Collection / collect-metrics (push) Has been cancelled
Code Quality / quality-checks (push) Has been cancelled
2026-03-17 20:26:28 +01:00
jory 20cc6e210e Fix all warnings previously generated by clippy 2026-03-17 20:24:12 +01:00
jory 3038c29c57 refactor(ci): extract system deps to reusable action
Metrics Collection / collect-metrics (push) Has been cancelled
Code Quality / quality-checks (push) Has been cancelled
2026-03-17 20:07:34 +01:00
jory 50c5de5371 refactor(ci): streamline GitHub workflows
Metrics Collection / collect-metrics (push) Has been cancelled
Code Quality / quality-checks (push) Has been cancelled
Security Scan / security-audit (push) Has been cancelled
- remove build.yml (redundant with release.yml)
- security.yml: remove duplicate cargo deny check (advisories redundant with full check)
- metrics.yml: remove unused rustfmt/clippy components and no-op summary step
- quality.yml: remove duplicate cargo deny check (already runs in security workflow)
2026-03-17 19:52:38 +01:00
jory 446426ea47 Fix formatting 2026-03-17 19:26:42 +01:00
jory f4f8e94e6e Added professional ci/cd pipelines to be tested
Metrics Collection / collect-metrics (push) Has been cancelled
Code Quality / quality-checks (push) Has been cancelled
Security Scan / security-audit (push) Has been cancelled
Multi-Distro Build / build-fedora (--no-default-features, no-default-features) (push) Has been cancelled
Multi-Distro Build / build-ubuntu (, default) (push) Has been cancelled
Multi-Distro Build / build-ubuntu (--no-default-features, no-default-features) (push) Has been cancelled
Multi-Distro Build / build-debian (, default) (push) Has been cancelled
Multi-Distro Build / build-debian (--no-default-features, no-default-features) (push) Has been cancelled
Multi-Distro Build / build-fedora (, default) (push) Has been cancelled
Multi-Distro Build / build-arch (, default) (push) Has been cancelled
Multi-Distro Build / build-arch (--no-default-features, no-default-features) (push) Has been cancelled
Multi-Distro Build / build-opensuse (, default) (push) Has been cancelled
Multi-Distro Build / build-opensuse (--no-default-features, no-default-features) (push) Has been cancelled
2026-03-17 19:01:09 +01:00
jory 0309522e25 Add caps lock indicator and keyboard layout support
CI / build-ubuntu (, default) (push) Has been cancelled
CI / build-ubuntu (--features networking, networking) (push) Has been cancelled
CI / build-ubuntu (--no-default-features, no-default-features) (push) Has been cancelled
CI / build-debian (push) Has been cancelled
CI / build-fedora (push) Has been cancelled
CI / build-arch (push) Has been cancelled
CI / build-opensuse (push) Has been cancelled
- Add caps lock ring color change when caps lock is enabled (matching swaylock-effects)
- Add configurable caps lock colors: ring, text, key highlight, backspace highlight
- Add show_caps_lock_text config option (enabled by default)
- Add keyboard layout display with show_keyboard_layout option (disabled by default)
- Change keyboard_layout from u32 to String for proper display
- Add rust-cache to CI and dbus-1-dev dependency
2026-03-16 17:32:54 +01:00
jory 5e47f8a69c Added capslock functionality
Added keyboard layout func
2026-03-16 15:10:23 +01:00
jory f489a6e46e feat: Add a lot more features
CI / build-ubuntu (, default) (push) Has been cancelled
CI / build-ubuntu (--features networking, networking) (push) Has been cancelled
CI / build-ubuntu (--no-default-features, no-default-features) (push) Has been cancelled
CI / build-debian (push) Has been cancelled
CI / build-fedora (push) Has been cancelled
CI / build-arch (push) Has been cancelled
CI / build-opensuse (push) Has been cancelled
- Add new system.rs module for system monitoring via D-Bus:
  - Battery status (UPower)
  - Media player controls and metadata (MPRIS)
  - WiFi/Bluetooth status (NetworkManager)
  - Keyboard layout tracking
- Add media key support (XF86 Play/Pause/Next/Prev)
- Add function keys F1-F3 for Suspend/Reboot/PowerOff
- Replace deprecated timer.rs with async system management
- Add GitHub Actions CI/CD workflows (CI + Release)
- Update dependencies and add optional networking feature
2026-03-16 14:12:43 +01:00
jory 1dc4d68cf7 fix: update Rust edition to 2021 (valid edition) 2026-03-07 23:05:00 +01:00
jory add5c9f4f6 Added todo list to README.md 2026-03-07 22:59:10 +01:00
jory ab960c5f0c Add license and update README.md 2026-03-07 22:28:49 +01:00
jory 5b3377a15b Added grace implementation 2026-03-07 22:06:22 +01:00
jory 88f7833d8d First working version with all options except grace 2026-03-07 21:48:24 +01:00
jory 7cdcf19415 Add diagnostic logging to troubleshoot screenshot display issue 2026-03-06 22:08:38 +01:00
jory 3637accaa6 Delay lock UI rendering until screenshots are captured
- Add pending_screenshots counter to WaylandLock
- Set pending_screenshots = output_count in locked() if screenshots enabled
- Timer skips rendering while pending_screenshots > 0
- Decrement pending_screenshots on Ready or Failed events
- When all screenshots done, timer starts rendering
- This ensures screenshots capture the desktop, not the lock UI

Fixes grey screenshot issue caused by capturing lock surface itself.
Matches swaylock-effects behavior: wait for screenshots before initial render.
2026-03-06 21:56:36 +01:00
jory 5fe331122e Add comprehensive debug logging for screenshot rendering
- Timer callback: log each tick and commit status
- LockedSurface::update(): log background presence, fade alpha, feedback states
- Renderer::render(): log background drawing and fade alpha
- Ready event: log background set confirmation

These logs will help diagnose why screenshots are not displaying.
2026-03-06 21:41:15 +01:00
jory 1426b2d2d0 Fix screenshot byte order conversion (critical bug)
The conversion functions were producing big-endian ARGB (A,R,G,B) but
Cairo's ARGB32 on little-endian systems expects B,G,R,A byte order.
This caused screenshots to appear completely corrupted (likely black or
solid color).

Fixed both convert_xbgr8888_to_argb32 and convert_xrgb8888_to_argb32:
- Xbgr8888: source [R,G,B,X] -> dest [B,G,R,A=255]
- Xrgb8888: source [B,G,R,X] -> dest [B,G,R,A=255]

Added detailed comments explaining memory layouts and conversion logic
to prevent future regressions.

This should make screenshots display correctly.
2026-03-06 21:30:05 +01:00
jory 8aa84209a8 Implement working screenshot capture with wlr-screencopy
- Fixed brace mismatch and duplicate code in screenshot.rs
- Increased SHM pool size to 256MB for high-res displays
- Corrected wlr-screencopy protocol usage: send copy request in Buffer event
- Fixed background handling: set_background now updates LockedSurface.background
- Removed dummy background creation; screenshots set when ready
- Added format conversion for Xbgr8888 and Xrgb8888 to ARGB32
- Proper Y-inversion handling based on flags

The lock screen now displays captured screenshots as background.
Screenshots are taken immediately after lock, before UI is shown.
Matches swaylock-effects behavior: lock appears first, then screenshot
applies when ready (no blocking).

Fixes: black/red screen issues, screenshot not displaying.
2026-03-06 21:21:47 +01:00
jory bd6f1df391 Apply suggestions by rust 2026-03-05 15:02:45 +01:00
jory e440a86d97 Made sure we can actually render UI elements 2026-03-05 14:50:59 +01:00
jory 09b9a531cc Apply suggestions by rust 2026-03-05 14:20:45 +01:00
jory 76b48f7c70 First propper working version with actual pam 2026-03-05 14:19:08 +01:00
jory 4ed70fd858 First kinda working version 2026-03-05 12:40:53 +01:00
jory 9daa2fdd8f Removed control+c behaviour and updated keyboard handler and pam auth 2026-03-05 11:55:29 +01:00
jory a33488adc6 Initial commit of an attempt of making my own wayland locker like swaylock 2026-03-05 10:45:41 +01:00