Commit Graph

174 Commits

Author SHA1 Message Date
davc0n 944caff79f
config: add input-field fail_timeout option (#406)
* config: add input-field fail_timeout option

* config: change input-field fail_timeout to milliseconds

* input-field: fix configFailTimeoutMs type and init
2024-07-09 17:43:31 +02:00
Jasson d8ccc6f96a
core: Label exception handling + Frambuffer checks + headers (#413)
* Added exception handling in label constructor

* Framebuffer fix + moved headers

* added optional header
2024-07-09 11:32:49 +02:00
Maximilian Seidler 3bedae4436
auth: don't start pam conversation before the initial input happens (#409)
After realizing that pam modules sometimes implement a timeout, i think
it is not worth starting the convo it right away.
Now you won't get the initial PAM_PROMPT any more.
Prompt will be initialized to "Password: ", which is most commonly what
you get from pam. Subsequent prompts (e.g. 2fa) will be handled however.
2024-07-08 14:25:06 +02:00
Maximilian Seidler 43f2b7441b
core: handle missing wayland protocol support (#408)
* core: check support of wp_factional_scale_manager_v1 and wp_viewporter

* core: check support of zwlr_screencopy_manager_v1
2024-07-07 21:44:53 +02:00
Maximilian Seidler 0552a1eddd
core: add option to render solid background immediatly when bg assets are not ready (#407)
* asyncResourceGatherer: start the asyncLoop at the same time as gather

This is a prerequesit for labels beeing drawn, while backgrounds are
note ready yet.

* core: allow immediate rendering even when backgrounds are not gathered yet

Note:
We don't really need to call `asyncResourceGatherer::apply` in the
`renderLock` function, since it will get called by a call to
`asyncResourceGatherer::getAssetById` anyways.

* background: render color rectangle when asset is not ready yet

* config: add general:immediate_render config option

* core: use the --immediate-render flag in attemptRestoreOnDeath
2024-07-07 18:43:17 +02:00
Jasson a50296c181
core: minor bugfixes (#405) 2024-07-07 17:55:59 +02:00
Tom Englund 7fb3c03500
hyprlock: ensure members are accessed direct (#404)
if the unique_ptr is reset directly accessing it from the destructor
causes crashes on Clang/libc++, just access the members directly.
2024-07-06 12:24:29 +02:00
daywalker-dev 6e0921140e
helpers: fix jpeg and webp OOM error (#401)
* Update Jpeg.cpp

* Update Webp.cpp
2024-07-05 22:58:45 +02:00
Maximilian Seidler b862bbce71
auth: pam fallback log message and always call pam_end after pam_authenticate (#399)
* auth: make the fallback to sudo error more descriptive

* auth: always call pam_end after pam_authenticate
2024-07-05 22:54:40 +02:00
Maximilian Seidler 01bf48ed96
config: don't crash when getenv HOME returns null (#398) 2024-07-05 22:41:03 +02:00
Maximilian Seidler 9737bf6484
label: do not error when using cmd[] for a static label cmd (#396) 2024-07-04 18:04:45 +02:00
davc0n 5b19c6307a
config: Remove dupe input-field rounding from listKeysForSpecialCategory (#395) 2024-07-03 23:50:07 +02:00
Maximilian Seidler 9873ec58b7
asyncResourceGatherer: add dma frames before starting the asyncLoopThread (#394) 2024-07-03 19:31:16 +02:00
Maximilian Seidler 88b9ce48ed
core: improve dynamic output handling (#386)
* core: check for sessionLockSurface before calling render

This is needed, because when a new monitor is added via `onGlobal` the
order of the events is not guaranteed. Meaning that render for a
particular monitor might get called before a `CSessionLockSurface` for
that monitor exists.

* renderer: remove widgets for destroyed lockSurfaces

* asyncResourceGatherer: don't create duplicate dma frames for a specific stringPort

* core: remove renderer widgets in ~CSessionLockSurface instead of in onGlobalRemoved

* Revert "core: remove renderer widgets in ~CSessionLockSurface instead of in onGlobalRemoved"

This reverts commit 405aa42de8.

Because of destruction order, it is safer to do it in `onGlobalRemoved`.

* core: ditch dynamic DMAFrame generation

* core: identify DMAFrames via output size and stringPort

* core: fallback to background color for dynamic outputs with background:path=screenshot

* core: remove output pointer from DMAFrame
2024-07-02 00:45:06 +02:00
Maximilian Seidler 0f66aeac03
core: fix sourcing config files (#387)
* core: fix sourcing config files

The `handleSource` handle relies on `g_pConfigManager`, which therefore
needs to be moved before `init`.

* core: remove unnecessary unique pointer moves
2024-06-28 18:57:38 +02:00
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
Jasson Cordones d31e600f14
core: Inproved error handling and arg parsing (#380)
* Inproved error handling and arg parsing

* Removed duplicated lines

* Remove curly braces from short ifs, used c-style casts, used contains instead of find to parse exception, applied clang formating

* Fix Formatting
2024-06-25 20:09:52 +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
Vaxry c5b8ad03d0
core: move to hyprutils for utils (#362)
* core: move to hyprutils for utils

* Nix: add hyprutils dep

---------

Co-authored-by: Mihai Fufezan <mihai@fufexan.net>
2024-06-08 23:49:49 +02:00
André Silva 768cd3ea52
core: handle null timers in destructors (#350) 2024-05-26 18:46:53 +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
Vaxry 972c1c27e6 restore: move to runtime dir and check his
fixes #346
2024-05-23 12:58:54 +02:00
shezdy 997f222b0f
core: add zindex option to widgets (#334)
* add zheight

* move sort to renderer

* fix format

* change name to zindex
2024-05-17 19:29:05 +01: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
bvr-yr 0477df2ca4 gatherer: use absolute path in magic guess 2024-05-12 13:46:49 +03:00
davc0n c87af3aa1f
renderer: add text trim with option to disable (#310)
* renderer: add text trim with option to disable

* refactor: format CAsyncResourceGatherer::renderText

* config: change disable_text_trim to text_trim
2024-05-04 18:18:27 +01:00
Vaxry 992fb49f3a session-lock: use logicalSize in late configure
ooops

ref #303
2024-05-03 13:21:51 +01:00
Vaxry 9cca0dbb45 core: avoid sending duplicate acks for ls 2024-05-02 15:18:17 +01:00
Vaxry 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
Daniel Mensinger 415262065f
core: Add support for JPEG and WEBP background images (#286)
* Add KDevelop files to the .gitignore

* Add support for JPEG and WEBP background images

Most of the code is copy-pasted from hyprpaper

* Try doing nix stuff

* Do not use brackets for short ifs
2024-04-24 18:06:14 +01:00
Vaxry 8658386f21 image: fix build with libc++
fixes #289
2024-04-22 10:12:42 +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
bvr-yr 04267a5f83
label: add `text_align` option for multi-line text (#278) 2024-04-13 14:38:06 +01:00
Maximilian Seidler 6fa65e1172
input-field: increase default fade_timeout (#276) 2024-04-11 19:57:46 +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
bvr-yr eb1123fa2e
widgets: add Shape + minor image improve (#266)
* widgets: add Shape

* image: minor improvment

* glClear on FB alloc

* add Nix HM

* always create FB if not xray
2024-04-10 17:24:17 +01:00
Maximilian Seidler d9f6441254
core: use --immediate for attemptRestoreOnDeath (#270) 2024-04-10 11:28:24 +01:00
Maximilian Seidler 1bfe32e7fa
input-field: also fade in when checkWaiting is true (#265) 2024-04-09 11:14:25 +01:00
Maximilian Seidler a50db6d56d
core: avoid double unlocks with no_fade_out (#257) 2024-04-09 11:14:04 +01:00
bvr-yr bbbb960e42
image: add reload options (#247)
* image: add reload options

* check for actual file changes

* use modtime

* check only same paths

* add Nix HM
2024-04-07 18:09:25 +01:00
Mike Rivnak ad41b31135
core: Add user description variable (#248) 2024-03-31 02:06:11 +01:00
bvr-yr 84c6282d6a
widgets: add `rotate` option to label and image (#234)
* widgets: add `rotate` option to label and image

* use framebuffer for image
2024-03-29 19:01:11 +00:00
Maximilian Seidler 6acb7552a3
label: destroy texture (#230)
* label: destroy texture

* misc: gitignore
2024-03-26 00:37:36 +00: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
bvr-yr 1bf6ffdbe2
input-field: new color features (#201)
* input-field: new color features

* add nix HM

* add workaround for faillasset not being shown on empty imput

* comment

* change cfg option name

* remove TODO

* small fix

* one more edge check

* dedup changeColor function

* simplify more
2024-03-19 02:46:52 +00:00