#!/bin/sh echo "########## Starting a gamescope window" gamescope -W 3840 -H 2160 -r 165 --hdr-enabled --hdr-itm-enable --hdr-itm-sdr-nits 300 --hdr-sdr-content-nits 300 -f --mangoapp & # 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 kscreen-doctor output.DP-1.disable &>/dev/null fi sleep 1s DISPLAY=:1 gamemoderun "$@" sleep 1s echo "########## Enabling secondary monitor." if [ $WLND ]; then 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