From 864780da662aacd08e09d603fb9b526d13c076d1 Mon Sep 17 00:00:00 2001 From: Victor Date: Wed, 5 Aug 2026 11:29:23 -0300 Subject: [PATCH] Add os-prober toggle to the bootloader menu Expose the os_prober option in the bootloader submenu. The item is only enabled when GRUB is selected and is reset when switching to a bootloader without os-prober support, mirroring the uki and removable handling. Regenerate the translation template for the new strings. --- archinstall/lib/bootloader/bootloader_menu.py | 42 +++++++++++++++++++ archinstall/locales/base.pot | 29 +++++++++---- 2 files changed, 62 insertions(+), 9 deletions(-) diff --git a/archinstall/lib/bootloader/bootloader_menu.py b/archinstall/lib/bootloader/bootloader_menu.py index 88fe8f73..65f28add 100644 --- a/archinstall/lib/bootloader/bootloader_menu.py +++ b/archinstall/lib/bootloader/bootloader_menu.py @@ -41,6 +41,11 @@ class BootloaderMenu(AbstractSubMenu[BootloaderConfiguration]): if not removable_enabled: self._bootloader_conf.removable = False + # os-prober availability + os_prober_enabled = bootloader.has_os_prober_support() + if not os_prober_enabled: + self._bootloader_conf.os_prober = False + return [ MenuItem( text=tr('Bootloader'), @@ -66,6 +71,14 @@ class BootloaderMenu(AbstractSubMenu[BootloaderConfiguration]): key='removable', enabled=removable_enabled, ), + MenuItem( + text=tr('Detect other operating systems'), + action=self._select_os_prober, + value=self._bootloader_conf.os_prober, + preview_action=self._prev_os_prober, + key='os_prober', + enabled=os_prober_enabled, + ), MenuItem( text=tr('Plymouth'), action=self._select_plymouth, @@ -92,6 +105,13 @@ class BootloaderMenu(AbstractSubMenu[BootloaderConfiguration]): return tr('Will install to /EFI/BOOT/ (removable location, safe default)') return tr('Will install to custom location with NVRAM entry') + def _prev_os_prober(self, item: MenuItem) -> str | None: + os_prober_text = f'{tr("Detect other operating systems")}' + if item.value: + return f'{os_prober_text}: {tr("Enabled")}' + else: + return f'{os_prober_text}: {tr("Disabled")}' + def _prev_plymouth(self, item: MenuItem) -> str | None: if item.value: return f'{tr("Plymouth")}: {item.value.value}' @@ -127,6 +147,15 @@ class BootloaderMenu(AbstractSubMenu[BootloaderConfiguration]): self._bootloader_conf.removable = True removable_item.enabled = True + # Update os-prober option based on bootloader + os_prober_item = self._menu_item_group.find_by_key('os_prober') + if not bootloader.has_os_prober_support(): + os_prober_item.enabled = False + os_prober_item.value = False + self._bootloader_conf.os_prober = False + else: + os_prober_item.enabled = True + return bootloader async def _select_plymouth(self, preset: PlymouthTheme | None) -> PlymouthTheme | None: @@ -219,6 +248,19 @@ class BootloaderMenu(AbstractSubMenu[BootloaderConfiguration]): case ResultType.Reset: raise ValueError('Unhandled result type') + async def _select_os_prober(self, preset: bool) -> bool: + prompt = tr('Would you like to enable os-prober to detect other operating systems (e.g. Windows)?') + '\n' + + result = await Confirmation(header=prompt, allow_skip=True, preset=preset).show() + + match result.type_: + case ResultType.Skip: + return preset + case ResultType.Selection: + return result.item() == MenuItem.yes() + case ResultType.Reset: + raise ValueError('Unhandled result type') + async def select_bootloader( preset: Bootloader | None, diff --git a/archinstall/locales/base.pot b/archinstall/locales/base.pot index a242cbaf..b5ee0d7f 100644 --- a/archinstall/locales/base.pot +++ b/archinstall/locales/base.pot @@ -209,6 +209,9 @@ msgstr "" msgid "Install to removable location" msgstr "" +msgid "Detect other operating systems" +msgstr "" + msgid "Plymouth" msgstr "" @@ -259,6 +262,11 @@ msgstr "" msgid "Systems where you want the disk to be bootable on any computer." msgstr "" +msgid "" +"Would you like to enable os-prober to detect other operating systems (e.g. " +"Windows)?" +msgstr "" + msgid "Select bootloader to install" msgstr "" @@ -906,6 +914,9 @@ msgstr "" msgid "Removable" msgstr "" +msgid "os-prober enabled" +msgstr "" + #, python-brace-format msgid "Plymouth \"{}\"" msgstr "" @@ -1122,6 +1133,15 @@ msgid "" "Select any packages from the below list that should be installed additionally" msgstr "" +msgid "" +"Pacman is already running, waiting maximum 10 minutes for it to terminate." +msgstr "" + +msgid "" +"Pre-existing pacman lock never exited. Please clean up any existing pacman " +"sessions before using archinstall." +msgstr "" + #, python-brace-format msgid "Enter the number of parallel downloads (1-{})" msgstr "" @@ -1133,15 +1153,6 @@ msgstr "" msgid "Enable colored output for pacman" msgstr "" -msgid "" -"Pacman is already running, waiting maximum 10 minutes for it to terminate." -msgstr "" - -msgid "" -"Pre-existing pacman lock never exited. Please clean up any existing pacman " -"sessions before using archinstall." -msgstr "" - msgid "The proprietary Nvidia driver is not supported by Sway." msgstr ""