Files
glassMxrph/quickshell/helpers/cava.py
T
mxandClaude Opus 5.5 9aa61559eb Fix stray dock items and orphaned Cava
Windows whose class is a respelling of their desktop entry's
StartupWMClass (YouTube Music: "youtube-music-desktop-app" vs
"YouTube Music Desktop App") showed as separate unknown dock items.
Matching now falls back to comparing names with case and space, dash
and underscore runs normalized; ambiguous or partial names still never
match.

Quickshell fills a toplevel's IPC data only at startup, so windows
opened later lacked their initial class, mapped/hidden state and
floating flag. HyprlandService now runs one `hyprctl -j clients` query
per burst of window open/close/move/float/fullscreen/group events
(none for title changes, none while idle). Windows with neither IPC
data nor a foreign-toplevel handle are treated as unmapped. dock status
reports each item's window classes for diagnosis.

The Cava helper sets a parent-death signal before exec: Cava writes
nothing during silence, so it outlived a killed or crashed shell.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-07 22:52:16 +02:00

22 lines
734 B
Python

#!/usr/bin/env python3
"""Exec the optional visualizer; report an absent executable without a QML warning."""
import ctypes
import os
import signal
import sys
# Cava writes nothing during silence, so it never hits a broken pipe: without a
# parent-death signal it outlived a killed or crashed shell, capturing audio.
# The setting survives exec.
try:
ctypes.CDLL(None, use_errno=True).prctl(1, signal.SIGTERM) # PR_SET_PDEATHSIG
except (OSError, AttributeError):
pass
if os.getppid() == 1:
sys.exit(0) # The shell already exited before the signal was armed.
try:
os.execvp('cava', ['cava', '-p', sys.argv[1]])
except OSError as error:
print('Cava unavailable: ' + str(error), file=sys.stderr)
sys.exit(127)