#!/bin/bash
# Gamescope window positioner for Openbox
echo "Starting gamescope window positioner..."
while true; do
# Find ALL gamescope windows and move them
xdotool search --class "gamescope" 2>/dev/null | while read WINDOW_ID; do
if [ ! -z "$WINDOW_ID" ]; then
# Get current window position
CURRENT_POS=$(xdotool getwindowgeometry "$WINDOW_ID" | grep Position | awk '{print $2}')
DESIRED_POS="0,1080"
# Only move if not already in position
if [ "$CURRENT_POS" != "$DESIRED_POS" ]; then
echo "Moving gamescope window $WINDOW_ID to 0,1080"
xdotool windowmove "$WINDOW_ID" 0 1080
# xdotool windowsize "$WINDOW_ID" 5760 1080
fi
# FORCE it to be above everything else, including Steam
# echo "Forcing gamescope window $WINDOW_ID to top layer"
# wmctrl -i -r "$WINDOW_ID" -b add,above
# xdotool windowraise "$WINDOW_ID"
fi
done
sleep 2
done