Ventoy 菜单类型插件
- 什么是菜单类型
Ventoy是基于grub2的,在grub2的主题中有菜单类型的概念,详细描述可以参考 https://www.gnu.org/software/grub/manual/grub/grub.html
简单来说,就是你可以为一个菜单定义一个 class 然后针对这种class的菜单可以显示一个图标。例如,你给一个菜单定义了一个 'ubuntu' 的 calss,
然后在 theme 的 icons 目录下放了一个 ubuntu.png
文件,然后菜单就会以如下形式显示:
- Json 定义
关于 ventoy.json 的位置以及相关说明,请首先参考 插件入口 (*必读)
在镜像分区 /ventoy/ventoy.json
中定义了一个 menu_class
的数组用于描述菜单类型配置。可以分别设置文件或者目录的菜单类型。
对于文件,使用key
关键字,使用字符串匹配,而对于目录,使用dir
关键字,指定全路径。
{ "menu_class": [ { "key": "MX-", "class": "mx" }, { "key": "ubuntu", "class": "ubuntu" }, { "key": "CentOS-7-", "class": "centos" }, { "dir": "/ISO/Linux", "class": "linux" } ] }
关键字 | 类型 | 描述 |
---|---|---|
key |
STRING |
Ventoy将会在ISO/WIM文件的名字中(不包含目录部分)搜索 key,如果能搜到则使用对应的class。 |
dir |
STRING |
文件夹的全路径,对于指定的文件夹使用对应的class。 |
class |
STRING |
菜单类型字符串 (最大长度: 128)。一般在 icons 目录下会放置一个同名的 png文件作为显示的图标文件。 |
- menu_class数组中越靠前优先级越高
- 对于key的匹配是字符串搜索,类似于C语言的
strstr(iso_name, key)
对于 dir 则是完全匹配,类似于C语言的strcmp(dir_path, dir)
- 需要说明的是,如果U盘中有海量的ISO文件,同时定义了一个很长的menu_class数组,则启动时可能会等较长时间才能加载出Ventoy界面。
- 你需要调整 theme.txt 中
item_spacing
item_padding
item_icon_space
等变量的值,以获得更好的显示效果。(参考 Grub2 theme tutorial)
内置类型 | 描述 |
---|---|
vtoyret |
所有 “返回上一级菜单” 都是用这个类型 |
vtoydir |
如果没有定义 menu_class 配置,或者里面没有匹配的,则默认使用这个作为目录的类型 |
vtoyiso |
如果没有定义 menu_class 配置,或者里面没有匹配的,则默认使用这个作为ISO文件的类型 |
vtoywim |
如果没有定义 menu_class 配置,或者里面没有匹配的,则默认使用这个作为WIM文件的类型 |
vtoyimg |
如果没有定义 menu_class 配置,或者里面没有匹配的,则默认使用这个作为IMG文件的类型 |
vtoyefi |
如果没有定义 menu_class 配置,或者里面没有匹配的,则默认使用这个作为EFI文件的类型 |
vtoyvhd |
如果没有定义 menu_class 配置,或者里面没有匹配的,则默认使用这个作为VHD文件的类型 |
vtoyvtoy |
如果没有定义 menu_class 配置,或者里面没有匹配的,则默认使用这个作为vtoy文件的类型 |
power_reboot |
F2 Power --- Reboot |
power_halt |
F2 Power --- Halt |
boot_windows |
F4 Localboot --- Search and boot Windows |
boot_g4d |
F4 Localboot --- Search and boot Grub4dos |
boot_disk |
F4 Localboot --- Boot the 1st/2nd/3rd local disk |
boot_uefi |
F4 Localboot --- Search and boot BOOTX64.EFI |
debug_krdlayout |
F5 Tools --- Keyboard Layouts |
debug_kbd |
F5 Tools --- Keyboard Layouts --- QWERTY_USA/AZERTY/CZECH_QWERTY... |
debug_resolution |
F5 Tools --- Resolution Configuration |
debug_videomode |
F5 Tools --- Resolution Item (e.g. 1024x768x32) |
debug_screen_mode |
F5 Tools --- Screen Display Mode |
debug_text_mode |
F5 Tools --- Screen Display Mode --- Force Text Mode |
debug_gui_mode |
F5 Tools --- Screen Display Mode --- Force Graphics Mode |
debug_json |
F5 Tools --- Check plugin json configuration (ventoy.json) |
debug_control |
F5 Tools --- Check global control plugin configuration |
debug_theme |
F5 Tools --- Check theme plugin configuration |
debug_autoinstall |
F5 Tools --- Check auto install plugin configuration |
debug_persistence |
F5 Tools --- Check persistence plugin configuration |
debug_menualias |
F5 Tools --- Check menu alias plugin configuration |
debug_menuclass |
F5 Tools --- Check menu class plugin configuration |
debug_injection |
F5 Tools --- Check injection plugin configuration |
debug_automemdisk |
F5 Tools --- Check auto memdisk plugin configuration |
debug_imagelist |
F5 Tools --- Check image list plugin configuration |
debug_imageblacklist |
F5 Tools --- Check image blacklist plugin configuration |
debug_bootconf_replace |
F5 Tools --- Check boot conf replace plugin configuration |
debug_dud |
F5 Tools --- Check dud plugin configuration |
debug_pwd |
F5 Tools --- Check password plugin configuration |
debug_custom_boot |
F5 Tools --- Check custom boot plugin configuration |
debug_util |
F5 Tools --- Ventoy UEFI Utilities |
- 多模式选项
支持。可以分别针对 x86 Legacy BIOS、IA32 UEFI、x86_64 UEFI 和 ARM64 UEFI 模式做不同的设置。详细说明请参考 多模式选项
- 目录结构