Commit graph

87 commits

Author SHA1 Message Date
Maximilian Seidler
318c00d6d0
core: stabilize label updates and revision locking in the asyncResourceGatherer (#384)
* core: handle rerendering when frameCallback is pending

* core: log when skipping label updates

* asyncResourceGatherer: remove busy and use loopMutex

Makes getAssetById fail less often and thus labels get more stable
updates

* asyncResourceGatherer: revision locking

`assetsMutex` was not needed, since `apply` only gets called from the
main thread and resources are also only aquired via the main thread.

`preloadTargets`, previously kinda guarded by the `busy` flag are now
locked as suggested in #367 (but via a copy of `peloadTargets`).

`apply` now returns a boolean so that the locking of preloadTargets in
combination with checking `preloadTargets.empty()` is a bit nicer.

* asyncResourceGatherer: remove explicit template arg for unique lock
2024-06-26 20:31:15 +02:00
Florian Walter
210b456c15
core: fix second instance of hyprlock unlocking session (#376)
* fix second instance of hyprlock unlocking session

* fix segfault when lock cannot be acquired

* improve ordering of display roundtrips
2024-06-25 13:46:58 +02:00
Tom Englund
58c93d8de8
core: fix a few reported leaks by asan (#349)
* widgets: add missing virtual destructor

destructor is missing and as a consequence all sub classes gets wrongly
destructed reported as "new-delete-type-mismatch" by asan.

* gatherer: free memory allocated by pango

with pango_parse_markup its up to the caller of the function to free the
pointer to the text returned stored in this buf.

* core: add destructor and free devices

add a destructor and free both drmDevice and gbmDevice, leaks reported
by asan.

* core: free xkb allocated state and keymap

free xkb state and keymap on destruction to prevent leak on exit and
less asan spam.

* locksurface: destroy the surface frame on done

the callback was never being destroyed and is leaking on each
frameCallback creation, call wl_callback_destroy in onCallback() and
free the memory. reported with asan.
2024-05-25 20:05:37 +02:00
972c1c27e6 restore: move to runtime dir and check his
fixes #346
2024-05-23 12:58:54 +02:00
Maximilian Seidler
316c37746d
core: add key repeat for backspace and make del clear the input (#277)
* core: add support for repeating backspace when held

* core: move keysym handling to a seperate function in order to reuse it for key repeat

* core: get keyboard repeat info from wayland

* core: defaults for keyboard repeat and delay
2024-05-14 16:11:45 +01:00
992fb49f3a session-lock: use logicalSize in late configure
ooops

ref #303
2024-05-03 13:21:51 +01:00
9cca0dbb45 core: avoid sending duplicate acks for ls 2024-05-02 15:18:17 +01:00
1651b02cc1 core: update renderer on late scale changes
ref https://github.com/hyprwm/Hyprland/issues/5842, in case a compositor sends the scale after configure
2024-05-02 15:17:04 +01:00
André Silva
307e473759
core: fix initialization issues in LockSurface (#285)
* LockSurface: handle uninitialized eglWindow in destructor

* LockSurface: don't render before configuration
2024-04-19 19:48:11 +01:00
Maximilian Seidler
883fbdfe01
auth: implement a full pam conversation (#205)
* auth: implement a full pam conversation

* input-field: fixup failedAttempts and color change

Credits to @bvr-yr

* pam: set default module to hyprland

* input-field: backup previous asset

* auth: restart auth in onPasswordCheckTimer

* auth: immediately switch to waiting when input was submitted

* auth: remove redundant waitingForPamAuth

* auth: add inputRequested and reschedule submitInput

* auth: clear password buffer and handle submitInput before input is requested

* Revert "input-field: backup previous asset"

This reverts commit 89702945be6af4aa43f54688ad34a4ccba994a3e.

Without the backup we avoid rendering the prompt placeholder for one frame when the failText is not available.
Looks better this way.

* auth: fallback to su if pam_module not in /etc/pam.d

rare occasion where a path check even works on nix

* auth: rename inputSubmitted and resubmit callback

* auth: detach failText from the conversation

* fix rebase mistake

* auth: make sure prompt and failText are not reset when restarting auth

needed for labels

* auth: force update timers when the prompt changes

* auth: remove unused stuff
2024-04-10 22:41:31 +01:00
Maximilian Seidler
d9f6441254
core: use --immediate for attemptRestoreOnDeath (#270) 2024-04-10 11:28:24 +01:00
Maximilian Seidler
a50db6d56d
core: avoid double unlocks with no_fade_out (#257) 2024-04-09 11:14:04 +01:00
Noah GITsham
87fce7923f
core: Make Ctrl+u clear password input (#226)
* Make Ctrl+u clear password input

* Fix inconsistent indentation

* Make Ctrl+Backspace clear password input
2024-03-24 20:43:32 +00:00
bvr-yr
2448774de3
config: allow mon description for monitor value (#216)
* config: allow mon description for `monitor` value

* rename field
2024-03-23 21:06:54 +00:00
YoussefAswad
230f8aadb5
config: add option to ignore empty input (#218) 2024-03-23 15:02:03 +00:00
bvr-yr
f77e17e4d2
label: add $LAYOUT variable (#211)
* label: add `$LAYOUT` variable

* add exclamation mark as wildcard to hide layout
2024-03-21 15:19:12 +00:00
kcirick
54da0cae0f
auth: Use getpwuid(getuid()) instead of getlogin() (#204)
* Making changes

* Replacing struct with auto keyword

* Removing the extra semicolon

* ran clang-format
2024-03-19 15:50:23 +00:00
Maximilian Seidler
b50acfaf94
input-field: only render the current output on fade out callback (#206) 2024-03-19 02:49:12 +00:00
Staz Modrzynski
2ae79757d5
core: Add missing destructors causing segfaults (#199)
Co-authored-by: Staz M <staz@staz.io>
2024-03-17 15:44:37 +00:00
bvr-yr
23224d40e4
input-field: various fixes (#198)
* input-field: some fixes

* simplify; correctly check passlen(utf8) in draw return

* correctly erase utf-8 on backspace

* render on up events too

* omglul

me dumb

* revert fade speed change
2024-03-17 00:32:43 +00:00
Maximilian Seidler
7ee406bf9b
core: fade out improvements (#194)
* core: allow fade out for grace unlock

* core: disable input once fade out started

* core: render when fade out started

* core: allow fade out for other compositors

Works fine in sway altough it fades to a black screen not to the desktop.
Still looks kinda good.

* Revert "core: allow fade out for other compositors"

This reverts commit adfeb543ad.

* misc: rename lock and unlock functions
2024-03-15 18:49:07 +00:00
Maximilian Seidler
e040c56ad2
core: fix libc++ compatibility (#195)
* core: add missing header

libc++ compatibility #193

* input-field: fix wrong clock type
2024-03-15 14:43:29 +00:00
Abhinav Anil
1c92c6109c
renderer: add fade out animation and property to disable (#188)
* renderer, Nix/HM module: add fade out animation and prop

* fix: fade duration and disable on non hyprland session

* fix: revert needsFrame condition, update duration to 500ms

* fix: make shadows obey widget opacity
2024-03-14 13:23:41 +00:00
Maximilian Seidler
ae889b47a0
core: mmap keymap buffer with MAP_PRIVATE (#190) 2024-03-14 13:12:43 +00:00
bvr-yr
988d5b3957
label: add $FAIL and $ATTEMPTS (#186)
* label: add `$ATTEMPTS` variable

* labels: also add `$FAIL`

* SHOUT
2024-03-13 21:25:06 +00:00
bvr-yr
f3a41161ec
input-field: add capslock and numlock options (#182)
* input-field: add capslock and numlock options

* fixups

* Nix/HM module: add {caps,num}lock options

---------

Co-authored-by: Mihai Fufezan <fufexan@protonmail.com>
2024-03-13 01:10:42 +00:00
21d9efe5c9 signal: ignore signals after critical 2024-03-10 21:42:42 +00:00
bvr-yr
066e0ae88f
core: force update labels on SIGUSR2 (#169)
* core: force update labels on `SIGUSR2`

* allow 0ms and force
2024-03-10 21:38:01 +00:00
Maximilian Seidler
766d470308
input-field: display utf-8 codepoint length (#164) 2024-03-10 14:33:01 +00:00
Abi Hafshin Alfarouq
160fe3553f
core: Handle slow pam verification (#157)
* Handle slow pam verification

For example when using systemd-homed with fido auth

* fix code style
2024-03-09 16:46:22 +00:00
bvr-yr
149b6737c2
input-field: fail display improvments (#154)
* input-field: fail display improvments

* update Home Manager

* add `$ATTEMPTS` variable, change defaults

* nix wording

* log failed attempts
2024-03-09 16:44:58 +00:00
Maximilian Seidler
5eaa7c0834
core: terminate the poll thread (#150)
* core: terminate the poll thread

* core: use sigaction instead of signal

* core: use VA_RESTART for the unlock signal
2024-03-08 22:54:34 +00:00
Kenton Groombridge
b17d666548
core: add commandline switch to lock immediately (#145)
Fixes: https://github.com/hyprwm/hyprlock/issues/143
2024-03-07 18:39:27 +00:00
Maximilian Seidler
90e94dee86
core: Allow and fix empty passwords (#140)
* Revert "core: don't auth on empty password (#126)"

This reverts commit 6a085d7f8e.

* core: properly handle pam_conv
2024-03-07 13:22:11 +00:00
cdb8e7774f core: don't restore on terminate 2024-03-06 00:00:58 +00:00
7d5cb1dbb3 misc: fix warning about iso strings 2024-03-05 23:33:28 +00:00
f0bcadc6ad restore: limit to once every 4s 2024-03-05 23:32:31 +00:00
2fa0da47ab core: restart on a critical signal or SIGHUP
ref #76
2024-03-05 19:04:01 +00:00
BranchManager
6a085d7f8e
core: don't auth on empty password (#126) 2024-03-04 00:26:38 +00:00
f9fe60c7eb pam: fallback auth to su 2024-03-03 02:27:32 +00:00
ada7ce8e56 renderer: various fixes to transformations and backgrounds
fixes #111
2024-03-03 02:19:31 +00:00
Maximilian Seidler
4286cfb29c
core: Fix unlock sync (#119)
* core: error on repeated unlock

* core: change termination points

This seems to fix sporadic freezes when unlocking.
2024-03-02 14:21:41 +00:00
Aaron Blasko
fa2a875e33
Adding a pam configuration file (#115) 2024-03-02 01:49:44 +02:00
Maximilian Seidler
64bdc477b2
Revert "core: dispatch on exit instead of roundtrip" (#114)
This reverts commit 2c7027d2b5.
Without the roundtrip it was possible that session_lock_surface_destroy gets called before unlock_and_destroy is processed.
2024-03-01 22:45:38 +00:00
Maximilian Seidler
a7ec195842 grace: ignore key up and fix typo 2024-03-01 19:52:50 +02:00
53eab43296 grace: unlock on key press
fixes #110
2024-03-01 13:53:53 +00:00
Maximilian Seidler
ac757cf7ab
input-field: show autentication failReason without additional input (#98)
This makes it so that
1. The renderer is triggered when the onPasswordCheckTimer callback is fired. Previously you had to give an
   additional input for the renderer to be triggered and the fail reason to show.
2. The updateDots function now sets dots.currentAmout to 0, when a failID is present.
   That leads to the draw function to return false and the failReason to be displayed until another input happens.
2024-02-29 14:34:27 +00:00
2c7027d2b5 core: dispatch on exit instead of roundtrip 2024-02-27 13:25:57 +00:00
EastArctica
fd8b81aec8
core: use raw key values for tracking keypresses (#92) 2024-02-26 21:18:52 +00:00
8876ceccc2 format: fix format string 2024-02-26 19:51:12 +00:00