Documentation
¶
Overview ¶
Package credential is the credential prompt the lock screen and the greeter share (wayle-widgets' credential_box.rs): clock, date, an optional username entry, the secret entry, and the error line in the centered .lock-center card. Both screens build it the same way and style it with the same lock.css rules, so they render identically.
Index ¶
- func Background(img image.Image, color render.Color) widget.Widget
- func Blur(src image.Image, sigma float64) *image.RGBA
- func HexFill(c config.HexColor) render.Color
- func LoadImage(path string, blur uint32) (image.Image, error)
- func Scrim() *widget.Box
- func Window(sheet *widget.Stylesheet, layers ...widget.Widget) widget.Widget
- type Options
- type Prompt
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Background ¶
Background builds the surface background (build_background): the decoded image scaled to cover under the .lock-bg-scrim legibility layer, or the configured color painted by a .lock-bg area when there is no image.
func Blur ¶
Blur approximates a gaussian of standard deviation sigma (the image crate's blur) with three box passes per axis, the classic linear-time approximation.
func LoadImage ¶
LoadImage decodes a background file and applies a gaussian blur of the given radius (0 is none) - the lock screen's load_texture. The decoders cover PNG, JPEG, GIF, WebP, BMP, and TIFF.
Types ¶
type Options ¶
type Options struct {
// Font is the face the labels and entries shape with; the
// stylesheet sets their sizes and weights.
Font render.Font
// ShowClock shows the clock and date.
ShowClock bool
// WithUsername adds a visible username entry above the secret one
// (the greeter; the lock screen authenticates the session user).
WithUsername bool
// Header goes between the date and the entries (the greeter's user
// list); Extra between the secret entry and the error line (the
// greeter's session picker). Either may be nil.
Header, Extra widget.Widget
// Focus moves keyboard focus; the username entry's Enter uses it
// to move on to the secret entry.
Focus func(widget.Widget)
}
Options configure one prompt.
type Prompt ¶
type Prompt struct {
// Reveal is the root: the centered card's reveal animation, hidden
// until the screen shows it (CredentialBox::reveal).
Reveal *widget.Revealer
// Username is the visible username entry; nil without
// WithUsername.
Username *widget.Entry
// Entry is the secret entry; Enter submits it.
Entry *widget.Entry
// Clock and Date are hidden without ShowClock.
Clock, Date *widget.Label
// Error is the error and info line, hidden until it has text.
Error *widget.Label
// contains filtered or unexported fields
}
Prompt is a built credential prompt and the handles its screen drives.
func Build ¶
Build assembles a prompt (CredentialBox::build); onSubmit fires with the secret entry's text each time the user presses Enter in it.
func (*Prompt) SetMessage ¶
SetMessage shows text on the error line, or hides it when empty.