This patches allow setting custom title of menus in the GRUB menu-based interface.
This introduces new environment variable ‘grub_menu_title’ which can be set by the script to override the title shown in the text-based GRUB menu. This replaces the “GNU GRUB <version>” message, which was set to this fixed value in the source code. Now, the module ‘normal’ uses only this variable as the title text. As part of the module initialisation, the value which was previously hard-coded, is set to this variable. The ‘grub_menu_title’ variable is automatically exported to provide the same title also in the submenus. I have chosen the ‘grub_’ prefix to reduce possibility of clashes with user-defined variables in existing GRUB scripts. Any scripts using this variable to override the title will fail safely, when a version of GNU GRUB before these changes is used to run them. The GRUB will display the hard-coded title, not causing the script to fail and only degrading the user-experience a bit. Additionally, a new option ‘--menutitle’ is accepted by the ‘menuentry’ and ‘submenu’ commands. This option allows overriding the title for a submenu. This leverages existing ‘prefix’ mechanism which was previously used only to prepend the ‘setparams’ line to the source code of menu entries and submenus. If newly created scripts require to be compatible even with previous versions of GRUB, the script authors can use one of these approaches: * Use ‘set grub_menu_title="Some title"’ variable assignment explicitly. This will cause no compatibility issues. * Use the ‘--menutitle’ option of the ‘submenu’ command _after_ the menu entry title. This will cause the option to be silently ignored by versions of GRUB not supporting this option, However, the title will be passed as a part of ‘setparams’ line of the menu entry or submenu. I also decided to rename the ‘msg_formatted’ variable in ‘grub_normal_init_page()’ function to ‘msg_title’, which is a more descriptive title. My motivation for these changes was to make it easier to navigate in more complex nested menus, such as on live disks containing a multiplicity of operating systems. Jiří Wolker (3): Customization of GRUB menu title Option to set title of submenus Documentation for the --menutitle option docs/grub.texi | 13 ++++++--- grub-core/commands/menuentry.c | 49 ++++++++++++++++++++++++++++++++++ grub-core/normal/main.c | 21 ++++++++++----- 3 files changed, 74 insertions(+), 9 deletions(-) -- 2.45.3 _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel