mateosss / matter

Customizable GRUB theme inspired by Material Design
Boost Software License 1.0
873 stars 51 forks source link

Partial solution to Matter temporarily breaking on kernel upgrade. #47

Closed mateosss closed 3 years ago

mateosss commented 4 years ago

When upgrading a kernel in ubuntu, apt keeps the old version of the kernel until you do a sudo apt autoremove. In this way the amount of entries in your grub increases but Matter set itself to apply the same number of icons as grub entries the user had on installation.

In particular the command (the hook) that patches grub.cfg is written at the end of /usr/sbin/grub-mkconfig with exactly the same icons the user originally specified. But if the number of entries varies, this command will just not do anything and return a warning for the user.

It would be nice to have some way of avoiding these situations in which the user stops having icons until he does a sudo apt autoremove (or equivalent in other distros). The optimal approach would be to pair the icons the user specifies to particular entries, such that when the number of entries varies Matter can recognize which entries had which icons.

For now, however, it would be enough to add a flag to the script called --relax-icons/-ri which when set, will relax the --icons/-i inputs to:

This will at least show some icons on these situations, but most likely some of them will be in the wrong places.

heyzec commented 3 years ago

Since matter.py needs some way to know what were the original entries and their corresponding icons, I was thinking of having a icons_config.json file that the script will save to. Would you think that is okay? Here's a sample of how that file will look like:

[["ubuntu", "menuentry \"Ubuntu 20.04\" --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-f10fd0 ae-591d-4bdb-80c1-fd0328cef41e' {"], ["microsoft-windows", "menuentry \"Windows 10\" --class windows --class os $menuentry_id_option 'osprober-e fi-DC43-84C9' {"], ["folder", "submenu \"Advanced options for Ubuntu\"{"], ...]]

mateosss commented 3 years ago

I like the idea of having a config file inside the install directory. I would prefer the file to be called config.json and contain a single JSON object with an icons entry { "icons": [...] } that way the config file could be reused for other things in the future.

So go ahead with it if you were planning on that. In general, I like to accept any contribution that enhances the project and later when I have time, improve it if it is needed. So any contributions are welcome!