Documentation
¶
Overview ¶
Package greeter is `lys-login greet`: the login screen in its greeter mode, as a greetd greeter. It runs as the single client of a kiosk compositor (cage) that greetd spawns, drives the login over the greetd IPC socket, and exits when greetd starts the chosen session.
Index ¶
- Constants
- Variables
- func AccessibilityPath(statePath string) string
- func ApplyCacheDir(statePath string) error
- func ApplyCursor(c Cursor)
- func CustomSessionName() string
- func LastLayoutPath(statePath, user string) (string, bool)
- func LastUserPath(statePath string) string
- func LoadLast(path string) string
- func LoadLayouts(statePath string) map[string]string
- func Run(init Init) error
- func SaveLast(path, value string) error
- func SortSessions(sessions []Session)
- func Stylesheet(cfg *config.Config) *widget.Stylesheet
- type A11yOption
- type Accessibility
- type Cursor
- type Defaults
- type Init
- type Options
- type Session
- type SessionKind
- type UsageError
- type User
Constants ¶
const ( LargeTextScale = 1.5 SlowKeysDelay = 300 * time.Millisecond )
const SystemStatePath = "/var/lib/" + stateApp + "/" + lastSessionFile
SystemStatePath is the state file of the greeter the display manager runs: under the directory every package gives the greeter's account.
Variables ¶
var ErrNoSessions = errors.New("no sessions to log into")
Functions ¶
func AccessibilityPath ¶
func ApplyCacheDir ¶
ApplyCacheDir keeps the greeter's caches beside its state, the one place its user can write on every setup: greetd's greeter account often has an unwritable home such as /var/empty, and the system font scan fails without a cache directory.
func ApplyCursor ¶
func ApplyCursor(c Cursor)
ApplyCursor exports the resolved cursor for lys-ui's theme loader.
func CustomSessionName ¶
func CustomSessionName() string
CustomSessionName labels the explicit `-- <argv>` session.
func LastLayoutPath ¶
func LastUserPath ¶
LastUserPath is the last-user file beside the session state file.
func LoadLayouts ¶
func Run ¶
Run shows the greeter until greetd starts a session (or the window closes): one fullscreen window on the kiosk compositor.
func SaveLast ¶
SaveLast persists a remembered value, creating its directory and replacing the file whole, so a crash leaves the old value or the new one.
func SortSessions ¶
func SortSessions(sessions []Session)
SortSessions orders the merged list by lowercased name, as main.rs does after merging the kinds.
func Stylesheet ¶
func Stylesheet(cfg *config.Config) *widget.Stylesheet
Stylesheet is install_css: the compiled stylesheet and the configured palette's theme, at the bundle's priority, with lys-ui's theme installed from the same palette. The greeter carries no user styles: pre-login there is no user.
Types ¶
type A11yOption ¶
type A11yOption uint8
const ( ScreenReader A11yOption = iota LargeText HighContrast StickyKeys SlowKeys )
func (A11yOption) String ¶
func (o A11yOption) String() string
type Accessibility ¶
type Accessibility [a11yOptions]bool
func LoadAccessibility ¶
func LoadAccessibility(statePath string) (Accessibility, error)
func (Accessibility) String ¶
func (a Accessibility) String() string
func (Accessibility) WMConfig ¶
func (a Accessibility) WMConfig() string
type Cursor ¶
Cursor is what one source found; either side may be missing.
func DetectCursor ¶
DetectCursor is the cursor u's session shows: the record under records, then the dotfiles in u's home; session is the remembered session id, whose compositor is consulted first.
func KioskCursor ¶
KioskCursor is the cursor the display manager has the greeter's kiosk compositor draw: ResolveCursor over the record the last session of lastUser, else of the only user, left under records. It reads no dotfiles: the display manager runs as root, and opens nothing a user controls.
func ResolveCursor ¶
func ResolveCursor(g config.LoginGreeterConfig, detected Cursor) Cursor
ResolveCursor applies install_cursor's order: an explicit greeter key (config.yaml or runtime.yaml), the detected dotfiles, the XCURSOR_* environment, then the size default. The theme may stay "".
type Defaults ¶
type Defaults struct {
// contains filtered or unexported fields
}
Defaults are what a command line leaves unsaid: the session directories and the state file.
func SystemDefaults ¶
SystemDefaults are the defaults the display manager resolves for the greeter it starts: the session directories of env's system data directories and SystemStatePath. The display manager's own home and state directory are root's, where the greeter's account cannot write, so they take no part.
func UserDefaults ¶
UserDefaults are the defaults of a greeter its own account runs, as under greetd: the session directories of env's system data directories, and the state file under env's state directory. The data home is left out: the greeter's account installs no sessions. Where env names no absolute state directory, a command line without --state is refused.
type Init ¶
type Init struct {
Config *config.Config
// Sessions is non-empty (main enforces it).
Sessions []Session
Users []User
LastSession string
LastUser string
Layouts map[string]string
A11y Accessibility
StatePath string
SessionEnv []string
OnPresented func()
HandOver bool
}
Init is what the greeter starts from (app.rs GreeterInit).
type Options ¶
type Options struct {
// ConfigPath is the lys-shell config the greeter themes from.
ConfigPath string
// SessionDirs and XSessionDirs are scanned for session files; none
// offers no session of that kind.
SessionDirs, XSessionDirs []string
// StatePath remembers the last session id; the last username sits
// in a last-user file beside it.
StatePath string
// Command is the explicit fallback session from `-- <argv>`.
Command []string
// Env holds extra KEY=value entries for the session.
Env []string
HandOver bool
}
Options are the parsed command line (config.rs Options).
func ParseOptions ¶
ParseOptions parses the arguments after the program name, taking what they leave unsaid from d. Everything after "--" is the fallback session argv; the repeatable --sessions and --xsessions replace their defaults once given, and --no-sessions and --no-xsessions replace them with nothing. Every path is absolute: the greeter does not run where its command line was written.
type Session ¶
type Session struct {
// ID is the .desktop stem, suffixed -x11 for X11 sessions; the
// remembered choice.
ID string
// Kind is the discovery directory it came from, and with it the type
// logind registers it as.
Kind SessionKind
// Name is Name= (else the id), suffixed " (X11)" for X11.
Name string
// Exec is the argv from Exec=, field codes dropped (and the startx
// wrapper prepended for X11).
Exec []string
}
Session is one selectable session (session.rs Session).
func Discover ¶
func Discover(dirs []string, kind SessionKind) []Session
Discover reads kind sessions from every *.desktop under dirs: Hidden/NoDisplay entries and files without a usable Exec are skipped, and an id seen in an earlier dir wins (XDG precedence).
type SessionKind ¶
type SessionKind uint8
SessionKind is which discovery directory advertised a session.
const ( // Wayland sessions (wayland-sessions/*.desktop) start directly. Wayland SessionKind = iota // X11 sessions (xsessions/*.desktop) start through // `startx /usr/bin/env`: greetd runs no X server, startx provides // one (the tuigreet approach). X11 )
Session kinds.
type UsageError ¶
type UsageError struct {
// contains filtered or unexported fields
}
UsageError is a malformed command line; the greeter exits 2 with it.
func (UsageError) Error ¶
func (e UsageError) Error() string
type User ¶
type User struct {
// Name is the login name greetd authenticates.
Name string
// UID keys the cursor record the account's last session left.
UID uint32
// DisplayName is the GECOS full name, else Name.
DisplayName string
// Home seeds ~/.face and the cursor read from dotfiles (it may be
// unreadable).
Home string
// Icon is a readable avatar path, "" when none.
Icon string
}
User is one login account offered in the user list (users.rs).