Skip to content

Commit 40cbc30

Browse files
committed
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).
1 parent 074dfbb commit 40cbc30

2 files changed

Lines changed: 26 additions & 2 deletions

File tree

archinstall/lib/hardware.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,30 @@ def is_nvidia(self) -> bool:
6868
case _:
6969
return False
7070

71+
def is_nvidia_proprietary(self) -> bool:
72+
"""
73+
True for Nvidia drivers that ship proprietary userspace components.
74+
Currently only NvidiaOpenKernel (nvidia-open-dkms): open kernel module
75+
paired with proprietary userspace. NvidiaOpenSource (nouveau) is fully
76+
open and works with Sway, so it is excluded.
77+
"""
78+
match self:
79+
case GfxDriver.NvidiaOpenKernel:
80+
return True
81+
case _:
82+
return False
83+
84+
def is_nvidia_nouveau(self) -> bool:
85+
"""
86+
True for the open-source nouveau driver (Mesa) for Nvidia GPUs.
87+
Currently only NvidiaOpenSource. Officially supported by Sway.
88+
"""
89+
match self:
90+
case GfxDriver.NvidiaOpenSource:
91+
return True
92+
case _:
93+
return False
94+
7195
def packages_text(self) -> str:
7296
pkg_names = [p.value for p in self.gfx_packages()]
7397
text = tr('Installed packages') + ':\n'

archinstall/lib/profile/profile_menu.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ async def _select_gfx_driver(self, preset: GfxDriver | None = None) -> GfxDriver
9595
driver = await select_driver(preset=preset)
9696

9797
if driver and 'Sway' in profile.current_selection_names():
98-
if driver.is_nvidia():
98+
if driver.is_nvidia_proprietary():
9999
header = tr('The proprietary Nvidia driver is not supported by Sway.') + '\n'
100100
header += tr('It is likely that you will run into issues, are you okay with that?') + '\n'
101101

@@ -105,7 +105,7 @@ async def _select_gfx_driver(self, preset: GfxDriver | None = None) -> GfxDriver
105105
preset=False,
106106
).show()
107107

108-
if result.get_value():
108+
if not result.get_value():
109109
return preset
110110

111111
return driver

0 commit comments

Comments
 (0)