lock

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: 18 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 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

func NewLogind(conn *dbus.Conn) (*Logind, error)

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

func (l *Logind) Listen(ctx context.Context, onLock, onUnlock func()) error

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

func (l *Logind) LockedHint() (bool, error)

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

func (l *Logind) SetLockedHint(locked bool) error

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

func New(cfg *config.Config, font render.Font, sheet *widget.Stylesheet, d Deps) *Screen

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

func (s *Screen) Locked() bool

Locked reports whether a lock is pending or held.

func (*Screen) SetConfig

func (s *Screen) SetConfig(cfg *config.Config)

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.

func (*Screen) Submit

func (s *Screen) Submit(value string)

Submit handles one Enter in a password entry. The first submit of a lock session starts a PAM conversation and stashes the value for its first prompt; a submit while a later prompt is on screen (an expired password, an OTP) answers it.

Jump to

Keyboard shortcuts

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