Always back up before changing themes:
sudo cp /etc/default/grub /etc/default/grub.bak
sudo cp -r /boot/grub /boot/grub.bak
/etc/default/grub:
# If you change this file or any /etc/default/grub.d/*.cfg file,
# run 'update-grub' afterwards to update /boot/grub/grub.cfg.
# For full documentation of the options in these files, see:
# info -f grub -n 'Simple configuration'
GRUB_DEFAULT=0
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR=`( . /etc/os-release; echo ${NAME:-Kali} ) 2>/dev/null || echo Kali`
GRUB_CMDLINE_LINUX_DEFAULT="quiet"
GRUB_CMDLINE_LINUX=""
# If your computer has multiple operating systems installed, then you
# probably want to run os-prober. However, if your computer is a host
# for guest OSes installed via LVM or raw disk devices, running
# os-prober can cause damage to those guest OSes as it mounts
# filesystems to look for things.
GRUB_DISABLE_OS_PROBER=false
# Uncomment to enable BadRAM filtering, modify to suit your needs
# This works with Linux (no patch required) and with any kernel that obtains
# the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)
#GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"
# Uncomment to disable graphical terminal
#GRUB_TERMINAL=console
# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE/GOP/UGA
# you can see them in real GRUB with the command `videoinfo'
#GRUB_GFXMODE=640x480
# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
#GRUB_DISABLE_LINUX_UUID=true
# Uncomment to disable generation of recovery mode menu entries
#GRUB_DISABLE_RECOVERY="true"
# Uncomment to get a beep at grub start
#GRUB_INIT_TUNE="480 440 1"
/etc/default/grub.d/kali-themes.cfg:
# Try to force a 16x9 mode first, then 16x10, then default
GRUB_GFXMODE="1280x720,1280x800,auto"
GRUB_THEME="/boot/grub/themes/kali/theme.txt"
# Add splash option to enable plymouth
if ! echo "$GRUB_CMDLINE_LINUX_DEFAULT" | grep -q splash; then
GRUB_CMDLINE_LINUX_DEFAULT="$GRUB_CMDLINE_LINUX_DEFAULT splash"
fi
⚡ Important notes:
-
You should not edit
/boot/grub/grub.cfgmanually (it’s auto-generated). -
Instead, changes go into
/etc/default/grubor scripts under/etc/grub.d/. -
Themes live in
/boot/grub/themes/. -
Don't touch or edit dirs or files inside
/boot/directory.
git clone https://github.com/Patato777/dotfiles.git
cd dotfiles
Run script present in /dotfiles/grub/install_script_grub.sh
#!/bin/bash
##############################################################################
# Virtuaverse GRUB Theme Installation Script
#
# Description:
# This script installs the Virtuaverse GRUB theme.
#
# Authors:
# Federico Slongo
# Pewrie Bontal
#
# Copyright 2022-2024 the original author or authors
##############################################################################
CYAN='\033[0;36m'
RED='\033[0;31m'
GREEN='\033[0;32m'
ORANGE='\033[0;33m'
NC='\033[0m'
#################################################
#@# Check correct grub directory to install
check_grub_ver() {
if [ -x "$(command -v grub2-mkconfig)" ] && [ -d "/boot/grub2" ]; then
if [ -x "$(command -v grub-mkconfig)" ] && [ -d "/boot/grub" ]; then
printf "${RED}[ERR]\tBoth Grub2 and Grub detected. IDK what to do\n"
exit 1
else
GRUB_DIR="/boot/grub2"
printf "${CYAN}[MSG]\tGrub2 detected. Using directory: $GRUB_DIR\n"
fi
elif [ -x "$(command -v grub-mkconfig)" ] && [ -d "/boot/grub" ]; then
GRUB_DIR="/boot/grub"
printf "${CYAN}[MSG]\tGrub detected. Using directory: $GRUB_DIR\n${NC}"
else
printf "${RED}[ERR]\tNo grub directory found! wtf?\n${NC}"
printf "${RED}[ERR]\tExiting...\n${NC}"
exit 1
fi
printf "[MSG]\tUsing grub directory: $GRUB_DIR\n"
}
#################################################
# only run in case no themes directory found
# some distros have themes directory by default
make_themes_dir() {
if [ ! -d $GRUB_DIR/themes ]; then
printf "${CYAN}[MSG]\tThemes directory not found, creating...\n"
mkdir $GRUB_DIR/themes
fi
}
#################################################
#@# Copy themes to grub directory
copy_theme() {
if [ -d $GRUB_DIR/themes/virtuaverse ]; then
printf "${ORANGE}[WRN]\tFound existing virtuaverse theme at $GRUB_DIR/themes/virtuaverse, reinstalling...\n"
rm -rf $GRUB_DIR/themes/virtuaverse
cp ./themes/virtuaverse $GRUB_DIR/themes -r
elif [ ! -d $GRUB_DIR/themes/virtuaverse ]; then
printf "${CYAN}[MSG]\tCopying virtuaverse theme... into $GRUB_DIR/themes\n"
cp ./themes/virtuaverse $GRUB_DIR/themes -r
fi
}
#################################################
#@# Check if virtuaverse theme is installed correctly
verify_installation() {
source_theme_dir="./themes/virtuaverse"
target_theme_dir="$GRUB_DIR/themes/virtuaverse"
install_success=1
cd "$source_theme_dir"
printf "${BLUE}[MSG]\tVERIFYING INSTALLATION...\n"
sleep 1 # just to make it look like we're cooking
while read item; do
if [ ! -e "$target_theme_dir/$item" ]; then
install_success=0
printf "\n"
printf "${RED}[ERR]\tTheme was not installed correctly!\n"
printf "${RED}[ERR]\tMissing: $item\n"
exit 1
fi
done < <(find . -type f -o -type d)
if [ $install_success == 1 ]; then
printf "${GREEN}[OK]\tTheme installed successfully!\n"
fi
cd - >/dev/null
}
#################################################
#@# Backup grub file
back_up_grub_file() {
GRUB_FILE="/etc/default/grub"
GRUB_ORIGINAL="/etc/default/grub.original" ## this one is og grub file in case all fucked up
GRUB_BAK="/etc/default/grub.bak"
if [ ! -f $GRUB_ORIGINAL ]; then
cp $GRUB_FILE $GRUB_ORIGINAL
printf "${CYAN}[MSG]\tthe og grub file can be found at $GRUB_ORIGINAL\n"
fi
cp $GRUB_FILE $GRUB_BAK
}
#################################################
#@# Set virtuaverse theme
set_theme() {
THEME_TXT=$GRUB_DIR/themes/virtuaverse/theme.txt
# Check if GRUB_THEME exists in the file
# if found, replace the value
# if not, add to end of line
if grep -q "^GRUB_THEME=" "$GRUB_FILE"; then
sed -i "s|^GRUB_THEME=.*|GRUB_THEME=\"$THEME_TXT\"|" "$GRUB_FILE"
else
echo "GRUB_THEME=\"$THEME_TXT\"" >>"$GRUB_FILE"
fi
#################################################
## Show the changes made
diff $GRUB_FILE $GRUB_BAK
sleep 2
printf "${NC}\n"
}
#################################################
#@# Update grub
# Some Disto doesnt have update-grub already
update_grub() {
if [ ! -x "$(command -v update-grub)" ]; then
if [ -x "$(command -v grub2-mkconfig)" ]; then
set -e
exec grub2-mkconfig -o $GRUB_DIR/grub.cfg
elif [ -x "$(command -v grub-mkconfig)" ]; then
set -e
exec grub-mkconfig -o $GRUB_DIR/grub.cfg
fi
elif [ -x "$(command -v update-grub)" ]; then
update-grub
else
printf "${RED}[ERR]\tUnable to update GRUB configuration. Please update it manually.\n"
fi
}
ascii_art() {
echo""
echo " █ █ "
echo " █ █ "
echo " ██ ██ █ ███████████ █ █ █ ████ █████ ██ ███ "
echo " ██ █████ ██ ██ ██ ██ █████ ███ ███ █████████ ███ "
echo " ███ ██ ████ ████ ██ ████ ██ ██ █████ ████ ███████ "
echo " ████ █ ██ █ ███████ ██ ███ ██ █ ██ █ ██ █ "
echo " █ █ █ ██ ███ █ ████ ███████ ██ ██ ████ "
echo " █ █ Virtuaverse GRUB Theme Installer █ "
echo""
}
#################################################
# Display help information
show_help() {
echo "Usage: $0 [OPTIONS]"
ascii_art
echo "To install the Virtuaverse GRUB theme"
echo "run sudo $0"
echo ""
echo "Options:"
echo " --help Display this help message and exit"
}
#@# Main function
main() {
ascii_art
check_grub_ver
make_themes_dir
copy_theme
verify_installation
back_up_grub_file
set_theme
update_grub
}
init() {
#################################################
#@# Check for --help flag
for arg in "$@"; do
if [ "$arg" == "--help" ]; then
show_help
exit 0
fi
done
#################################################
#@# Check if running as root
if [ "$EUID" -ne 0 ]; then
printf "${RED}[ERR]\tPlease run as root \n"
exit 1
fi
main "${@}"
}
init "${@}"
Open it:
sudo nano /etc/default/grub.d/kali-themes.cfg
Look for :
GRUB_THEME="/boot/grub/themes/kali/theme.txt"
Change it to:
GRUB_THEME="/boot/grub/themes/virtuaverse/theme.txt"
/etc/default/grub.d/kali-themes.cfg
# Try to force a 16x9 mode first, then 16x10, then default
GRUB_GFXMODE="1280x720,1280x800,auto"
GRUB_THEME="/boot/grub/themes/virtuaverse/theme.txt"
# Add splash option to enable plymouth
if ! echo "$GRUB_CMDLINE_LINUX_DEFAULT" | grep -q splash; then
GRUB_CMDLINE_LINUX_DEFAULT="$GRUB_CMDLINE_LINUX_DEFAULT splash"
fi