Ventoy Forums

Full Version: Ultimate customisation
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,
To make the customization of Ventoy even more advanced, would it be possible to allow the customization of the F2, F4 and F5 sub-menu?

Code to be placed in grub.cfg :
Code:
function ventoy_power {
    if [ -e $vt_plugin_path/ventoy/submenu/F2.cfg ]; then
        configfile $vt_plugin_path/ventoy/submenu/F2.cfg
    else
    configfile $prefix/power.cfg
    fi
}

function ventoy_localboot {   
    if [ -e $vt_plugin_path/ventoy/submenu/F4.cfg ]; then
        configfile $vt_plugin_path/ventoy/submenu/F4.cfg
    else
    configfile $prefix/localboot.cfg
    fi
}

function ventoy_diagnosis { 
    if [ -e $vt_plugin_path/ventoy/submenu/F5.cfg ]; then
        configfile $vt_plugin_path/ventoy/submenu/F5.cfg
    else
    configfile $prefix/debug.cfg
    fi
}

function ventoy_ext_menu {   
    if [ -e $vt_plugin_path/ventoy/submenu/F6.cfg ]; then
        set ventoy_new_context=1
        configfile $vt_plugin_path/ventoy/submenu/F6.cfg
        unset ventoy_new_context
    else
       echo "ventoy_grub.cfg NOT exist."
       echo -e "\npress ENTER to exit ..."
       read vtInputKey
    fi
}

Thank you very much for your work!
You can add your own grub.cfg and launch it with F6.
https://www.ventoy.net/en/plugin_grubmenu.html
(05-05-2021, 01:44 PM)longpanda Wrote: [ -> ]You can add your own grub.cfg and launch it with F6.
https://www.ventoy.net/en/plugin_grubmenu.html

It's not that. Would it be possible to create .cfg in the main partition. If these files exist, grub.cfg launches them instead of normal files like debug.cfg, power.cfg...
F2/F4/F5 are used by Ventoy and have some special process in the C source code (e.g. cannot be nested; use the same variable context...).
So you can only use F6 for custom grub menu.
Hello, is it possible to know which function or file searches for images and folders on the key? Who creates the menu entries for each folder in treetview mode?
In the next update of Ventoy (1.0.45), you should really add this feature.
It's very quick to implement. Just drag the code from the first post in this thread into grub.cfg (replace functions for menus). Then users of this wonderful tool would just have to create "F2.cfg", "F4.cfg", "F5.cfg" and "F6.cfg" files in the "Ventoy Submenu" folder to modify the Ventoy submenus. When upgrading, all the customization will remain as before !
I tested everything and it works perfectly without changing the rest of the Ventoy structure!
F2/F4/F5 are used by Ventoy and have some special process in the C source code (e.g. cannot be nested; use the same variable context...).
So you can only use F6 for custom grub menu.

For example:
Now, if you press F2, then you can NOT press F3/F4 again unless you press ESC to return to the main menu. This is one of the Ventoy's special process in the C source code.
variable context is another aspect, I need to protect the variables used by Ventoy to prevent modified by the custom script. This is implemented by a new variable context.
So not so simple and I think F6 with submenu is enough now.
(05-18-2021, 01:17 AM)longpanda Wrote: [ -> ]F2/F4/F5 are used by Ventoy and have some special process in the C source code (e.g. cannot be nested; use the same variable context...).
So you can only use F6 for custom grub menu.

For example:
Now, if you press F2, then you can NOT press F3/F4 again unless you press ESC to return to the main menu. This is one of the Ventoy's special process in the C source code.
variable context is another aspect, I need to protect the variables used by Ventoy to prevent modified by the custom script. This is implemented by a new variable context.
So not so simple and I think F6 with submenu is enough now.

I tested it and being able to modify the other sub-menus by adding options if necessary could be a plus. Everything works perfectly and I can easily change these menus.