{"id":51406235,"url":"https://github.com/skorotkiewicz/work-track","last_synced_at":"2026-07-04T11:02:32.238Z","repository":{"id":368798215,"uuid":"1237177806","full_name":"skorotkiewicz/work-track","owner":"skorotkiewicz","description":"A minimal screen-on time tracker for Wayland","archived":false,"fork":false,"pushed_at":"2026-07-02T07:47:27.000Z","size":24,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"cin","last_synced_at":"2026-07-02T09:25:58.374Z","etag":null,"topics":["bash","json","timetracker","wayland"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/skorotkiewicz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-13T00:28:15.000Z","updated_at":"2026-07-02T07:47:35.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/skorotkiewicz/work-track","commit_stats":null,"previous_names":["skorotkiewicz/work-track"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/skorotkiewicz/work-track","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skorotkiewicz%2Fwork-track","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skorotkiewicz%2Fwork-track/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skorotkiewicz%2Fwork-track/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skorotkiewicz%2Fwork-track/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/skorotkiewicz","download_url":"https://codeload.github.com/skorotkiewicz/work-track/tar.gz/refs/heads/cin","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skorotkiewicz%2Fwork-track/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35118971,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-04T02:00:05.987Z","response_time":113,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bash","json","timetracker","wayland"],"created_at":"2026-07-04T11:02:31.609Z","updated_at":"2026-07-04T11:02:32.229Z","avatar_url":"https://github.com/skorotkiewicz.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# work-track\n\nA minimal screen-on time tracker for Wayland.\n\nTracks how long your screen is active each day. Hooks into `swayidle` to detect screen on/off and suspend/resume events, persists daily totals to JSON, and correctly handles midnight boundaries.\n\n---\n\n## State\n\n- **Runtime:** `$XDG_RUNTIME_DIR/worktrack/` (tmpfs, no disk writes during tracking)\n- **Persist:** `$XDG_DATA_HOME/worktrack/YYYY-MM-DD.json`\n\n## Usage\n\n```bash\nwork-track on       # screen on  (swayidle resume / after-resume)\nwork-track off      # screen off (swayidle timeout / before-sleep)\nwork-track status   # print today's total\nwork-track save     # bank current session, persist to JSON\nwork-track log      # show last 7 days\nmini-track stats N  # last N days (default: 1)\n```\n\n## Integration\n\nAdd to your compositor startup config (e.g., Niri):\n\n```rust\n// sudo ln -s /home/worktracker/mini-track /usr/bin/mini-track\nspawn-sh-at-startup \"mini-track on\"\nspawn-sh-at-startup \"swayidle -w \\\\\n    timeout 300 'swaylock -f' \\\\\n    timeout 600 'work-track off; niri msg action power-off-monitors' \\\\\n        resume 'work-track on' \\\\\n    before-sleep 'work-track off' \\\\\n    after-resume 'work-track on' \u0026\"\n```\n\n- `resume` → monitor wake\n- `after-resume` → system resume\n\n## Why RAM state?\n\nRuntime state lives in `$XDG_RUNTIME_DIR` (tmpfs/RAM) instead of writing straight to the JSON for two reasons:\n\n1. **Zero disk wear:** If `work-track status` is used in a Waybar that updates every 5 seconds, writing to JSON would wear out your SSD. tmpfs allows instant, zero-wear reads/writes.\n2. **Crash safety:** If the system loses power while the screen is active, the in-memory state is lost. This prevents writing an incorrect “always-on” session to disk, which would otherwise corrupt historical accuracy. At most, a small amount of unrecorded time is lost, while existing daily JSON data remains valid. A systemd timer reduces this gap to roughly ~5 minutes.\n\n   See [systemd](systemd.md) for implementation details.\n\n---\n\n## Waybar\n\n```json\n{\n  \"custom/worktrack\": {\n    \"exec\": \"work-track status\",\n    \"interval\": 60,\n    \"format\": \"⏱ {}\"\n  }\n}\n```\n\n---\n\n## JSON Output\n\n```json\n{\n  \"date\": \"2026-05-12\",\n  \"seconds\": 13335\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskorotkiewicz%2Fwork-track","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fskorotkiewicz%2Fwork-track","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskorotkiewicz%2Fwork-track/lists"}