greeter

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2026 License: MIT, MIT Imports: 51 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 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

View Source
const (
	LargeTextScale = 1.5
	SlowKeysDelay  = 300 * time.Millisecond
)
View Source
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

View Source
var ErrNoSessions = errors.New("no sessions to log into")

Functions

func AccessibilityPath

func AccessibilityPath(statePath string) string

func ApplyCacheDir

func ApplyCacheDir(statePath string) error

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 LastLayoutPath(statePath, user string) (string, bool)

func LastUserPath

func LastUserPath(statePath string) string

LastUserPath is the last-user file beside the session state file.

func LoadLast

func LoadLast(path string) string

LoadLast reads a remembered value; "" when unset or unreadable.

func LoadLayouts

func LoadLayouts(statePath string) map[string]string

func Run

func Run(init Init) error

Run shows the greeter until greetd starts a session (or the window closes): one fullscreen window on the kiosk compositor.

func SaveLast

func SaveLast(path, value string) error

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

type Cursor struct {
	Theme string // "" when unknown
	Size  uint32 // 0 when unknown
}

Cursor is what one source found; either side may be missing.

func DetectCursor

func DetectCursor(records string, u User, session string) Cursor

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. A dotfile the greeter can read but not parse is logged and skipped.

func KioskCursor

func KioskCursor(g config.LoginGreeterConfig, records string, users []User, lastUser string) Cursor

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

func SystemDefaults(env xdg.Env) Defaults

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

func UserDefaults(env xdg.Env) Defaults

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

func ParseOptions(d Defaults, args []string) (Options, error)

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.

func (Options) Args

func (o Options) Args() []string

Args is the command line that parses back to o under any Defaults: it says everything, so a greeter started with it resolves nothing from its own environment.

func (Options) Sessions

func (o Options) Sessions() ([]Session, error)

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).

func (Session) Started

func (s Session) Started(extra []string) auth.Session

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).

func LoadUsers

func LoadUsers() []User

LoadUsers is what the user list offers: ReadUsers without system accounts, with the avatars resolved.

func ReadUsers

func ReadUsers() []User

ReadUsers reads the login users from /etc/passwd.

Jump to

Keyboard shortcuts

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