All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jiří 'bindiff' Wolker via Grub-devel" <grub-devel@gnu.org>
To: grub-devel@gnu.org
Cc: "Jiří 'bindiff' Wolker" <projects@jwo.cz>
Subject: [PATCH v2 0/3] Allow script-configurable GRUB menu title
Date: Tue, 27 May 2025 13:54:42 +0200	[thread overview]
Message-ID: <87plfuz2bb.fsf@gnat.mail-host-address-is-not-set> (raw)


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

             reply	other threads:[~2025-05-27 12:11 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-27 11:54 Jiří 'bindiff' Wolker via Grub-devel [this message]
2025-05-25 19:55 ` [PATCH v2 1/3] Customization of GRUB menu title Jiří Wolker via Grub-devel
2025-05-26 16:15 ` [PATCH v2 2/3] Option to set title of submenus Jiří Wolker via Grub-devel
2025-05-27 13:14   ` Vladimir 'phcoder' Serbinenko
2025-05-27 13:18     ` Jiří 'bindiff' Wolker via Grub-devel
2025-05-26 16:21 ` [PATCH v2 3/3] Documentation for the --menutitle option Jiří ‘bindiff’ Wolker via Grub-devel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87plfuz2bb.fsf@gnat.mail-host-address-is-not-set \
    --to=grub-devel@gnu.org \
    --cc=projects@jwo.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.