xref: /freebsd/stand/lua/drawer.lua.8 (revision beacffb30d89c29505f2303d91396e3603f54dd9)
1*beacffb3SKyle Evans.\"
2*beacffb3SKyle Evans.\" SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3*beacffb3SKyle Evans.\"
4*beacffb3SKyle Evans.\" Copyright (c) 2018 Kyle Evans <kevans@FreeBSD.org>
5*beacffb3SKyle Evans.\"
6*beacffb3SKyle Evans.\" Redistribution and use in source and binary forms, with or without
7*beacffb3SKyle Evans.\" modification, are permitted provided that the following conditions
8*beacffb3SKyle Evans.\" are met:
9*beacffb3SKyle Evans.\" 1. Redistributions of source code must retain the above copyright
10*beacffb3SKyle Evans.\"    notice, this list of conditions and the following disclaimer.
11*beacffb3SKyle Evans.\" 2. Redistributions in binary form must reproduce the above copyright
12*beacffb3SKyle Evans.\"    notice, this list of conditions and the following disclaimer in the
13*beacffb3SKyle Evans.\"    documentation and/or other materials provided with the distribution.
14*beacffb3SKyle Evans.\"
15*beacffb3SKyle Evans.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16*beacffb3SKyle Evans.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17*beacffb3SKyle Evans.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18*beacffb3SKyle Evans.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19*beacffb3SKyle Evans.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20*beacffb3SKyle Evans.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21*beacffb3SKyle Evans.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22*beacffb3SKyle Evans.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23*beacffb3SKyle Evans.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24*beacffb3SKyle Evans.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25*beacffb3SKyle Evans.\" SUCH DAMAGE.
26*beacffb3SKyle Evans.\"
27*beacffb3SKyle Evans.\" $FreeBSD$
28*beacffb3SKyle Evans.\"
29*beacffb3SKyle Evans.Dd August 19, 2018
30*beacffb3SKyle Evans.Dt DRAWER.LUA 8
31*beacffb3SKyle Evans.Os
32*beacffb3SKyle Evans.Sh NAME
33*beacffb3SKyle Evans.Nm drawer.lua
34*beacffb3SKyle Evans.Nd FreeBSD menu/screen drawer module
35*beacffb3SKyle Evans.Sh DESCRIPTION
36*beacffb3SKyle Evans.Nm
37*beacffb3SKyle Evanscontains functionality for drawing and manipulating the menu, logo, and brand
38*beacffb3SKyle Evansto the screen.
39*beacffb3SKyle Evans.Pp
40*beacffb3SKyle EvansBefore using the functionality provided by
41*beacffb3SKyle Evans.Nm ,
42*beacffb3SKyle Evansit must be included with a statement such as the following:
43*beacffb3SKyle Evans.Pp
44*beacffb3SKyle Evans.Dl local drawer = require("drawer")
45*beacffb3SKyle Evans.Ss BRAND DEFINITIONS
46*beacffb3SKyle EvansBrand definitions describe a
47*beacffb3SKyle Evans.Dq brand ,
48*beacffb3SKyle Evanstraditionally drawn above the menu.
49*beacffb3SKyle EvansThe exact position may be controlled by using the
50*beacffb3SKyle Evans.Xr loader.conf 5
51*beacffb3SKyle Evansvariables
52*beacffb3SKyle Evans.Va loader_brand_x
53*beacffb3SKyle Evansand
54*beacffb3SKyle Evans.Va loader_brand_y .
55*beacffb3SKyle EvansThe following keys may be defined for a brand definition:
56*beacffb3SKyle Evans.Bl -tag -width ".Ic Graphic" -offset indent
57*beacffb3SKyle Evans.It Ic graphic
58*beacffb3SKyle EvansA table of strings containing rows of text to be drawn to the screen.
59*beacffb3SKyle Evans.El
60*beacffb3SKyle Evans.Ss LOGO DEFINITIONS
61*beacffb3SKyle EvansLogo definitions describe a
62*beacffb3SKyle Evans.Dq logo ,
63*beacffb3SKyle Evanstraditionally to the right of the menu.
64*beacffb3SKyle EvansThe exact position may be controlled by using the
65*beacffb3SKyle Evans.Xr loader.conf 5
66*beacffb3SKyle Evansvariables
67*beacffb3SKyle Evans.Va loader_logo_x
68*beacffb3SKyle Evansand
69*beacffb3SKyle Evans.Va loader_logo_y .
70*beacffb3SKyle EvansThe following keys may be defined for a logo definition:
71*beacffb3SKyle Evans.Bl -tag -width ".Ic requires_color" -offset indent
72*beacffb3SKyle Evans.It Ic requires_color
73*beacffb3SKyle EvansA boolean describing whether or not this logo definition requires color.
74*beacffb3SKyle EvansIf it is chosen to be drawn and it requires color on a color-disabled boot,
75*beacffb3SKyle Evans.Nm
76*beacffb3SKyle Evanswill elect to use the default
77*beacffb3SKyle Evans.Dq orbbw
78*beacffb3SKyle Evanslogo rather than the chosen logo.
79*beacffb3SKyle Evans.It Ic graphic
80*beacffb3SKyle EvansA table of strings containing rows of text to be drawn to the screen.
81*beacffb3SKyle Evans.It Ic shift
82*beacffb3SKyle EvansA table describing the
83*beacffb3SKyle Evans.Va x
84*beacffb3SKyle Evansand
85*beacffb3SKyle Evans.Va y
86*beacffb3SKyle Evansshift that should be applied to all elements should this logo be selected.
87*beacffb3SKyle EvansThis is typically used for shifting the menu and brand if an empty or minimal
88*beacffb3SKyle Evanslogo are selected.
89*beacffb3SKyle Evans.El
90*beacffb3SKyle Evans.Ss CUSTOM BRANDS AND LOGOS
91*beacffb3SKyle EvansThe brand and logo system is designed to allow brands and logos to be easily
92*beacffb3SKyle Evansplugged in.
93*beacffb3SKyle EvansWhen an unrecognized
94*beacffb3SKyle Evans.Ev loader_brand
95*beacffb3SKyle Evansor
96*beacffb3SKyle Evans.Ev loader_logo
97*beacffb3SKyle Evansare encountered,
98*beacffb3SKyle Evans.Nm
99*beacffb3SKyle Evanswill attempt to include
100*beacffb3SKyle Evans.Pa brand-${loader_brand}.lua
101*beacffb3SKyle Evansor
102*beacffb3SKyle Evans.Pa logo-${loader_logo}.lua
103*beacffb3SKyle Evansrespectively.
104*beacffb3SKyle EvansThese files are expected to call either
105*beacffb3SKyle Evans.Fn drawer.addBrand
106*beacffb3SKyle Evansor
107*beacffb3SKyle Evans.Fn drawer.addLogo
108*beacffb3SKyle Evansto add the requested branddef or logodef.
109*beacffb3SKyle Evans.Nm
110*beacffb3SKyle Evanswill attempt to do another lookup for the requested brand or logo before falling
111*beacffb3SKyle Evansback to one of the following:
112*beacffb3SKyle Evans.Bl -tag -width ".Ic drawer.default_color_logodef" -offset indent
113*beacffb3SKyle Evans.It Ic drawer.default_brand
114*beacffb3SKyle EvansThe default brand to be used if the requested brand cannot be located.
115*beacffb3SKyle Evans.It Ic drawer.default_color_logodef
116*beacffb3SKyle EvansThe default logodef to be used if an invalid logodef is requested and
117*beacffb3SKyle Evans.Xr loader 8
118*beacffb3SKyle Evanshas been configured to allow output of color.
119*beacffb3SKyle Evans.It Ic drawer.default_bw_logodef
120*beacffb3SKyle EvansThe default logodef to be used if either an invalid logodef has been requested,
121*beacffb3SKyle Evansor a logodef has been requested that requires color and
122*beacffb3SKyle Evans.Xr loader 8
123*beacffb3SKyle Evanshas been configured to not output color.
124*beacffb3SKyle Evans.El
125*beacffb3SKyle Evans.Ss FRAME STYLES
126*beacffb3SKyle Evans.Nm
127*beacffb3SKyle Evanscontains the definitions for the different frame styles that may be drawn around
128*beacffb3SKyle Evansthe menu.
129*beacffb3SKyle EvansFrame styles define the characters drawn for horizontal lines, vertical aligns,
130*beacffb3SKyle Evansand each of the four corner styles.
131*beacffb3SKyle EvansThe following keys may be defined for a frame style:
132*beacffb3SKyle Evans.Bl -bullet -width ""
133*beacffb3SKyle Evans.It
134*beacffb3SKyle Evanshorizontal
135*beacffb3SKyle Evans.It
136*beacffb3SKyle Evansvertical
137*beacffb3SKyle Evans.It
138*beacffb3SKyle Evanstop_left
139*beacffb3SKyle Evans.It
140*beacffb3SKyle Evansbottom_left
141*beacffb3SKyle Evans.It
142*beacffb3SKyle Evanstop_right
143*beacffb3SKyle Evans.It
144*beacffb3SKyle Evansbottom_right
145*beacffb3SKyle Evans.El
146*beacffb3SKyle EvansFrame styles are currently defined in the table
147*beacffb3SKyle Evans.Ic drawer.frame_styles
148*beacffb3SKyle Evansindexed by the name used for
149*beacffb3SKyle Evans.Ev loader_menu_frame .
150*beacffb3SKyle EvansNo API currently exists for manipulating this table indirectly.
151*beacffb3SKyle Evans.Ss Exported functions
152*beacffb3SKyle EvansThe following functions are exported from
153*beacffb3SKyle Evans.Nm :
154*beacffb3SKyle Evans.Bl -tag -width hook.registerType -offset indent
155*beacffb3SKyle Evans.It Fn drawer.addBrand name def
156*beacffb3SKyle EvansAdd the brand definition described by
157*beacffb3SKyle Evans.Fa def
158*beacffb3SKyle Evansto the table of known brand definitions, indexed by
159*beacffb3SKyle Evans.Fa name .
160*beacffb3SKyle Evans.It Fn drawer.addLogo name def
161*beacffb3SKyle EvansAdd the logo definition described by
162*beacffb3SKyle Evans.Fa def
163*beacffb3SKyle Evansto the table of known logo definitions, indexed by
164*beacffb3SKyle Evans.Fa name .
165*beacffb3SKyle Evans.It Fn drawer.drawscreen menudef
166*beacffb3SKyle EvansDraws the logo, brand, menu frame, and the current menu as described in
167*beacffb3SKyle Evans.Fa menudef ,
168*beacffb3SKyle Evansformatted as defined by
169*beacffb3SKyle Evans.Xr menu.lua 8 .
170*beacffb3SKyle Evans.El
171*beacffb3SKyle Evans.Sh SEE ALSO
172*beacffb3SKyle Evans.Xr menu.lua 8
173*beacffb3SKyle Evans.Sh AUTHORS
174*beacffb3SKyle EvansThe
175*beacffb3SKyle Evans.Nm
176*beacffb3SKyle Evansfile was originally written by
177*beacffb3SKyle Evans.An Pedro Souza Aq Mt pedrosouza@FreeBSD.org .
178*beacffb3SKyle EvansLater work and this manual page was done by
179*beacffb3SKyle Evans.An Kyle Evans Aq Mt kevans@FreeBSD.org .
180