Problem
plugins-claude/stl-game-config/scripts/system-info.sh:48-69 (check_kde_hdr_enabled)
reports kde_hdr_enabled: false on a system where KDE HDR is demonstrably enabled.
Two independent defects, either of which is sufficient to break it.
1. ANSI escape codes defeat the literal grep
kscreen-doctor colorizes its output even when stdout is a pipe, so the line is:
^[[01;33m<TAB>HDR: ^[[0;0menabled
There is a color-reset sequence between the label and the value, so the literal
substring HDR: enabled never appears and grep -q "HDR: enabled" (line 64) can
never match:
$ kscreen-doctor -o | grep -c "HDR: enabled"
0
The function therefore returns false unconditionally on any host where
kscreen-doctor emits color through a pipe — regardless of display state.
2. head -1 picks an arbitrary output, not the primary
Line 60 comments "Get primary output", but line 62 does no primary detection —
it takes the first line matching HDR|DDC across all outputs. On a multi-display
system that is whichever output kscreen-doctor happens to list first:
Output: 1 DP-2 -> HDR: incapable <- non-HDR secondary, listed first
Output: 2 DP-3 -> HDR: enabled <- actual primary, HDR on
Even with defect 1 fixed, this host would read the secondary display and still
report false.
The |DDC alternation in that grep is also dead weight — a DDC/CI: line can only
ever win the head -1 race and guarantee a non-match.
Reproduction
On KDE Wayland with two displays, one HDR-capable with HDR enabled and one not,
where the non-HDR display is listed first by kscreen-doctor -o:
$ bash plugins-claude/stl-game-config/scripts/system-info.sh
{
"gpu_vendor": "nvidia",
"compositor": "kde",
"kde_hdr_enabled": false
}
$ kscreen-doctor -o | grep -E "Output|HDR"
Output: 1 DP-2 ...
HDR: incapable
Output: 2 DP-3 ...
HDR: enabled
Expected kde_hdr_enabled: true.
Suggested fix
Strip ANSI before matching, drop the DDC alternation, and decide what "enabled"
means across multiple outputs — either resolve the actual primary, or report true
if any output has HDR enabled (probably the more useful signal for a
"can this box do HDR right now" check).
Sketch:
kscreen-doctor -o 2>/dev/null \
| sed 's/\x1b\[[0-9;]*m//g' \
| grep -qE '^[[:space:]]*HDR:[[:space:]]*enabled' && echo true || echo false
Consider also having kscreen-doctor emit uncolored output if it supports a flag
for that, rather than stripping after the fact.
Impact
Callers get a false negative and will route a game away from the HDR path (or
report HDR as unavailable) on a correctly configured HDR display.
Note stl-info.sh is unaffected — it has no display-HDR detection at all.
Environment
- CachyOS (Arch-based), KDE Plasma on Wayland
- NVIDIA RTX 5090,
nvidia-open-dkms 610.57.04
- Displays: MSI MPG341CX OLED 3440x1440 @ 240Hz (HDR enabled, primary), ASUS ROG PG348Q (HDR incapable)
- stl-game-config plugin 1.2.1; identical code present in the source tree at the same lines
Problem
plugins-claude/stl-game-config/scripts/system-info.sh:48-69(check_kde_hdr_enabled)reports
kde_hdr_enabled: falseon a system where KDE HDR is demonstrably enabled.Two independent defects, either of which is sufficient to break it.
1. ANSI escape codes defeat the literal grep
kscreen-doctorcolorizes its output even when stdout is a pipe, so the line is:There is a color-reset sequence between the label and the value, so the literal
substring
HDR: enablednever appears andgrep -q "HDR: enabled"(line 64) cannever match:
The function therefore returns
falseunconditionally on any host wherekscreen-doctoremits color through a pipe — regardless of display state.2.
head -1picks an arbitrary output, not the primaryLine 60 comments "Get primary output", but line 62 does no primary detection —
it takes the first line matching
HDR|DDCacross all outputs. On a multi-displaysystem that is whichever output
kscreen-doctorhappens to list first:Even with defect 1 fixed, this host would read the secondary display and still
report
false.The
|DDCalternation in that grep is also dead weight — aDDC/CI:line can onlyever win the
head -1race and guarantee a non-match.Reproduction
On KDE Wayland with two displays, one HDR-capable with HDR enabled and one not,
where the non-HDR display is listed first by
kscreen-doctor -o:Expected
kde_hdr_enabled: true.Suggested fix
Strip ANSI before matching, drop the
DDCalternation, and decide what "enabled"means across multiple outputs — either resolve the actual primary, or report true
if any output has HDR enabled (probably the more useful signal for a
"can this box do HDR right now" check).
Sketch:
Consider also having
kscreen-doctoremit uncolored output if it supports a flagfor that, rather than stripping after the fact.
Impact
Callers get a false negative and will route a game away from the HDR path (or
report HDR as unavailable) on a correctly configured HDR display.
Note
stl-info.shis unaffected — it has no display-HDR detection at all.Environment
nvidia-open-dkms610.57.04