Expand description
Runtime coordination between the daemon and the prefs subprocess.
Both write/read a PID file at the platform’s runtime location
($XDG_RUNTIME_DIR/hyprcorrect.pid on Linux, $TMPDIR/... on
macOS) so the prefs window can target SIGHUP at the daemon
specifically — pkill -x hyprcorrect would catch both processes
since they share a binary name.
Structs§
- Review
Request - A pending review request — what the user typed, what the smart provider suggested, and where to emit the result.
- Word
Suggestions - Ranked alternative spellings for one corrected word, for the review
popup’s per-field suggestion dropdown.
optionsis best-first and the first entry is normally the applied correction; the popup drops whatever matches the field’s current text and shows the rest.
Enums§
- PidError
- An error reading or writing the daemon PID file.
Functions§
- action_
path - Path to the trigger-action file. The hyprctl bind writes “word”,
“sentence”, or “review” here before signaling the daemon; the
daemon reads it on
SIGUSR1to know which action fired. The review subprocess also writes “review-apply” / “review-cancel” here when it closes, so the daemon knows what to do with the pending request file. - chord_
socket_ path - Path to the chord-capture Unix socket. The prefs window connects
here and writes
capture\nto ask the daemon to deliver the next non-modifier key press (with full modifier mask, including Super) as a chord string. The socket exists because egui-winit on Linux discards Super fromModifiers, so the prefs UI cannot record SUPER-containing chords on its own. - clear_
pid - Remove the daemon PID file (idempotent — missing file is OK). The action file is removed alongside it since the two have the same lifecycle: both are owned by the running daemon.
- clear_
review - Remove the review-request file (idempotent).
- pid_
path - Path to the daemon PID file. Falls back to the OS temp dir when
$XDG_RUNTIME_DIRis unset (macOS, restricted environments). - read_
action - Read the trigger-action file, returning the trimmed contents. An empty string is returned if the file is missing or unreadable — callers treat that as “default action” (fix-last-word).
- read_
daemon_ pid - Read the daemon’s PID from the file. Returns
Ok(None)if no file exists (no daemon running). - read_
review_ request - Read the pending review request, or
Noneif no file exists. - review_
path - Path to the review-request file. The daemon writes the original sentence + the proposed correction + trailing whitespace + the originating window’s address here when the review chord fires; the review subprocess reads it to populate the popup, then updates the same path with its decision on exit so the daemon’s apply handler can finish the job.
- write_
review_ request - Write a fresh review request to disk. Overwrites any pending one.
- write_
self_ pid - Write the current process’s PID to the daemon PID file.