Documentation
¶
Overview ¶
Package logind is systemd-logind on the system bus as lys-shell uses it: the user's session resolved without the environment, logging out of it, locking it, suspending, and holding sleep off until it is locked.
Index ¶
- Constants
- Variables
- func InhibitSleep(ctx context.Context, conn *dbus.Conn, who, why string) (*os.File, error)
- func Logout(ctx context.Context, conn *dbus.Conn) error
- func PrepareForSleepMatch() []dbus.MatchOption
- func Session(ctx context.Context, conn *dbus.Conn) (dbus.ObjectPath, error)
- func Suspend(ctx context.Context, conn *dbus.Conn) error
- type Client
- func (l *Client) Listen(ctx context.Context, onLock, onUnlock func()) error
- func (l *Client) Lock(ctx context.Context) error
- func (l *Client) LockedHint(ctx context.Context) (bool, error)
- func (l *Client) Path() dbus.ObjectPath
- func (l *Client) SetLockedHint(ctx context.Context, locked bool) error
- func (l *Client) WaitLocked(ctx context.Context) error
- type Sleep
Constants ¶
const ( Service = "org.freedesktop.login1" ManagerPath = dbus.ObjectPath("/org/freedesktop/login1") ManagerIf = "org.freedesktop.login1.Manager" SessionIf = "org.freedesktop.login1.Session" )
The logind service, its manager object, and its interfaces.
const CallTimeout = 5 * time.Second
CallTimeout is how long one call to logind may take: callers on a path that must not hang give their calls this deadline.
Variables ¶
var PrepareForSleep = dbusx.NewSignal[Sleep](ManagerIf, "PrepareForSleep")
PrepareForSleep is the manager's signal around a suspend or hibernate.
Functions ¶
func InhibitSleep ¶ added in v0.3.15
InhibitSleep takes a delay inhibitor on sleep for who, saying why: logind waits (up to its InhibitDelayMaxSec) before sleeping until the returned file is closed.
func PrepareForSleepMatch ¶ added in v0.3.15
func PrepareForSleepMatch() []dbus.MatchOption
PrepareForSleepMatch matches PrepareForSleep from the manager.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the caller's logind session on the system bus.
func NewClient ¶
NewClient resolves the user's session object once (Session) under ctx; every call and signal match uses its real path.
func SystemClient ¶
SystemClient connects to logind on the system bus under ctx, logging (not failing) when it is unavailable, as what without it is optional; what names the user of the client in the log line. The connection outlives ctx once made.
func (*Client) 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 (*Client) Lock ¶ added in v0.3.15
Lock asks logind to lock the session: logind sends the session's Lock signal, which the lock screen answers.
func (*Client) LockedHint ¶
LockedHint reads the session's LockedHint property, waiting no longer than ctx.
func (*Client) Path ¶
func (l *Client) Path() dbus.ObjectPath
Path is the resolved session object path.
func (*Client) SetLockedHint ¶
SetLockedHint tells logind whether the session is locked, waiting no longer than ctx.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package logindtest is a fake systemd-logind on a private bus, seen from a caller outside any login session: a shell the systemd user manager started.
|
Package logindtest is a fake systemd-logind on a private bus, seen from a caller outside any login session: a shell the systemd user manager started. |