grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Random selections and changing splash screen


From: Colin D Bennett
Subject: Re: Random selections and changing splash screen
Date: Wed, 28 Jan 2009 07:09:05 -0800

On Wed, 28 Jan 2009 13:01:52 +0000
Antóin Óg Ó Cuinneagáin <address@hidden> wrote:

> Hi my name is Anthony Cunningham and I have recently joined this list.
> 
> I'd had some ideas for features for Grub and the wiki mentions putting
> them on this list in case they exist, or others may be working on
> something similar.
> 
> One idea is that after the timeout a random entry is chosen from the
> boot menu, instead of default.  The use case I had in mind would be
> where multiple distributions are installed and the user would let a
> random one boot as an incentive to learn to work with that
> distributions package manager, destop environment etc.
> the entry could be like :
> random  //any random entry
> random (4,5,8)  //random of 4, 5 or 8
> random not (3,5,9) //random , except these..for not choosing windows
> or rescue partitions etc.

Hi Anthony,

That's an interesting idea.  It wouldn't be too hard to implement, I'm
sure.  Another implementation that might be cleaner than specifying the
indices of the items to select from would be to use the 'class'
attribute of menu items which has recently been added.

The 'class' attribute works similarly to the way the HTML/CSS class
attribute functions:  Each menu entry has a set of zero or more classes
(which are simply character strings) which characterize the entry.  The
reason I added the 'class' attribute initially was to support showing
an icon for each menu entry, where the most appropriate icon is chosen
(i.e., if 'Ubuntu Linux 8.10' is an entry with classes { 'ubuntu',
'linux', 'os' }, then an icon called 'ubuntu.png' is first looked for,
then if that is not found, 'linux.png' is searched for, etc.).

We could use the 'class' attribute to identify which items you want to
randomly select from.  For instance, suppose you want to choose a
random entry from all the free operating systems installed.  Then you
could add a class 'free-os' to the classes for each Linux, BSD, and
other free OS menu entry.  The 'random boot' command could then be
specified as:
  random   // Any random entry
  random --class=free-os    // Any free operating system
  random --class=linux --exclude-class=rescue
  // ^ Any Linux distribution, but not rescue entries.

I really try to avoid using indices to refer to entries in the grub.cfg
since that makes it brittle to change (if you add/move/delete an entry,
some of your index references may need to be changed, and it's up to
you to figure out which ones).

> Also another feature I thought of (when may exist) is a per entry
> splashscreen setting, and moving up and down with the arrow keys would
> change the background splashscreen.
> I think this would be a nice feature to show OS specific splashscreens
> Windows, Red Hat, FreeBSD etc.
> 
> Anthony

By the 'splashscreen', do you mean the background image behind the GRUB
menu?  So, as you press the arrow keys up and down on the GRUB menu to
select an entry to boot, the background image is changing depending on
the highlighted menu entry?

This is definitely possible, and it could be done on a theme-by-theme
basis (this would be, IMO, a great place to use Lua scripting in
the theme[1]). If the background-switching feature really seems useful,
I can take a look at adding it to my gfxmenu branch sometime, which is
in the final stages of preparation for merging into mainline GRUB.

Regards,
Colin

[1] Lua support is *not* currently planned for inclusion into GRUB, but
    I did do a very successful 'spike' experiment which allows themes to
    include Lua code that can use the GRUB graphics API.  I'd still
    like to continue down the path of adding Lua support at some point,
    because I think the value is high and the effort required is low.

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]