From 785e2d5beae17065ee967304890dccd6cbc8f036 Mon Sep 17 00:00:00 2001 From: josephsmendoza Date: Sun, 18 Jun 2023 02:23:02 -0700 Subject: [PATCH] add chimeraos/gamescope-session support --- .../environment.d/gamescope-resolution.conf | 3 +++ .gitignore | 1 + .../share/gamescope-session-nested/gamescope | 5 ++-- .../gamescope-session-nested.sh | 24 ++++++++++++++----- 4 files changed, 25 insertions(+), 8 deletions(-) create mode 100644 .config/environment.d/gamescope-resolution.conf create mode 100644 .gitignore diff --git a/.config/environment.d/gamescope-resolution.conf b/.config/environment.d/gamescope-resolution.conf new file mode 100644 index 0000000..40d074d --- /dev/null +++ b/.config/environment.d/gamescope-resolution.conf @@ -0,0 +1,3 @@ +export SCREEN_HEIGHT="$(xrandr --current | grep '*' | uniq | awk '{print $1}' | cut -d 'x' -f1) -f" +export SCREEN_WIDTH="$(xrandr --current | grep '*' | uniq | awk '{print $1}' | cut -d 'x' -f2)" +if [ "$GAMESCOPECMD" ] ; then export GAMESCOPECMD+=" -W $SCREEN_WIDTH -H $SCREEN_HEIGHT" ; fi \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..79f8658 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +nohup.out \ No newline at end of file diff --git a/.local/share/gamescope-session-nested/gamescope b/.local/share/gamescope-session-nested/gamescope index 33c41b9..b43c73b 100644 --- a/.local/share/gamescope-session-nested/gamescope +++ b/.local/share/gamescope-session-nested/gamescope @@ -1,3 +1,4 @@ #!/bin/bash -echo "gamescope call intercepted, adding fullscreen flag" -$GAMESCOPE -f "$@" \ No newline at end of file +set -x +source ~/.config/environment.d/*.conf +/usr/bin/gamescope -W $SCREEN_WIDTH -H $SCREEN_HEIGHT "$@" \ No newline at end of file diff --git a/.local/share/gamescope-session-nested/gamescope-session-nested.sh b/.local/share/gamescope-session-nested/gamescope-session-nested.sh index 4befbf1..966089e 100644 --- a/.local/share/gamescope-session-nested/gamescope-session-nested.sh +++ b/.local/share/gamescope-session-nested/gamescope-session-nested.sh @@ -1,14 +1,26 @@ #!/bin/bash -set -xeuo pipefail +set -x +cd "$(dirname "$(readlink -f -- "$0")")" if pgrep -x steam; then steam -shutdown; fi while pgrep -x steam; do sleep 1; done pkill -xe gamescope || true -systemd-run --user --pty --pipe \ - --setenv GAMESCOPE="$(which gamescope)" \ - --setenv PATH="~/.local/share/gamescope-session-nested:$PATH" \ - gamescope-session +chimera="/usr/share/gamescope-session/gamescope-session-script" +if [ -f "$chimera" ] ; then + SESSIONCMD=$chimera +else + SESSIONCMD='gamescope-session' +fi -systemd-run --user steam -silent +systemd-run --user --pty --pipe \ + --setenv DISPLAY=$DISPLAY \ + --setenv WAYLAND_DISPLAY=$WAYLAND_DISPLAY \ + --setenv PATH="$PWD:$PATH" \ + $SESSIONCMD + +systemd-run --user \ + --setenv DISPLAY=$DISPLAY \ + --setenv WAYLAND_DISPLAY=$WAYLAND_DISPLAY \ + steam -silent -nofriendsui -nochatui \ No newline at end of file