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.

nn-switcher.py 1.1KB

1234567891011121314151617181920212223242526272829
  1. #!/usr/bin/env python3
  2. import os
  3. from cmd import Cmd
  4. print("Nouveau/Nvidia Switch")
  5. if not os.geteuid() == 0:
  6. print("Please run program with *sudo*");
  7. exit();
  8. class MyPrompt(Cmd):
  9. def do_exit(self, inp):
  10. '''exit the application.'''
  11. return True
  12. def do_nouveau(self, inp):
  13. '''Setup Grub kernel Parameters for NOUVEAU.'''
  14. 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'
  15. print(cmd)
  16. os.system(cmd)
  17. print('Nouveau as been setup for next boot.')
  18. def do_nvidia(self, inp):
  19. '''Setup Grub kernel Parameters for NVIDIA.'''
  20. 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'
  21. print(cmd)
  22. os.system(cmd)
  23. print('Nouveau as been setup for next boot.')
  24. MyPrompt().cmdloop()