credential

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 25, 2026 License: MIT Imports: 14 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func Background

func Background(img image.Image, color render.Color) widget.Widget

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

func Blur(src image.Image, sigma float64) *image.RGBA

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 HexFill

func HexFill(c config.HexColor) render.Color

HexFill converts a config color to a premultiplied fill.

func LoadImage

func LoadImage(path string, blur uint32) (image.Image, error)

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.

func Scrim

func Scrim() *widget.Box

Scrim is the blank-screen blackout (.lock-scrim), hidden until the blank timer shows it.

func Window

func Window(sheet *widget.Stylesheet, layers ...widget.Widget) widget.Widget

Window is a lock or greeter surface's root (the GTK window node the .lock-window rules select), styled by sheet, holding the layers bottom to top.

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

func Build(o Options, onSubmit func(string)) *Prompt

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

func (p *Prompt) SetMessage(text string)

SetMessage shows text on the error line, or hides it when empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL