Skip to content

Conversation

@LunarLollipop
Copy link
Contributor

Summary

Fixes hyprctl SIGABRT crash that occurs when the screensaver window is closed (via lock screen, keyboard shortcut, or any other method).

Problem

When the screensaver is terminated externally, hyprctl crashes with SIGABRT. The crash occurs in the exit_screensaver trap handler when it calls hyprctl keyword cursor:invisible false.

Note: Dismissing via mouse movement or keyboard input does NOT crash - the script exits naturally with valid stdout.

Root Cause

  1. External close (close window keybind, lock screen pkill, hyprctl closewindow) kills the terminal window
  2. Terminal death triggers bash trap handler, but stdout is now invalid
  3. hyprctl executes the cursor command successfully
  4. hyprctl tries to print "ok" response to stdout via std::println()
  5. Write to dead PTY returns EIO → std::println() throws std::system_error
  6. Uncaught exception → std::terminate → SIGABRT

The fix discards hyprctl's output so it writes to /dev/null instead of the dead terminal.

Changes

Redirect hyprctl output in the cleanup handler to prevent crash on broken stdout:

- hyprctl keyword cursor:invisible false
+ hyprctl keyword cursor:invisible false &>/dev/null || true

Reproduction Steps

Scenario A: Close with keybind

  1. Start screensaver: omarchy-launch-screensaver force
  2. Close with close window keybind
  3. Check for crash: coredumpctl list | grep hyprctl

Scenario B: Wait for lock screen

  1. Wait for idle timeout to trigger screensaver
  2. Wait for lock screen to appear
  3. Unlock and check for crash: coredumpctl list | grep hyprctl

Expected (before fix): New hyprctl crash entry with signal 6 (SIGABRT)
Expected (after fix): No new crash

Test Plan

  • Start screensaver, close with keybind - no crash
  • Real idle flow (screensaver → lock → unlock) - no crash
  • Reverted fix, confirmed crash returns

Redirect hyprctl output in exit_screensaver() to prevent SIGABRT crash
when the screensaver window is closed externally (via keybind or lock screen).

The crash occurs because hyprctl's std::println() throws when writing to
a broken stdout after the terminal is killed.
@LunarLollipop LunarLollipop changed the base branch from master to dev January 1, 2026 06:37
@LunarLollipop LunarLollipop mentioned this pull request Jan 7, 2026
@dhh dhh merged commit 76b3e68 into basecamp:dev Jan 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants