README
¶
Thyme
Spice up your day-to-day productivity with some free Thyme, courtesy of the team at Sourcegraph (the best way to read and explore code). Automatically track which applications you use and for how long.
- Simple CLI to track and analyze your application usage
- Detailed charts that let you profile how you spend your time
- Stores data locally, giving you full control and privacy
- Open-source, well-documented, and easily extensible
Thyme is a work in progress, so please report bugs! Want to see how it works? Dive into the source here.
Want to share what you've learned about your Thyme? Join the discussion on Twitter.
Features
Simple CLI
-
Record which applications you use every 30 seconds:
$ while true; do thyme track -o thyme.json; sleep 30s; done;
-
Create charts showing application usage over time. In a new window:
$ thyme show -i thyme.json -w stats > thyme.html
-
Open
thyme.html
in your browser of choice to see the charts below.
Application usage timeline
Detailed application window timeline
Aggregate time usage by app
Dependencies
Thyme's dependencies vary by system. See thyme dep
(mentioned in the installation instructions below).
Install
-
Install Go (if you have Homebrew on macOS, you can also run
brew install go
) and run$ go get -u github.com/sourcegraph/thyme/cmd/thyme
Alternatively, if you don't want to install Go, just download the
thyme
binary here. -
Follow the instructions printed by
thyme dep
.$ thyme dep
-
Verify
thyme
works with$ thyme track
This should display JSON describing which applications are currently active, visible, and present on your system.
Thyme currently supports Linux, macOS, and Windows.
Usage for Other Shells
Windows Powershell> for(1){thyme track -o thyme.json; Start-Sleep -s 5}
> thyme show -i thyme.json -w stats | Out-File -e utf8 thyme.html
Windows DOS Command Line
> for /L %n in (0) do @(thyme track -o thyme.json && timeout /t 5 /nobreak)
> thyme show -i thyme.json -w stats > thyme.html
Use cases
Thyme was designed for developers who want to investigate their application usage to make decisions that boost their day-to-day productivity.
It can also be for other purposes such as:
- Tracking billable hours and constructing timesheets
- Studying application usage behavior in a given population
How is Thyme different from other time trackers?
There are many time tracking products and services on the market. Thyme differs from available offerings in the following ways:
-
Thyme does not intend to be a fully featured time management product or service. Thyme adopts the Unix philosophy of a command-line tool that does one thing well and plays nicely with other command-line tools.
-
Thyme does not require you to manually signal when you start or stop an activity. It automatically records which applications you use.
-
Thyme is open source and free of charge.
-
Thyme does not send data over the network. It stores the data it collects on local disk. It's up to you whether you want to share it or not.
Attribution
The Thyme logo
by
Anthony Bossard is
licensed under
Creative Commons 3.0.
Documentation
¶
Index ¶
Constants ¶
Variables ¶
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:
1) Most windows use " - " to separate their window names from their content 2) Most windows use the " - " with the application name at the end. 3) 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.