-
Notifications
You must be signed in to change notification settings - Fork 0
/
nvidia-opengl.sh
48 lines (39 loc) · 1.09 KB
/
nvidia-opengl.sh
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
#/bin/sh
USSRR=`logname`
HOME_DIR=/home/$USSRR
value_enter=$1
echo " this script should run as root user"
if [ $USER == "root" ]
then
# help
if [ $value_enter == "-h" ]
then
echo " nvidia opengl enable script
-e enable
-d disable
"
# enable
elif [ $value_enter == "-e" ]
then
sed 's/#.*O/ O/g' /etc/X11/xorg.conf.d/nvidia.conf -i
sed 's/#.*NVIDIA/xrandr --setprovideroutputsource modesetting NVIDIA/g' $HOME_DIR/.xinitrc -i
sed 's/#xrandr.*auto/xrandr --auto/g' $HOME_DIR/.xinitrc -i
echo " Detected user root"
echo " done ...."
echo " applied changes"
# disable
elif [ $value_enter == "-d" ]
then
sed 's/.*PrimaryGPU/# Option "PrimaryGPU/g' /etc/X11/xorg.conf.d/nvidia.conf -i
sed 's/xrandr.*auto/\#xrandr --auto/g' $HOME_DIR/.xinitrc -i
sed 's/xrandr.*NVIDIA/\#xrandr --setprovideroutputsource modesetting NVIDIA/g' $HOME_DIR/.xinitrc -i
echo " Detected user root"
echo " done ...."
echo " applied changes"
else
echo " input error chech -h to view use of this script "
fi
else
echo " this current user is not root
please run this script as root"
fi