Fix sway+nvidia confirmation dialog (#4481)

Two bugs in the Sway+Nvidia driver confirmation:

1. The boolean was inverted - confirming "yes, I'm okay with issues"
   reverted the driver to the previous choice instead of keeping it.

2. The warning triggered for any Nvidia driver, including the
   open-source nouveau driver which is officially supported by Sway.

Add GfxDriver.is_nvidia_proprietary() and is_nvidia_nouveau() methods
so the warning fires only for nvidia-open-dkms (proprietary userspace).
This commit is contained in:
Softer 2026-04-27 16:52:01 +03:00
parent 074dfbb178
commit 40cbc30997
2 changed files with 26 additions and 2 deletions

View File

@ -68,6 +68,30 @@ class GfxDriver(Enum):
case _:
return False
def is_nvidia_proprietary(self) -> bool:
"""
True for Nvidia drivers that ship proprietary userspace components.
Currently only NvidiaOpenKernel (nvidia-open-dkms): open kernel module
paired with proprietary userspace. NvidiaOpenSource (nouveau) is fully
open and works with Sway, so it is excluded.
"""
match self:
case GfxDriver.NvidiaOpenKernel:
return True
case _:
return False
def is_nvidia_nouveau(self) -> bool:
"""
True for the open-source nouveau driver (Mesa) for Nvidia GPUs.
Currently only NvidiaOpenSource. Officially supported by Sway.
"""
match self:
case GfxDriver.NvidiaOpenSource:
return True
case _:
return False
def packages_text(self) -> str:
pkg_names = [p.value for p in self.gfx_packages()]
text = tr('Installed packages') + ':\n'

View File

@ -95,7 +95,7 @@ class ProfileMenu(AbstractSubMenu[ProfileConfiguration]):
driver = await select_driver(preset=preset)
if driver and 'Sway' in profile.current_selection_names():
if driver.is_nvidia():
if driver.is_nvidia_proprietary():
header = tr('The proprietary Nvidia driver is not supported by Sway.') + '\n'
header += tr('It is likely that you will run into issues, are you okay with that?') + '\n'
@ -105,7 +105,7 @@ class ProfileMenu(AbstractSubMenu[ProfileConfiguration]):
preset=False,
).show()
if result.get_value():
if not result.get_value():
return preset
return driver