Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions usr/bin/game-performance
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
#!/usr/bin/env bash
# Helper script to enable the performance gov with proton or others
if ! command -v powerprofilesctl &>/dev/null; then
echo "Error: powerprofilesctl not found" >&2
exit 1
if command -v powerprofilesctl &>/dev/null; then
PROFILE_CMD="powerprofilesctl"
elif command -v tlpctl &>/dev/null; then
PROFILE_CMD="tlpctl"
else
echo "Error: Neither powerprofilesctl nor tlpctl found" >&2
exit 1
fi

# Don't fail if the CPU driver doesn't support performance power profile
if ! powerprofilesctl list | grep -q 'performance:'; then
if ! "$PROFILE_CMD" list | grep -q 'performance:'; then
exec "$@"
fi

# Set performance governors, as long the game is launched
if [ -n "$GAME_PERFORMANCE_SCREENSAVER_ON" ]; then
exec powerprofilesctl launch -p performance \
exec "$PROFILE_CMD" launch -p performance \
-r "Launched with CachyOS game-performance utility" -- "$@"
else
exec systemd-inhibit --why "CachyOS game-performance is running" powerprofilesctl launch \
exec systemd-inhibit --why "CachyOS game-performance is running" "$PROFILE_CMD" launch \
-p performance -r "Launched with CachyOS game-performance utility" -- "$@"
fi