5.1 KiB
MangoHud Position Lab
This is a direct MangoHud test harness for debugging positioning behavior outside MangoTune's preview pipeline.
Why
When right-aligned horizontal preview behavior looks wrong, the first question is whether the problem is in MangoTune's preview math or MangoHud itself. This lab runs MangoHud directly against a simple test app so the behavior can be compared without preview-only overrides.
Script
Use:
scripts/mangohud-position-lab.sh <config> [glxgears|vkcube] [output_dir]
Examples:
scripts/mangohud-position-lab.sh ~/.config/mangotune/profiles/zz_test_right_sparse_top.conf glxgears
scripts/mangohud-position-lab.sh ~/.config/mangotune/profiles/zz_test_right_full_top.conf vkcube /tmp/mh-lab/full-top
The script:
- launches MangoHud directly
- records stdout/stderr to
run.log - tries to dump the X window tree to
xwininfo.tree - tries to capture window geometry and a screenshot when
xdotool/importare available - honors
DISPLAY,XAUTHORITY,WAIT_SECS,WIDTH, andHEIGHTfrom the environment
Matrix runner
For the standard right-alignment repro set, use:
scripts/mangohud-position-matrix.sh [vkcube|glxgears] [output_dir] [profile_dir]
Examples:
scripts/mangohud-position-matrix.sh vkcube /tmp/mh-matrix
DISPLAY=:1 XAUTHORITY=/root/.Xauthority scripts/mangohud-position-matrix.sh vkcube /tmp/mh-matrix /home/aaron/mangotune-test-profiles
This generates both margin-on and margin-off variants for the standard right-alignment test profiles and captures each case directly through MangoHud.
Suggested Test Matrix
Run at least these profile families:
zz_test_right_full_top.confzz_test_right_sparse_top.confzz_test_right_sparse_middle.confzz_test_right_sparse_compact_top.confzz_test_right_sparse_compact_middle.conf
Then compare:
hud_no_marginon vs offhud_compacton vs off- sparse vs fuller layouts
top-rightvsmiddle-right
Recommended validation order:
fulltop-right, margin onfulltop-right, margin offsparsetop-right, margin onsparsetop-right, margin offsparse_compacttop-right, margin offsparsemiddle-right, margin offsparse_compactmiddle-right, margin off
Isolated Xorg on arch.lan
When local testing would interrupt the user desktop, arch.lan can run a separate Xorg on
another VT and use that for direct MangoHud captures:
ssh aaron@arch.lan
sudo -n xinit /bin/bash -lc 'xsetroot -solid black; while :; do sleep 3600; done' \
-- /usr/bin/Xorg :1 vt8 -nolisten tcp -noreset
Then from another shell:
ssh aaron@arch.lan '
DISPLAY=:1 XAUTHORITY=/root/.Xauthority \
/path/to/mangotune/scripts/mangohud-position-matrix.sh \
vkcube /tmp/mh-matrix /home/aaron/mangotune-test-profiles
'
That keeps the direct MangoHud investigation isolated from the main desktop session.
Expected MangoHud Semantics
From MangoHud's upstream README:
position=supportstop-right,middle-right, andbottom-rightdirectlyhorizontalenables horizontal layouthorizontal_stretchstretches the background to the screen width in horizontal modehud_no_marginremoves margins around MangoHudoffset_xandoffset_yare generic HUD position offsetswidth=overrides the automatically computed HUD width
That means MangoTune should be conservative about inventing extra right-anchor behavior. If MangoHud itself has a quirk here, MangoTune should document or surface it rather than baking in fragile compensations unless absolutely necessary.
Upstream source findings
From MangoHud upstream src/overlay.cpp and src/overlay_params.cpp:
- Default edge margin is
10.0f. - The margin is forced to
0.0fwhenever any of these are true:offset_x > 0offset_y > 0hud_no_marginis enabled
- For right-side anchors, MangoHud positions the HUD with:
x = display_width - window_size.x - margin + offset_x
That means:
- right anchors are native in MangoHud
- positive
offset_xpushes a right-anchored HUD farther right, not inward - because
offset_xis parsed as unsigned, MangoHud cannot use a negative right-anchor offset to nudge the HUD left fromtop-right/middle-right/bottom-right
Also note:
horizontal_stretchdefaults totrueupstream, sohorizontal_stretch=0must be written explicitly when the user disables itoffset_x/offset_yare parsed as unsigned values upstream
These semantics should be treated as source-of-truth before adding any MangoTune-side compensation.
Capture caveat
On the isolated remote Xorg lab, direct screenshot methods can still miss MangoHud's overlay entirely while capturing the app window correctly. This includes:
- ImageMagick
importagainst the app window - ImageMagick
import -window rootagainst the full desktop ffmpeg -f x11grabstyle X11 captures
So:
- direct launch/log/geometry capture is reliable there
- direct pixel capture of the overlay is not yet a trustworthy automated oracle
- if visual confirmation matters, a manual screenshot on a real desktop session is still the most reliable check