awake

package
v0.93.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: AGPL-3.0 Imports: 4 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 awake keeps the machine from idling into sleep while a session is working, the way a media player does while it plays. Lock the screen and the agents go on; leave the machine at an idle prompt and it sleeps as it always did. What is held is the OS's own idle-sleep assertion, so `powercfg /requests`, `pmset -g assertions` and `systemd-inhibit --list` all name lich as the holder, and the user's own sleep policy is what decides the rest: a closed lid, a chosen Sleep and a critical battery all still sleep.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Keeper

type Keeper struct {
	// contains filtered or unexported fields
}

Keeper turns a count of working sessions into one held assertion.

func New

func New() *Keeper

New returns a Keeper backed by this OS's idle-sleep assertion.

func (*Keeper) Set

func (k *Keeper) Set(working int)

Set reports how many sessions are working right now. The assertion is taken on the first and let go on the last; the numbers in between change nothing. A hold that fails is logged and tried again on the next rise from zero, so a machine without the tool (a Linux without systemd) costs one log line per burst of work, never a stuck session.

The lock is held across the hold itself, which spawns a process on macOS and Linux. That costs milliseconds and buys the ordering: a release can never overtake the hold it undoes.

Jump to

Keyboard shortcuts

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