Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall/lib/interactions
diff options
context:
space:
mode:
authorDaniel Girtler <blackrabbit256@gmail.com>2023-07-25 19:17:09 +1000
committerGitHub <noreply@github.com>2023-07-25 11:17:09 +0200
commit439bb5428bb6a6f512f695a83ee6b3b8f6537598 (patch)
tree8441f0597d0f4018f162633e6914c160ffc43760 /archinstall/lib/interactions
parentd76f4a029604dffe740ef1d44fa5f34ec0b23480 (diff)
Fix 1934 - audio server regression (#1946)
* Audio configuration * Update * Update schema --------- Co-authored-by: Daniel Girtler <girtler.daniel@gmail.com>
Diffstat (limited to 'archinstall/lib/interactions')
-rw-r--r--archinstall/lib/interactions/general_conf.py30
1 files changed, 23 insertions, 7 deletions
diff --git a/archinstall/lib/interactions/general_conf.py b/archinstall/lib/interactions/general_conf.py
index ad9ee386..1c570a69 100644
--- a/archinstall/lib/interactions/general_conf.py
+++ b/archinstall/lib/interactions/general_conf.py
@@ -5,6 +5,7 @@ from typing import List, Any, Optional, TYPE_CHECKING
from ..locale import list_timezones, list_keyboard_languages
from ..menu import MenuSelectionType, Menu, TextInput
+from ..models.audio_configuration import Audio, AudioConfiguration
from ..output import warn
from ..packages.packages import validate_package_list
from ..storage import storage
@@ -55,16 +56,31 @@ def ask_for_a_timezone(preset: Optional[str] = None) -> Optional[str]:
return None
-def ask_for_audio_selection(desktop: bool = True, preset: Optional[str] = None) -> Optional[str]:
- no_audio = str(_('No audio server'))
- choices = ['pipewire', 'pulseaudio'] if desktop else ['pipewire', 'pulseaudio', no_audio]
- default = 'pipewire' if desktop else no_audio
+def ask_for_audio_selection(
+ current: Optional[AudioConfiguration] = None
+) -> Optional[AudioConfiguration]:
+ choices = [
+ Audio.Pipewire.name,
+ Audio.Pulseaudio.name,
+ Audio.no_audio_text()
+ ]
- choice = Menu(_('Choose an audio server'), choices, preset_values=preset, default_option=default).run()
+ preset = current.audio.name if current else None
+
+ choice = Menu(
+ _('Choose an audio server'),
+ choices,
+ preset_values=preset
+ ).run()
match choice.type_:
- case MenuSelectionType.Skip: return preset
- case MenuSelectionType.Selection: return choice.single_value
+ case MenuSelectionType.Skip: return current
+ case MenuSelectionType.Selection:
+ value = choice.single_value
+ if value == Audio.no_audio_text():
+ return None
+ else:
+ return AudioConfiguration(Audio[value])
return None