usage

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2026 License: MIT Imports: 5 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 usage keeps daily screen time: how long the monitor was lit, and how long someone was using it.

Index

Constants

View Source
const Interval = 30 * time.Second

Interval is how often Record should be called.

Variables

This section is empty.

Functions

This section is empty.

Types

type Day

type Day struct {
	Day    string `json:"day"`    // 2006-01-02
	Awake  int    `json:"awake"`  // seconds lit
	Active int    `json:"active"` // seconds with keyboard or mouse input
}

type Tracker

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

Tracker samples the monitor and stores totals in a JSON file.

func Open

func Open(path string) *Tracker

func (*Tracker) Recent

func (t *Tracker) Recent(n int) []Day

Recent returns the last n days, oldest first, with empty days included.

func (*Tracker) Record

func (t *Tracker) Record(awake bool, idle time.Duration)

Record adds one sample: nothing while the monitor sleeps.

Jump to

Keyboard shortcuts

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