#!/bin/sh echo "########## Starting a gamescope window" # change where necessary, like the resolution an refresh rate gamescope -W 3840 -H 2160 -r 165 --hdr-enabled --hdr-itm-enable --hdr-itm-sdr-nits 300 --hdr-sdr-content-nits 300 -f & # trying to trap the gamescope window so it can properly quit after exiting the game export gamescope_pid=$! trap "echo \"########## Killing gamescope window\" && kill -- -$gamescope_pid" SIGINT SIGTERM EXIT sleep 1s if [ -n "$WAYLAND_DISPLAY" ] || [ "$XDG_SESSION_TYPE" == "wayland" ]; then echo "########## We're Running on wayland" export WLND=1 fi sleep 1s echo "########## Disabling secondary monitor." if [ $WLND ]; then # run kscreeen-doctor and check your displays arrangement # and change where necessary kscreen-doctor output.DP-1.disable &>/dev/null fi sleep 1s # I know that gamescope will always create a display on 2 for me # run the gamescope window on a terminal and take note of which number it is DISPLAY=:2 mangohud gamemoderun "$@" # the script will "pause" here while the game is running # and will resume from the next `sleep` after you quit the game sleep 1s echo "########## Enabling secondary monitor." if [ $WLND ]; then # again, run kscreen-doctor and check the display arrangement kscreen-doctor output.DP-1.enable &>/dev/null kscreen-doctor output.DP-1.position.0,0 output.DP-3.position.1440,200 &>/dev/null fi