#!/bin/bash
# Called by t6evdi.service after startup.
# Waits for GNOME to enumerate the new display, then uses the Mutter
# DisplayConfig DBus API to apply the correct monitor positions by serial
# number — independent of whatever connector name t6evdi assigns.

sleep 6

exec runuser -u jake -- env \
    DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus \
    XDG_RUNTIME_DIR=/run/user/1000 \
    /usr/local/bin/fix-monitor-layout
