Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterTracker ¶
RegisterTracker makes a Tracker constructor available to clients of this package.
func Stats ¶
Stats renders an HTML page with charts using stream as its data source. Currently, it renders the following charts: 1. A timeline of applications active, visible, and open 2. A timeline of windows active, visible, and open 3. A barchart of applications most often active, visible, and open
Types ¶
type AggTime ¶
type AggTime struct {
Charts []*BarChart
}
AggTime is the list of bar charts that convey aggregate application time usage.
type BarChart ¶
BarChart is a representation of a bar chart.
func NewBarChart ¶
NewBarChart returns a new BarChart with the specified ID, x- and y-axis label, and title.
func (*BarChart) OrderedBars ¶
OrderedBars returns a list of the top $maxNumberOfBars bars in the bar chart ordered by decreasing count.
type DarwinTracker ¶
type DarwinTracker struct{}
DarwinTracker tracks application usage using the "System Events" API in AppleScript. Due to the liminations of this API, the DarwinTracker will not be able to detect individual windows of applications that are not scriptable (in the AppleScript sense). For these applications, a single window is emitted with the name set to the application process name and the ID set to the process ID.
func (*DarwinTracker) Deps ¶
func (t *DarwinTracker) Deps() string
func (*DarwinTracker) Snap ¶
func (t *DarwinTracker) Snap() (*Snapshot, error)
type LinuxTracker ¶
type LinuxTracker struct{}
LinuxTracker tracks application usage on Linux via a few standard command-line utilities.
func (*LinuxTracker) Deps ¶
func (t *LinuxTracker) Deps() string
func (*LinuxTracker) Snap ¶
func (t *LinuxTracker) Snap() (*Snapshot, error)
type Snapshot ¶
Snapshot represents the current state of all in-use application windows at a moment in time.
type Stream ¶
type Stream struct { // Snapshots is a list of window snapshots ordered by time. Snapshots []*Snapshot }
Stream represents all the sampling data gathered by Thyme.
type Timeline ¶
Timeline represents a timeline of application usage. Start is the start time of the timeline. End is the end time of the timeline. Rows is a map where the keys are tags and the values are lists of time ranges. Each row is a distinct sub-timeline.
func NewTimeline ¶
NewTimeline returns a new Timeline created from the specified Stream. labelFunc is used to determine the ID string to be used for a given Window. If you're tracking events by app, this ID should reflect the identity of the window's application. If you're tracking events by window name, the ID should be the window name.
type Tracker ¶
type Tracker interface { // Snap returns a Snapshot reflecting the currently in-use windows // at the current time. Snap() (*Snapshot, error) // Deps returns a string listing the dependencies that still need // to be installed with instructions for how to install them. Deps() string }
Tracker tracks application usage. An implementation that satisfies this interface is required for each OS windowing system Thyme supports.
func NewDarwinTracker ¶
func NewDarwinTracker() Tracker
func NewLinuxTracker ¶
func NewLinuxTracker() Tracker
func NewTracker ¶
NewTracker returns a new Tracker instance whose type is `name`.
type Window ¶
type Window struct { // ID is the numerical identifier of the window. ID int64 // Desktop is the numerical identifier of the desktop the // window belongs to. Equal to -1 if the window is sticky. Desktop int64 // Name is the display name of the window (typically what the // windowing system shows in the top bar of the window). Name string }
Window represents an application window.
func (*Window) Info ¶
Info returns more structured metadata about a window. The metadata is extracted using heuristics.
Assumptions:
- Most windows use " - " to separate their window names from their content
- Most windows use the " - " with the application name at the end.
- The few programs that reverse this convention only reverse it.
func (*Window) IsOnDesktop ¶
IsOnDesktop returns true if the window is present on the specified desktop
type Winfo ¶
type Winfo struct { // App is the application that controls the window. App string // SubApp is the sub-application that controls the window. An // example is a web app (e.g., Sourcegraph) that runs // inside a Chrome tab. In this case, the App field would be // "Google Chrome" and the SubApp field would be "Sourcegraph". SubApp string // Title is the title of the window after the App and SubApp name // have been stripped. Title string }
Winfo is structured metadata info about a window.