Skip to content

πŸ’€ Billy Idle - Lightweight MacOS (In)activity Tracker

License

Notifications You must be signed in to change notification settings

tillkuhn/billy-idle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

19 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

ci-build

πŸ’€ Billy Idle - Lightweight macOS (In)activity Tracker

Simple busy / idle time tracker inspired by the ancient article Inactivity and Idle Time on OS X.

Background

According to the article, OS X has a timer called HIDIdleTime that tracks the last time you interacted with the computer, e.g. moved the mouse, typed a key, or interacted with the computer.

billy-idle simply queries this value periodically using the ioreg utility that ships with macOS, and matches it against a pre-defined threshold. If exceeded, it will create a record for the busy time period in database. This data can later be used as input for time tracking tools or statistics.

Run

$ go run main.go

2024/09/28 00:43:52 [BigMac] 🎬 billy-idle tracker started version=latest commit=e95d72f
2024/09/28 00:44:09 [BigMac] πŸ’€ Entering idle mode after 17s of busy time, completing record #1
2024/09/28 00:44:13 [BigMac] 🐝 Resuming busy mode after 4s of idle time, creating new record #2
2024/09/28 00:44:27 [BigMac] πŸ’€ Entering idle mode after 14s of busy time, completing record #2
2024/09/28 00:45:25 [BigMac] 🐝 Resuming busy mode after 58s of idle time, creating new record #3
2024/09/28 00:45:37 [BigMac] πŸ’€ Entering idle mode after 12s of busy time, completing record #3
2024/09/28 00:45:45 [BigMac] 🐝 Resuming busy mode after 8s of idle time, creating new record #4
2024/09/28 00:45:48 [BigMac] πŸ›‘ Received Signal interrupt
2024/09/28 00:45:49 [BigMac] πŸ›‘ tracker stopped
Note
Binary packages for macOS amd64 and arm64 are coming soon, the same goes for docker images on ghcr.io

CLI Arguments

$ billy-idle help
  -cmd string
    	Command to retrieve HIDIdleTime (default "ioreg")
  -idle duration
    	Max time before client is considered idle (default 10s)
  -interval duration
    	Interval to check for idle time (default 2s)

Database Support

Billy Idle currently only support a local sqlite database, more precisely modernc.org/sqlite which is a cgo-free port of SQLite. But it shouldn’t be a big deal to add support for a remote PostgreSQL Database.

sqlite

Development

$ make
Usage: make <OPTIONS> ... <TARGETS>

Available targets are:

build                build all targets
clean                Clean output directory
help                 Shows the help
lint                 Lint go code
minor                Create Minor Release
run                  Run tracker
test                 Test go code
update               Update all go dependencies

🎸 Credits

640px Billy idol ill artlibre jnl

Source: Wikimedia Commons, terms of the Free Art License apply.

Contribution

If you want to contribute to rubin please have a look at the CONTRIBUTING.md

About

πŸ’€ Billy Idle - Lightweight MacOS (In)activity Tracker

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published