A simple Python script to manage and apply GRUB themes on Linux systems. This tool allows you to easily switch between installed GRUB themes with an interactive command-line interface.
- 🎨 Interactive theme selection menu
- 🔒 Automatic backup of GRUB configuration
- ✅ Safe theme application with error handling
- 🛡️ Superuser privilege checking
- 📁 Automatic GRUB configuration regeneration
- Linux system with GRUB bootloader
- Python 3.x
- Superuser (root) privileges
- GRUB themes installed in
/boot/grub/themes/
- Clone this repository or download the script:
git clone https://github.com/Darkeox34/grubthemechanger.git
cd grub-theme-manager- Make the script executable:
chmod +x grub_theme_manager.pyRun the script with superuser privileges:
sudo python3 grub_theme_manager.pyThe script will:
- Check for superuser privileges
- Display all available themes in
/boot/grub/themes/ - Allow you to select a theme interactively
- Create a backup of your current GRUB configuration
- Apply the selected theme
- Regenerate the GRUB configuration
Available themes:
(1) breeze
(2) ubuntu-mate
(3) stylish
Please select the theme you want to use:
2
You have selected the theme ubuntu-mate, do you want to apply this theme? (y/n)
y
Creating a backup copy of grub config!
Backup directory created at /path/to/script/backup
Backup of grub config created at /path/to/script/backup/grub
Theme ubuntu-mate applied successfully!
grub-mkconfig executed successfully!
The script expects GRUB themes to be installed in the following structure:
/boot/grub/themes/
├── theme1/
│ └── theme.txt
├── theme2/
│ └── theme.txt
└── theme3/
└── theme.txt
Before making any changes, the script automatically creates a backup of your GRUB configuration:
- Backup location:
./backup/grub(relative to script location) - The backup directory is created automatically if it doesn't exist
- Backup: Creates a safety backup of
/etc/default/grub - Modify: Updates the
GRUB_THEMEline in the configuration - Apply: Runs
grub-mkconfigto regenerate the GRUB configuration file
- Privilege Check: Ensures the script is run with sudo
- File Validation: Verifies theme files exist before applying
- Backup Creation: Automatically backs up configuration before changes
- Error Handling: Comprehensive error checking and user feedback
- Input Validation: Validates user input for theme selection
"This script requires superuser privileges"
- Solution: Run the script with
sudo
"Path /boot/grub/themes/ doesn't exist"
- Solution: Install GRUB themes first, or check if GRUB is properly installed
"theme.txt does not exist"
- Solution: Ensure the selected theme has a proper
theme.txtfile
"Error executing grub-mkconfig"
- Solution: Check if GRUB is properly configured and you have write permissions
If something goes wrong, you can restore your original GRUB configuration:
sudo cp ./backup/grub /etc/default/grub
sudo grub-mkconfig -o /boot/grub/grub.cfgTo install new GRUB themes:
- Download a GRUB theme
- Extract it to
/boot/grub/themes/ - Ensure it contains a
theme.txtfile - Run this script to apply it
Example:
sudo mkdir -p /boot/grub/themes/mytheme
sudo cp -r downloaded-theme/* /boot/grub/themes/mytheme/
sudo python3 grub_theme_manager.pyThis script has been tested on:
- Ubuntu and derivatives
- Debian
- Fedora
- Arch Linux
- Most Linux distributions using GRUB2
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
This project is released under the MIT License. See LICENSE file for details.
This script modifies system bootloader configuration. While it includes safety features and backup mechanisms, use it at your own risk. Always ensure you have a way to recover your system (live USB, etc.) before making bootloader changes.
If you encounter issues:
- Check the troubleshooting section
- Ensure you have proper backups
- Open an issue on GitHub with error details and system information
Note: Always test GRUB themes in a safe environment before applying them to production systems.