Small python scrip to switch between the Nouveau Driver and Nvidia Driver at boot. Tested on Fedora 32. Use at your own risk.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
1.1 KiB

#!/usr/bin/env python3
import os
from cmd import Cmd
print("Nouveau/Nvidia Switch")
if not os.geteuid() == 0:
print("Please run program with *sudo*");
exit();
class MyPrompt(Cmd):
def do_exit(self, inp):
'''exit the application.'''
return True
def do_nouveau(self, inp):
'''Setup Grub kernel Parameters for NOUVEAU.'''
cmd = 'grubby --remove-args="rd.driver.blacklist=nouveau modprobe.blacklist=nouveau nvidia-drm.modeset=1" --args="rd.driver.blacklist=nvidia modprobe.blacklist=nvidia nvidia-drm.modeset=0" --update-kernel ALL'
print(cmd)
os.system(cmd)
print('Nouveau as been setup for next boot.')
def do_nvidia(self, inp):
'''Setup Grub kernel Parameters for NVIDIA.'''
cmd = 'grubby --remove-args="rd.driver.blacklist=nvidia modprobe.blacklist=nvidia nvidia-drm.modeset=0" --args="rd.driver.blacklist=nouveau modprobe.blacklist=nouveau nvidia-drm.modeset=1" --update-kernel ALL'
print(cmd)
os.system(cmd)
print('Nouveau as been setup for next boot.')
MyPrompt().cmdloop()