wellbeing

package
v0.0.0-...-e10102e Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DBPath

func DBPath() string

func HandleRequest

func HandleRequest(conn *ipc.ConnWriter, req ipc.Request, manager *Manager)

Types

type DayUsage

type DayUsage struct {
	Date   string           `json:"date"`
	Active int64            `json:"active"`
	Apps   map[string]int64 `json:"apps"`
}

type LimitEvent

type LimitEvent struct {
	Kind  string `json:"kind"`
	AppID string `json:"appId,omitempty"`
	Used  int64  `json:"used"`
	Limit int64  `json:"limit"`
}

type Limits

type Limits struct {
	Daily int64            `json:"daily"`
	Apps  map[string]int64 `json:"apps"`
}

type Manager

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

func NewManager

func NewManager() (*Manager, error)

func (*Manager) Clear

func (m *Manager) Clear()

func (*Manager) Close

func (m *Manager) Close()

func (*Manager) Flush

func (m *Manager) Flush()

func (*Manager) GetState

func (m *Manager) GetState() State

func (*Manager) SetLimits

func (m *Manager) SetLimits(limits Limits)

func (*Manager) SetState

func (m *Manager) SetState(appID string, active bool, seq int64)

func (*Manager) Snapshot

func (m *Manager) Snapshot() State

Snapshot opens every subscription; Resync asks the shell to push its state again.

func (*Manager) Subscribe

func (m *Manager) Subscribe(id string) chan State

func (*Manager) Summary

func (m *Manager) Summary(days int) []DayUsage

func (*Manager) Unsubscribe

func (m *Manager) Unsubscribe(id string)

The shell is the only source of focus and idle state, so when its last subscription drops the open segment ends instead of counting forever.

type State

type State struct {
	Today  DayUsage    `json:"today"`
	Limit  *LimitEvent `json:"limit,omitempty"`
	Resync bool        `json:"resync,omitempty"`
}

Jump to

Keyboard shortcuts

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