Skip to content

Conversation

@pull
Copy link

@pull pull bot commented Aug 17, 2025

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.3)

Can you help keep this open source service alive? 💖 Please sponsor : )

audiblealert: add setting for volume
the __fire methods usually only fire a hook - this one does more than
just that
reorders code in the order it actually gets called, and
for future refactoring
splits out the parts after sleeping into a __cycle_break_countdown
method so it can be later called in a callback
this also switches this method from a `time.sleep()` call to using
__wait_for like the rest of this module.
this refactors __wait_for to start a thread and call the passed callback
after the timeout in the main thread, instead of blocking the calling
thread.
this makes it possible to more easily switch out the mechanism that
__wait_for uses for scheduling that callback later.
this adds a __fire_hook method for safely firing an event hook on the
main thread, and uses it to fire all hooks.
this ensures that all hooks are always fired from the main thread in one
central place. this makes changing that logic easier later
this also fixes the on_count_down hook, which previously wasn't always
called from the main thread.
__fire_hook also ensures that plugins don't do anything weird like
recursively calling methods that would trigger another hook instantly.

the implementation of __fire_hook is somewhat clever. it uses a
threading.Event to block on and synchronize with the event loop, so we
can wait for the plugins' response and return it.
since this implementation will later be replaced, it is okay that it is
somewhat complicated.
again, centralize the implementation in one method so it can be more
easily switched out later.
before this, the implementation is complicated and slow.
it stops the scheduler completely, waits for a second, and then restarts
it at the correct place.
this change removes all that and replaces it with setting a
_take_break_now flag and waking the scheduler. this flag is checked
after every __wait_for call and, if applicable, calls the correct code.

this makes taking a break using the -t cli flag or the "Take break now"
option noticeably faster. it also clears up the code, making it very
clear when and where a break can be taken.
instead of blocking on separate threads, use GLib timeouts to schedule
the callbacks. this allows running everything on the main thread without
blocking, and avoiding the need for any kind of complicated
synchronization.
this is no longer needed as calling SafeEyesCore.stop() now runs
synchronously on the main thread, so will complete instantly.
core: refactor to run on main thread
now that SafeEyesCore is single-threaded, this is much, much easier.
pytest: test SafeEyesCore
This uses a non-standard property on org.freedesktop.Notifications
that is present on KDE Plasma.
donotdisturb: implement detection on KDE Plasma Wayland
@pull pull bot locked and limited conversation to collaborators Aug 17, 2025
@pull pull bot added the ⤵️ pull label Aug 17, 2025
@pull pull bot merged commit 1ded330 into Uncodedtech:master Aug 17, 2025
4 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant