forked from outlyer-net/geforce-now-linux
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgeforce-now-linux
executable file
·110 lines (96 loc) · 3.84 KB
/
geforce-now-linux
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#!/bin/bash
#
# A forked and maintained launcher for NVIDIA GeForce NOW on Linux.
#
# Forked and maintained by piqle <[email protected]>
#
# MIT License
# References:
# 1. https://www.gamingonlinux.com/2020/08/nvidia-geforce-now-adds-chromebook-support-so-you-can-run-it-on-linux-too
# 2. https://www.gamingonlinux.com/2020/09/nvidia-geforce-now-on-linux-can-run-without-user-agent-spoofing-in-a-browser
# 3. https://peter.sh/experiments/chromium-command-line-switches/
# 4. https://www.whatismybrowser.com/guides/the-latest-user-agent/chrome-os
# 5. https://developers.whatismybrowser.com/useragents/explore/operating_system_name/chrome-os/
# 6. https://wiki.archlinux.org/index.php?title=Chromium&oldid=807040#Hardware_video_acceleration
# Configuration, tweak as you see fit. 1=On, anything else means Off
# NOTE: There's actually no need to edit the script directly, can invoke setting the
# variable first, e.g.:
# > START_MAXIMIZED=0 START_IN_INCOGNITO=1 geforce-now-linux
# > CHROMIUM_VARIANTS='chromium microsoft-edge' geforce-now-linux
START_MAXIMIZED=${START_MAXIMIZED:-1} # Starts maximized but not completely full screen
START_IN_INCOGNITO=${START_IN_INCOGNITO:-0} # This doesn't seem to have any effect on my system
START_FULLSCREEN=${START_FULLSCREEN:-1} # Starts full screen, toggle with F11
OVERRIDE_USER_AGENT=${OVERRIDE_USER_AGENT:-0} # Pretend to be running under ChromeOS
HW_ACCELERATION=${HW_ACCELERATION:-0} # Enables Hardware Video Acceleration
# The first available known chromium browser will be used
# Reorder if you have a different preference, or set the CHROMIUM_VARIANTS environment variable
# as noted above
# Opera doesn't appear to take the --app option so I'm not including it
# NOTE: In my tests Chromium gives an error when trying to start a game
declare -ra DEFAULT_CHROMIUM_VARIANTS=( \
google-chrome \
microsoft-edge \
vivaldi \
microsoft-edge-dev \
chromium \
)
CHROMIUM_VARIANTS=${CHROMIUM_VARIANTS:-${DEFAULT_CHROMIUM_VARIANTS[@]}}
# TODO: Match the user agent to the installed version. Probably overkill
# The corresponding chrome version is easy (--version) but the CrOS
# version probably not so much without a table
Mozilla/5.0 (X11; CrOS x86_64 15633.69.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.6045.212 Safari/537.36
# --- You probably shouldn't change anything below here ---
# Pretty-print 1 (on) and 0 (off) values
on_off() {
local val='off'
[[ $1 -eq 0 ]] || val='on'
echo $val
}
ua=$USER_AGENT
if [[ $OVERRIDE_USER_AGENT -ne 1 ]]; then
ua="(Browser's user agent)"
fi
cat >&2 <<EOF
Configuration variables:
START_MAXIMIZED: $(on_off $START_MAXIMIZED)
START_IN_INCOGNITO: $(on_off $START_IN_INCOGNITO)
START_FULLSCREEN: $(on_off $START_FULLSCREEN)
OVERRIDE_USER_AGENT: $(on_off $OVERRIDE_USER_AGENT)
USER_AGENT: $ua
CHROMIUM_VARIANTS: ${CHROMIUM_VARIANTS[@]}
HW_ACCELERATION: $(on_off $HW_ACCELERATION)
EOF
unset ua
# Pick the first variant available
for variant in ${CHROMIUM_VARIANTS[@]}; do
if type -p $variant ; then
CHROMIUM=$variant
break
fi >/dev/null
done
if [[ -z "$CHROMIUM" ]]; then
echo "No known variant of Chromium detected, aborting..." >&2
exit 1
fi
echo Selected chromium variant: $CHROMIUM >&2
OPTIONS=
if [[ $START_IN_INCOGNITO = 1 ]]; then
OPTIONS+=( "--start-in-incognito" )
fi
if [[ $START_MAXIMIZED = 1 ]]; then
OPTIONS+=( "--start-maximized" )
fi
if [[ $START_FULLSCREEN = 1 ]]; then
OPTIONS+=( "--start-fullscreen" )
fi
if [[ $OVERRIDE_USER_AGENT -eq 1 ]]; then
OPTIONS+=( "--user-agent=$USER_AGENT" )
fi
if [[ $HW_ACCELERATION -eq 1 ]]; then
OPTIONS+-( "--enable-features=VaapiVideoDecodeLinuxGL" )
fi
echo Running with options: "${OPTIONS[@]}" >&2
# NOTE: Can test effective User Agent e.g. directly via Google:
# https://google.com/search?q=what+is+my+user+agent
exec $CHROMIUM "${OPTIONS[@]}" \
--app=https://play.geforcenow.com