Skip to content

Commit cc2fb73

Browse files
committed
Allow open nvidia drivers to be shown if they are all that is
available for a given version.
1 parent f307ebe commit cc2fb73

File tree

1 file changed

+24
-14
lines changed

1 file changed

+24
-14
lines changed

usr/lib/linuxmint/mintdrivers/mintdrivers.py

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -458,26 +458,39 @@ def gather_device_data(self, device):
458458
except KeyError:
459459
pass
460460

461-
# -open nvidia drivers are recommended now over normal ones. Go thru the list and get the version of the recommended one,
462-
# then we can flag the non-'open' one instead.
463-
new_recommended = None
461+
# - When -open and normal versions of a driver exist, only show the normal one (and set recommendation to match).
462+
# - Never show server drivers.
463+
# - 02/13/2025: As of nvidia 560, closed source drivers may not be available for a given version.
464+
ignored = []
465+
464466
for pkg_driver_name in device['drivers']:
467+
# Skip 'server' drivers
468+
if pkg_driver_name.endswith(("-server", "-server-open")):
469+
print("Ignoring server NVIDIA driver '%s'" % pkg_driver_name)
470+
ignored.append(pkg_driver_name)
471+
472+
is_open = pkg_driver_name.endswith("-open")
465473
current_driver = device['drivers'][pkg_driver_name]
466-
try:
467-
if current_driver['recommended'] and current_driver['from_distro']:
468-
driver_status = 'recommended'
469-
if pkg_driver_name.endswith("-open"):
470-
new_recommended = pkg_driver_name.replace("-open", "")
471-
except KeyError:
472-
pass
474+
recommended = current_driver.get("recommended", False) and current_driver.get("from_distro", False)
475+
476+
if is_open:
477+
closed_name = pkg_driver_name.replace("-open", "")
478+
has_closed = closed_name in device['drivers']
479+
if has_closed:
480+
print("Ignoring open NVIDIA driver '%s' as a closed one exists and is preferred." % pkg_driver_name)
481+
if recommended:
482+
device['drivers'][closed_name]["recommended"] = True
483+
ignored.append(pkg_driver_name)
473484

474485
for pkg_driver_name in device['drivers']:
486+
if pkg_driver_name in ignored:
487+
continue
475488
current_driver = device['drivers'][pkg_driver_name]
476489

477490
# get general status
478491
driver_status = 'alternative'
479492
try:
480-
if (current_driver['recommended'] and current_driver['from_distro']) or pkg_driver_name == new_recommended:
493+
if (current_driver['recommended'] and current_driver['from_distro']):
481494
driver_status = 'recommended'
482495
except KeyError:
483496
pass
@@ -657,9 +670,6 @@ def show_drivers(self):
657670
# define the order of introspection
658671
for section in ('recommended', 'alternative', 'manually_installed', 'no_driver'):
659672
for driver in sorted(drivers[section], key=lambda x: self.sort_string(drivers[section], x), reverse=True):
660-
if str(driver).startswith("nvidia-driver") and str(driver).endswith(("-server", "-open")):
661-
print("Ignoring server or open NVIDIA driver: ", driver)
662-
continue
663673
radio_button = Gtk.RadioButton.new(None)
664674
label = Gtk.Label()
665675
label.set_markup(drivers[section][driver]['description'])

0 commit comments

Comments
 (0)