Documentation
¶
Overview ¶
Package lock is the secure lock screen (lys-shell's shell/lock): an ext-session-lock surface per output, so the compositor blanks every output, routes input only here, and keeps the session locked if the shell dies. The password is verified by a PAM conversation on a worker goroutine (service/auth), so the event loop is never stalled.
Triggers: logind's Lock and Unlock signals (loginctl lock-session, idle daemons), the dev.stubbe.lys.Shell1 Lock method (`lys-shell lock`, lys-lock), lock-on-start for autologin sessions, and the LockedHint restart recovery. The screen reports its state back with SetLockedHint.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Deps ¶
type Deps struct {
Locker locker
Loop loop
// Now is the clock the grace window and the labels read.
Now func() time.Time
// After runs fn on the loop after d, once; cancel stops it.
After func(d time.Duration, fn func()) (cancel func())
// Auth starts a conversation; the production one is PAM against
// the configured service for the session user.
Auth func(service string, onEvent func(auth.Event)) authHandle
// SetLockedHint reports the state to logind, best effort; nil
// without logind.
SetLockedHint func(locked bool)
// LoadImage decodes (and blurs) the background image.
LoadImage func(path string, blur uint32) (image.Image, error)
// OnLocked runs on the loop each time the compositor confirms a
// lock, for what locks with the session (the vault); nil for
// nothing.
OnLocked func()
}
Deps are the screen's collaborators; New fills the production ones.
type Logind ¶
type Logind struct {
// contains filtered or unexported fields
}
Logind is the caller's logind session on the system bus.
func NewLogind ¶
NewLogind resolves the caller's session object. logind emits Lock/Unlock from the session's real path, not from the /session/auto alias, so the alias is resolved once through Manager.GetSession("auto") and every call and signal match uses the real path.
func (*Logind) Listen ¶
Listen delivers the session's Lock and Unlock signals until ctx ends or the bus drops. The callbacks run on the listener goroutine.
func (*Logind) LockedHint ¶
LockedHint reads the session's LockedHint property.
func (*Logind) Path ¶
func (l *Logind) Path() dbus.ObjectPath
Path is the resolved session object path.
func (*Logind) SetLockedHint ¶
SetLockedHint tells logind whether the session is locked.
type Screen ¶
type Screen struct {
// contains filtered or unexported fields
}
Screen is the lock screen component. Every method runs on the event loop; auth events and signals cross into it through Loop.Invoke.
func New ¶
New builds the screen over its collaborators. The prompt shapes text with font; sheet (the shell's stylesheet) styles the surfaces through the lock.css rules.
func Start ¶
func Start(a *app.Application, cfg *config.Config, font render.Font, sheet *widget.Stylesheet, onLocked func()) (*Screen, func())
Start wires the lock screen into the running shell: the logind triggers, lock-on-start, and the LockedHint restart recovery. The shell serves `lys-shell lock` by handing Screen.Lock to its dev.stubbe.lys.Shell1 hooks. The returned stop ends the logind listener.
func (*Screen) Activity ¶
func (s *Screen) Activity()
Activity unblanks and re-arms the blank timer.
func (*Screen) ForceUnlock ¶
func (s *Screen) ForceUnlock()
ForceUnlock is logind's Unlock: tear down without a password - only something that already authorized it (logind, a PAM agent) sends it.
func (*Screen) Lock ¶
func (s *Screen) Lock()
Lock acquires the session lock and covers every output (idempotent while locked). Refused, with a log line, when lock is disabled or the compositor lacks ext-session-lock-v1.
func (*Screen) SetConfig ¶
SetConfig applies a reloaded config, as the Rust lock reads its keys live: every later read (the grace period, the attempt limit, the PAM service, the blank timeout, the clock formats) sees it at once, and the next lock builds its surfaces and background from it. Loop goroutine.