Skip to content

Instantly share code, notes, and snippets.

@KokoseiJ
Created December 10, 2025 10:44
Show Gist options
  • Select an option

  • Save KokoseiJ/fdc241f2afeeb2c9c3c1744cef60702c to your computer and use it in GitHub Desktop.

Select an option

Save KokoseiJ/fdc241f2afeeb2c9c3c1744cef60702c to your computer and use it in GitHub Desktop.
Wayland Monitor detection and configuration based on model number
#!/bin/bash
MAIN_MODEL="D32L251"
SUB_MODEL="T2454pA"
INTERNAL_MODEL="LP140WU4-SPK1"
WLR_RANDR=$(wlr-randr)
MAIN_PORT=$(printf "$WLR_RANDR" | grep $MAIN_MODEL | grep -o '^[^ ]*')
SUB_PORT=$(printf "$WLR_RANDR" | grep $SUB_MODEL | grep -o '^[^ ]*')
INTERNAL_PORT=$(printf "$WLR_RANDR" | grep $INTERNAL_MODEL | grep -o '^[^ ]*')
echo $MAIN_PORT $SUB_PORT $INTERNAL_PORT
if [ -n "$MAIN_PORT" ]; then
echo "Detected Main, killing laptop screen"
wlr-randr --output "$INTERNAL_PORT" --off
if [ -n "$SUB_PORT" ]; then
echo "Detected Sub, changing geometry"
wlr-randr --output "$SUB_PORT" --on --pos 0,0 --transform 90 --output "$MAIN_PORT" --on --pos 1200,420
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment