omarchy icon indicating copy to clipboard operation
omarchy copied to clipboard

omarchy-voxtype-status script orphans child processes due to missing SIGTERM trap

Open dmitrylito opened this issue 5 months ago • 1 comments

System details

AMD 9850, Nvidia RTX 5080

What's wrong?

Bug Report: omarchy-voxtype-status Orphans Child Processes on Waybar Reloads

Description

The omarchy-voxtype-status script fails to clean up its child processes when terminated by a system signal, such as when Waybar reloads. This causes orphaned voxtype status --follow processes to accumulate in the background over time, unnecessarily cluttering the process tree and consuming system resources.

Root Cause

The script uses a trap to kill its child processes when it exits:

# File: ~/.local/share/omarchy/bin/omarchy-voxtype-status (Line 5)
trap 'kill 0' EXIT

However, in Bash, trapping EXIT only executes the cleanup command during a normal script termination. When Waybar reloads (or when the process is killed externally), it sends a SIGTERM signal to the script. Because the script does not explicitly trap SIGTERM, Bash terminates immediately without executing the kill 0 trap. This leaves the voxtype status --follow command running endlessly in the background.

Steps to Reproduce

  1. Start Waybar with the voxtype module enabled.
  2. Trigger a Waybar reload (e.g., via omarchy restart waybar or saving a Waybar config file).
  3. Run pgrep -a -f "voxtype status" and observe that the old voxtype status --follow processes are still running.
  4. Repeat the reload multiple times to see the processes multiply.

Proposed Fix

Update the trap command to explicitly catch termination and interrupt signals in addition to EXIT.

Modify line 5 in omarchy-voxtype-status from:

trap 'kill 0' EXIT

to:

trap 'kill 0' EXIT SIGTERM SIGINT

This ensures the trap fires correctly regardless of how the script is stopped, properly terminating the child voxtype polling process.

dmitrylito avatar Jun 06 '26 02:06 dmitrylito

This is fixed for the next release 👍

dhh avatar Jun 16 '26 10:06 dhh