Ventoy 菜单类型插件
- 什么是菜单类型
Ventoy是基于grub2的,在grub2的主题中有菜单类型的概念,详细描述可以参考 https://www.gnu.org/software/grub/manual/grub/grub.html 
简单来说,就是你可以为一个菜单定义一个 class 然后针对这种class的菜单可以显示一个图标。例如,你给一个菜单定义了一个 'ubuntu' 的 calss,
然后在 theme 的 icons 目录下放了一个 ubuntu.png 文件,然后菜单就会以如下形式显示:
 
- Json 定义
推荐使用 VentoyPlugson 工具进行配置,无需手动创建、编辑json文件。请参考 VentoyPlugson
关于 ventoy.json 的位置以及相关说明,请首先参考  插件入口  (*必读) 
在镜像分区 /ventoy/ventoy.json 中定义了一个 menu_class 的数组用于描述菜单类型配置。可以分别设置文件或者目录的菜单类型。
对于文件,使用key关键字,使用字符串匹配,而对于目录,使用dir 关键字,指定全路径。
{
    "menu_class": [
        {
            "key": "MX-",
            "class": "mx"
        },
        {
            "key": "ubuntu",
            "class": "ubuntu"
        },        
        {
            "key": "CentOS-7-",
            "class": "centos"
        },
        {
            "parent": "/ISO/Linux/Arch",
            "class": "arch"
        },
        {
            "dir": "/ISO/Linux",
            "class": "linux"
        }        
    ]
}
| 关键字 | 类型 | 描述 | 
|---|---|---|
| key | STRING | Ventoy将会在ISO/WIM文件的名字中(不包含目录部分)搜索 key,如果能搜到则使用对应的class。 | 
| parent | STRING | 文件夹的全路径。这个目录(不包括子目录)下的所有文件都会使用这同一个 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_spacingitem_paddingitem_icon_space等变量的值,以获得更好的显示效果。(参考 Grub2 theme tutorial)
- 不管是自定义的还是下面内置的类型,都必须在 theme/icons目录下有一个和类型名称对应的png文件才能生效。
| 内置类型 | 描述 | 
|---|---|
| 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文件的类型 | 
| F4boot | 参考下面的 特殊说明 | 
| 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 | 
| F5tool | 参考下面的 特殊说明 | 
| debug_menu_lang | F5 Tools --- Menu Language Select | 
| menu_lang_item | F5 Tools --- Menu Language Select --- English/Chinese Simplified... | 
| debug_temp_set | F5 Tools --- Temporary Control Settings | 
| debug_temp_win11_bypass | F5 Tools --- Temporary Control Settings --- Bypass CPU/TPM/SecureBoot check when install Windows 11 | 
| debug_temp_win11_nro | F5 Tools --- Temporary Control Settings --- Bypass online account requirement when install Windows 11 | 
| debug_temp_linux_remount | F5 Tools --- Temporary Control Settings --- Mount Ventoy partition after boot Linux | 
| debug_temp_second_menu | F5 Tools --- Temporary Control Settings --- Show secondary boot menu | 
| debug_power | F5 Tools --- Power | 
| debug_reboot | F5 Tools --- Power --- Reboot | 
| debug_halt | F5 Tools --- Power --- Halt | 
| debug_efisetup | F5 Tools --- Power --- Reboot to EFI setup | 
| debug_hwinfo | F5 Tools --- Hardware Information | 
| 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 Configuration --- 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_theme_select | F5 Tools --- Theme Select | 
| debug_theme_item | F5 Tools --- Theme Select --- Theme Item | 
| debug_json | F5 Tools --- Check plugin json configuration (ventoy.json) | 
| debug_control | F5 Tools --- Check plugin json configuration (ventoy.json) --- Check global control plugin configuration | 
| debug_theme | F5 Tools --- Check plugin json configuration (ventoy.json) --- Check theme plugin configuration | 
| debug_autoinstall | F5 Tools --- Check plugin json configuration (ventoy.json) --- Check auto install plugin configuration | 
| debug_persistence | F5 Tools --- Check plugin json configuration (ventoy.json) --- Check persistence plugin configuration | 
| debug_menualias | F5 Tools --- Check plugin json configuration (ventoy.json) --- Check menu alias plugin configuration | 
| debug_menutip | F5 Tools --- Check plugin json configuration (ventoy.json) --- Check menu tip plugin configuration | 
| debug_menuclass | F5 Tools --- Check plugin json configuration (ventoy.json) --- Check menu class plugin configuration | 
| debug_injection | F5 Tools --- Check plugin json configuration (ventoy.json) --- Check injection plugin configuration | 
| debug_automemdisk | F5 Tools --- Check plugin json configuration (ventoy.json) --- Check auto memdisk plugin configuration | 
| debug_imagelist | F5 Tools --- Check plugin json configuration (ventoy.json) --- Check image list plugin configuration | 
| debug_imageblacklist | F5 Tools --- Check plugin json configuration (ventoy.json) --- Check image blacklist plugin configuration | 
| debug_bootconf_replace | F5 Tools --- Check plugin json configuration (ventoy.json) --- Check boot conf replace plugin configuration | 
| debug_dud | F5 Tools --- Check plugin json configuration (ventoy.json) --- Check dud plugin configuration | 
| debug_pwd | F5 Tools --- Check plugin json configuration (ventoy.json) --- Check password plugin configuration | 
| debug_custom_boot | F5 Tools --- Check plugin json configuration (ventoy.json) --- Check custom boot plugin configuration | 
| debug_util | F5 Tools --- Ventoy UEFI Utilities | 
| debug_util_efidrv | F5 Tools --- Ventoy UEFI Utilities --- Show EFI Drivers | 
| debug_util_blinit | F5 Tools --- Ventoy UEFI Utilities --- Fixup Windows BlinitializeLibrary Failure | 
| sel_auto_install | Prompt menu to select auto install script | 
| sel_persistence | Prompt menu to select persistence file | 
| sel_wim | Prompt menu to select winpe wim file | 
| second_normal | Secondary boot menu --- Boot in normal mode | 
| second_wimboot | Secondary boot menu --- Boot in wimboot mode | 
| second_grub2 | Secondary boot menu --- Boot in grub2 mode | 
| second_memdisk | Secondary boot menu --- Boot in memdisk mode | 
| second_checksum | Secondary boot menu --- File checksum | 
| second_return | Secondary boot menu --- Return to previous menu | 
- 特殊说明
对于 F4 和 F5 菜单下的子菜单,默认情况下下一级菜单会继承上一级菜单的类型。例如:
对于  F5 Tools ---> Check plugin json configuration (ventoy.json) --> Check theme plugin configuration  这个三级子菜单,它其实有3个class,依次是
debug_theme debug_json  F5tool (按照从前到后的优先级,哪个class对应的png图标文件先存在就使用哪个)。
因此,对于 F5 菜单,你在自定义主题里面只需放一个 F5tool.png 图标,则所有F5下面的子菜单、子菜单的子菜单,如果没有它们对应内建类型的图标的话,就都会默认使用这个图标。
- 多模式选项
支持。可以分别针对 x86 Legacy BIOS、IA32 UEFI、x86_64 UEFI 和 ARM64 UEFI 模式做不同的设置。详细说明请参考 多模式选项
- 目录结构
 
    
 
