Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1Mn2zQ-0002dV-BL for mharc-grub-devel@gnu.org; Mon, 14 Sep 2009 00:16:32 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Mn2zO-0002c8-Cl for grub-devel@gnu.org; Mon, 14 Sep 2009 00:16:30 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Mn2zK-0002Yv-TV for grub-devel@gnu.org; Mon, 14 Sep 2009 00:16:30 -0400 Received: from [199.232.76.173] (port=46928 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mn2zK-0002Yn-KV for grub-devel@gnu.org; Mon, 14 Sep 2009 00:16:26 -0400 Received: from mail-pz0-f175.google.com ([209.85.222.175]:64316) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Mn2zK-0006dA-65 for grub-devel@gnu.org; Mon, 14 Sep 2009 00:16:26 -0400 Received: by pzk5 with SMTP id 5so2511073pzk.6 for ; Sun, 13 Sep 2009 21:16:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=yPb+bnkQ+u8SV1I3WEm6w31DnRTQh0qyGcfhO+fwDwk=; b=YcK7Bl20cfQI1xqk7kzvuAbWqD4oZ9xm1bEZ4jZ7k0QF6fg2gODKWfVZoLmnzoi9RW hD/RkX+mX8e34i9ie1DMV97xNa6XEkrq+19j0v4TUxL9XyCO5yQWWhUc/5UnR0qcAa78 uqrn8aZcBb96KMNbv0YRn5V5xxcR7fBHVqGeo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=mVSNSbh+0SCpo7fryyWGaJ07KxXDJe/SAg2/KD9QDJdRJdbYXFeIL39cTj2lXYnD7b hrdLLBc+tn/JwC5JrZGC1plL8D1cWqOWHLQuGH2HH7G0FEzz77cWLlz1U/AJrXJnCGaU 3MhPTMLBlU0ORjCEISIYv35v/YfugkaAsMIVU= MIME-Version: 1.0 Received: by 10.140.174.8 with SMTP id w8mr858457rve.133.1252901784127; Sun, 13 Sep 2009 21:16:24 -0700 (PDT) In-Reply-To: References: Date: Mon, 14 Sep 2009 12:16:24 +0800 Message-ID: From: Bean To: The development of GRUB 2 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) Subject: Re: [GITGRUB] New menu interface (second draft) X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Sep 2009 04:16:30 -0000 On Sun, Sep 13, 2009 at 7:26 PM, Michal Suchanek wrot= e: > Hello > > I hope this long discussion has not put you off. > > I personally would probably go with leaving gfxterm in place until a > better menu is really needed but having a nice customizable menu is > nice and will surely attract more potential grub users. > > I want the new menu system to be as simple and extensible as possible > for several reasons. > > First people would probably want to write themes for the menu to > change its look in new and unexpected ways. It has been the case with > both grub legacy and syslinux and hopefully by creatind a menu system > flexible enough we could prevent a grub2-with-fancy-graphics fork. > > Second if we introduce some features and menu system components now it > will be hard to remove them later so I want to have as few components > as necessary initially and only add new ones if/when there are useful > features not covered by the initial components. > > Lastly I will be likely also dealing with the new menu when it gets > into mainline grub so I would like it to be somewhat reasonable. > > The problem I see now is that some selector for styling need to be design= ed. > > This should help both people styling the menu and creating distinct > components from the basic ones in the standard menu. > > The two systems that I know that have some decent selectors are > > =A0- X resources > > =A0This system has the deficiency that AFAIK each object can have at > most one class. Properties themselves are nodes in the class tree. > Parts if the path in the tree can be omitted. > =A0Given something like XTerm.vt100.foreground =A0properties that apply > include this full path, XTerm..foreground (name of one component > omitted) ..foreground (names of two components omitted), *foreground > (applies to any foreground), XTerm*foreground (would also apply to, > say XTerm.foreground) > > =A0- CSS selectors > > =A0These selectors can select by component type, component class, other > attributes, states (like hover, focused, etc), etc. > =A0Another interesting thing that you can do is styling :first-child. > =A0However, this is very limited in utility without generalizing to > arbitrary n-th child element and possibly odd/even/modN elements. > =A0The limitation of these selector is that you can only omit part of > path from the start > =A0.XTerm .vt100 { foreground =3D } would refer to that > particular property as could probably something like > =A0.v100 {} > =A0window vt100 {} > =A0I am not sure something like > =A0.XTerm * {} > =A0would be valid in CSS > > I would think that an option that combines the best of both is > something like X resource selectors with qualifiers that select class > or type or specify nth element. > > For example > > + panel { > =A0class =3D main_menu > =A0+ label { > =A0 class =3D main,title # multiple classes > =A0 text =3D GRUB $version > =A0} > =A0+ panel { > =A0 class =3D boot_menu,menu > =A0 + label { > =A0 .... > =A0} > } > > style main_menu*boot_menu.~label { > =A0text-align: left; > =A0icon-position: left; > =A0background-color: blue; > =A0color: yellow; > } > > style main_menu*boot_menu.~label:focused { > =A0background-color: yellow; > =A0color: blue; > } > > # style the default item differently given default is the number of > the default item > style main_menu*boot_menu.~label[default] { > =A0color: red; > } > > you could probably use > > style main_menu*boot_menu. { > style main_menu*boot_menu.:focused { > style main_menu*boot_menu.[default] { > > but not having any element specification at the end of the selector > would make it hard to read. > > This should allow styling all element reasonably. > > The remaining question is how the styles should be resolved in case > multiple selectors would apply to single element. > > One simple way is to just process everything in order - that is set > the property at the time the element definition or style definitin is > read from the file. > > This has the disadvantage that elements singled out earlier would be > overwritten by a later blanket style covering everything. The > advantage is that completely restyling some aspect of the menu is easy > - you specify a single style that resets all colours and build your > colouring on top of that. > In CSS this is somewhat problematic. The styles with more specific > selectors override styles with less specific selectors - overriding > earlier specific styles requires the !mportant keyword and there are > only two levels, overriding !important is not possible without > duplicating all declarations of the previous styles. > > It seems that this is not a problem in X properties, though. This is > probably because unlike HTML+CSS X resources tend to have very few > generic defaults + some very application specific definitions that do > not apply elsewhere so people restyling their desktop only need to set > the properties they would need anyway if they started from scratch. > > Given that in Grub we would probably want some initial style it is > probably better choice to override earlier styles with later styles > regardless of specificity. This would probably require walking the > component tree and (re-) set all components when styles are changed > but would not require storing styles separately outside of component > properties. > > The most specific style approach probably works better with a separate > style store where each component looks for its style when it redraws > and finds the style with most specific selector for each property > (which can then be cached in its property values until styles change > for the next time). > > Another somewhat peculiar issue are the elements that are not part of > user layout. These would be: > > enter password box (the thing you would get by trying to run > password-protected action) > edit action box (the thing you get currently in boot menu by pressing e) > edit environment value box (would be useful to set a specific > environment variable without having to start console) > > These would be toplelevel (fullscreen windows) created by a grub > command, not defined in the configuration file. > Perhaps their class property could be copied from the label that > executed them so that they can be styled specifically. > > ie > > + label { > =A0text =3D Change graphics mode > =A0class =3D set_gfxmode > =A0action { > =A0edit-env gfxmode > =A0terminal_output gfxterm > =A0} > } > > would create an "edit environment variable" toplevel with class set_gfxmo= de Hi, Thanks a lot for your advice, most of them looks good, although some details may need adjustment. About edit boxes, I'd prefer to use a command like popup to open a new window, perhaps something like: popup "+ term { class=3Dgfxterm }" Then we can bind it to specific keys using onkey event: +onkey { key =3D "e" command =3D "popup \"+ edit { class=3Dedit_box text=3D\\\"$CURITEM\\\" }\= "" } + onkey { key =3D "c" command =3D "popup \"+ term { class=3Dterm_box }\"" } --=20 Bean gitgrub home: http://github.com/grub/grub/ my fork page: http://github.com/bean123/grub/