The Minecraft Grub Theme Trio:
| Minecraft Main Menu | Minecraft World Selection Menu | > Using both themes together < |
|---|
Also check out these other projects:
| Minecraft SDDM Theme by Davi-S | Minecraft Plymouth Theme by nikp123 | Minecraft World Loading KDE Splash by Samsu-F |
|---|
This is a guide on how you can have two grub menus after one another, each in a different theme!
I made this so I can use my minegrub theme that looks like the Minecraft main menu to enter my second minegrub theme that looks like the minecraft world selection menu just like in the real game
Yea, its possible, and its fun
minegrub-double-menu-preview.mp4
There are multiple ways to install the theme, automatic installation being the easiest:
All you only need to do is to clone this project or to download the install.sh file and to execute it as root:
sudo ./install.shThe script will install all files and update the grub configuration automatically.
To update the theme, just pull the newest version of the install script and run it again.
git pull
sudo ./install.shIf you want to enable specific features of a theme (Changing splash text and backgrounds, icons for UEFI entry, etc.), check out the instructions in the respective repos.
Manual Installation
You can also choose to install it manually, just do as follow:
-
Install your two themes, in this case:
git clone https://github.com/Lxtharia/minegrub-world-sel-theme.git && cd minegrub-world-sel-theme sudo cp -ruv minegrub-world-selection /boot/grub/themes/ cd .. ### And the other one git clone https://github.com/Lxtharia/minegrub-theme.git && cd minegrub-theme sudo cp -ruv minegrub /boot/grub/themes/
- Check them out here for more instructions: minegrub-theme and minegrub-world-sel-theme
-
Set the world-selection theme in
/etc/default/gruband other trivial stuffGRUB_TIMEOUT_STYLE=menu ... GRUB_THEME=/boot/grub/themes/minegrub-world-selection/theme.txt ... GRUB_GFXMODE=...
-
clone this repo or download the files (it's only two)
git clone https://github.com/Lxtharia/minegrub-double-menu.git && cd minegrub-double-menu
-
copy the files
sudo cp ./mainmenu.cfg /boot/grub/ sudo cp ./05_twomenus /etc/grub.d/ chmod +x /etc/grub.d/05_twomenus
-
regenerate the grub.cfg
sudo grub-mkconfig -o /boot/grub/grub.cfg
-
to enable it, you need to set a grub environmental variable:
sudo grub-editenv - set config_file=mainmenu.cfg -
Done!
-
If you want to disable it all you need to do is
sudo grub-editenv - unset config_file
Gentoo Installation
- Add the overlay to your system
eselect repository enable tomoshibi-overlay emaint sync -r tomoshibi-overlay - Choose theme for minegrub-theme, there are 13 themes available that can be chosen via theme0, theme1, theme2, ..., theme12 USE flags. You can use
equery u minegrub-themeto view the description of these flags. Keep in mind that exactly one of these USE flags must be enabled.echo sys-boot/minegrub-theme theme0 > /etc/portage/package.use/50-minegrub-theme
- Install
emerge sys-boot/double-minegrub-menu::tomoshibi-overlay
- The remain steps are the same as manual installation, i'll copy these here.
- regenerate the grub.cfg
sudo grub-mkconfig -o /boot/grub/grub.cfg
- to enable it, you need to set a grub environmental variable:
sudo grub-editenv - set config_file=mainmenu.cfg - Done!
- If you want to remove it all you need to do is
emerge -c sys-boot/double-minegrub-menu::tomoshibi-overlay sudo grub-editenv - unset config_file - After that please edit your
/etc/default/grubproperly.
NixOS Installation
Add this in flake.nix:
{
inputs = {
double-minegrub-menu.url = "github:Lxtharia/double-minegrub-menu/main";
inputs.nixpkgs.follows = "nixpkgs";
};
outputs = inputs@{self, ...}: {
nixosConfigurations.<hostname> = nixpkgs.lib.nixosSystem {
modules = [
inputs.double-minegrub-menu.nixosModules.default
./configuration.nix
];
};
};
}Then enable and configure the service in your configuration file (e.g, configuration.nix) for example:
{pkgs, config, ...}: {
boot.loader.grub = {
enable = true;
#Add this on your configuration file
double-minegrub-menu = {
enable = true;
# main menu configurations
main_menu_background = "1.13 - [Aquatic update].png";
splash_text = "100% Declarative";
# world selection configurations
world_selection_background_scaled = "1366x768";
world_selection_custom_icons = with config.system; [
{
inherit name;
lineTop = with nixos; distroName + " " + codeName + " (" + version + ")";
lineBottom = "Survival Mode, No Cheats, Version: " + nixos.release;
# Icon: you can use an icon from the remote repo, or load from a local file
imgName = "nixos";
# customImg = builtins.path {
# path = ./nixos-logo.png;
# name = "nixos-img";
# };
}
];
};
};
}after that, rebuild your system, and then set the config_file environment variable in grubenv to enable the main menu theme:
nix-shell -p grub2 --command "sudo grub-editenv - set config_file=mainmenu.cfg"To remove the variable and disable the theme, run:
nix-shell -p grub2 --command "sudo grub-editenv - unset config_file=mainmenu.cfg"You can test the theme before applying it on your machine by building a VM with the bootloader:
sudo nixos-rebuild build-vm-with-bootloader --flake .#test-module
./result/bin/run-nixos-vmAfter successfully enter the system, run this command to set the config_file environment variable so that the main menu theme appears and then reboot the system:
sudo grub-editenv - set config_file=mainmenu.cfg
sudo rebootTo try different backgrounds and splash text, edit the corresponding values in module_tester.nix. Both username and password after build the VM is nixos.
| Option | Type | Default | Description |
|---|---|---|---|
enable |
boolean | false |
Whether to enable the double-minegrub-menu theme service. |
main_menu_background (optional) |
string | "random" |
the background PNG image relative to the Minegrub main menu background assets (you can see all the background assets here). Set to "random" to pick one automatically. |
splash_text (optional) |
string | "random" |
Custom splash text displayed on the menu. Set to "random" to choose a random splash text automatically. |
world_selection_custom_icons (optional) |
list | [...] | Custom icons for the Minegrub world-selection menu |
world_selection_background_scaled (optional) |
string | "1920x1080" |
Resolution to which the world-selection background is scaled. Available resolutions are; "1024x768", "1280x1024", "1280x720", "1366x768", "1536x1024", "1920x1080", "2560x1440", "2560x1600", "2736x1824". |
Ventoy Support
Ventoy is using a modified version of grub, but has theme support. If you want Ventoy to use both themes see here.
oh boi here we go:
We have our cool theme to select our distro, but now we want a main menu "before it".
When grub starts, it by default reads the file grub.cfg usually located in /boot/grub/grub.cfg to set all the options (like timeout, default boot option, theme) and add all the boot options.
This file is usually generated by grub-mkconfig which uses configuration options set in /etc/default/grub and scripts in /etc/grub.d/* to create the full config file.
NOW: what do we need?
We want grub to read a second .cfg file that sets the theme to the main menu theme (./mainmenu.cfg) and that includes boot options like "Singlebooter" "Onlinebooter" or "UEFI Realms" (so cool).
And if we select "Singlebooter" we want to load "the real config file" with the world-selection theme and that includes all of your personal boot options.
-
We need some code to autoload another config file
-
To get the code that does that into
grub.cfgwe write it in a file (05_twomenus) and put it in/etc/grub.d/, so it gets included when generating the grub.cfg -
To automatically load another configfile we can just call
configfile $prefix/mainmenu.cfgin grub.cfg$prefixcontains the disk/partition absolute path to your/boot/grubfolder
-
For some reason I thought it was a good idea to turn it off easily:
- We only load the main-menu if the environmental variable
config_file=is set - if yes, we load that file (with
configfile $prefix/$config_file) grub.cfgnormally loads variables automatically from the file/boot/grub/grubenv, so all we have to do is set it there- with
grub-editenv - set config_file=mainmenu.cfg
- We only load the main-menu if the environmental variable
-
now mainmenu.cfg gets loaded.
-
the first boot item will load our
grub.cfg-configfile again. -
BUT:
-
to prevent grub.cfg to load the other config file again, we put that code into another if clause
-
when we select an item, grub sets the variable
chosen, so we can only load the config file if this variable has not been set yet -
and that's it!
TLDR:
grub.cfgtries to load a second config_file if the grub environmental variableconfig_fileis set- this config file shows us the main menu
- if we select "Singlebooter" it loads the grub.cfg again
- but now the "chosen" variable is set (because we have chosen an option)
- and if this variable is set, we prevent the grub.cfg to load mainmenu.cfg, and we see our normal boot options
-
the fun zone
-
I write unnesessarily long READMEs
-
you don't have to READ IT, but you did read (until) this line, so: Hello :D
-
Fun-fact: if you generate or copy your grub.cfg to /boot/grub/custom.cfg your grub will be stuck in an infinite loop! (Luckily I learned that in a VM)
-
I'm proud of this
-
USE THIS ON YOUR OWN RISK, if your grub is broken i take no responsibilty, better have that live boot stick ready