{"id":18619991,"url":"https://github.com/alex000kim/mac-activity-logger","last_synced_at":"2026-04-30T09:31:18.556Z","repository":{"id":191106211,"uuid":"683902081","full_name":"alex000kim/Mac-Activity-Logger","owner":"alex000kim","description":null,"archived":false,"fork":false,"pushed_at":"2023-08-29T16:30:57.000Z","size":6,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-12-27T04:22:51.652Z","etag":null,"topics":["activity-logger","mac","macos","productivity"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alex000kim.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2023-08-28T02:57:38.000Z","updated_at":"2024-03-15T07:58:09.000Z","dependencies_parsed_at":"2023-08-28T06:25:44.763Z","dependency_job_id":"8cdbfb0d-2db8-4b57-a9c7-22e21fdb085b","html_url":"https://github.com/alex000kim/Mac-Activity-Logger","commit_stats":{"total_commits":5,"total_committers":1,"mean_commits":5.0,"dds":0.0,"last_synced_commit":"0741058a34af01249c5b96b8fb739211aa6b58bb"},"previous_names":["alex000kim/mac-activity-logger"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alex000kim%2FMac-Activity-Logger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alex000kim%2FMac-Activity-Logger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alex000kim%2FMac-Activity-Logger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alex000kim%2FMac-Activity-Logger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alex000kim","download_url":"https://codeload.github.com/alex000kim/Mac-Activity-Logger/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239412785,"owners_count":19634092,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["activity-logger","mac","macos","productivity"],"created_at":"2024-11-07T04:04:29.918Z","updated_at":"2025-11-03T11:30:35.284Z","avatar_url":"https://github.com/alex000kim.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Mac Activity Logger\n\nThis script logs the currently active application and related metadata to a local SQLite database on macOS.\nThe goal of the project is to help me understand how I spend my time on my computer.\nSome ways how this data could be used later:\n\n- Generate reports showing the amount of time spent in each application. Identify trends in usage over time.\n- Analyze time spent on websites and categorize them as productive, leisure, educational, etc.\n- Set goals for certain metrics, like maximum hours per day spent on leisure websites. Track progress towards these goals over time.\n- Use URL data to identify patterns.\n- Apply machine learning to app and website categories to automatically detect productive vs distracting usage patterns.\n\n## Features\n\n- Logs the foreground application name every time the script is run\n- If Google Chrome is the active app, also logs the active tab URL and title\n- Saves timestamped records to a SQLite database for persistent storage\n- Uses AppKit via AppleScript to get active app information\n- Errors are logged to a separate file for diagnostics\n\n## Requirements\n\n- macOS\n- Python 3\n- SQLite 3\n\n## Usage\n\n- Run the `mac_activity_logger.py` script on a schedule via Launchpad or cron\n- The local SQLite database will be created at `~/Documents/app_activity_db.sqlite`\n- Log files will be created at `~/Documents/app_activity_errors.log`\n- View and query the database with SQLite tools like DB Browser for SQLite\n\n```bash\n$ sqlite3 ~/Documents/app_activity_db.sqlite \"SELECT * FROM app_activity ORDER BY timestamp DESC LIMIT 10;\"\n2023-08-29 12:29:47.289955|Terminal||\n2023-08-29 12:29:37.109373|Terminal||\n2023-08-29 12:29:26.904139|Google Chrome|...\n2023-08-29 12:29:16.644958|Google Chrome|...\n2023-08-29 12:29:06.383001|Google Chrome|...\n2023-08-29 12:28:56.088728|Google Chrome|...\n2023-08-29 12:28:45.836765|Google Chrome|...\n2023-08-29 12:28:35.571242|Google Chrome|...\n2023-08-29 12:28:25.285999|Google Chrome|...\n2023-08-29 12:28:14.999757|Telegram||\n```\n\n## Run on Startup\n\nTo run this script in the background on startup every 5 seconds, you can create a launchd plist file.\n\nHere are the steps:\n\n1. Create a file `~/Library/LaunchAgents/com.user.app_activity.plist` with this content:\n\n```xml\n\u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\n\u003c!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\"\u003e\n\u003cplist version=\"1.0\"\u003e\n\u003cdict\u003e\n  \u003ckey\u003eLabel\u003c/key\u003e\n  \u003cstring\u003ecom.user.app_activity\u003c/string\u003e\n\n  \u003ckey\u003eProgramArguments\u003c/key\u003e\n  \u003carray\u003e\n    \u003cstring\u003epython\u003c/string\u003e\n    \u003cstring\u003e/full/path/to/your_script.py\u003c/string\u003e\n  \u003c/array\u003e\n\n  \u003ckey\u003eStartInterval\u003c/key\u003e\n  \u003cinteger\u003e5\u003c/integer\u003e\n  \n  \u003ckey\u003eRunAtLoad\u003c/key\u003e\n  \u003ctrue/\u003e\n  \n  \u003ckey\u003eKeepAlive\u003c/key\u003e\n  \u003ctrue/\u003e\n\u003c/dict\u003e\n\u003c/plist\u003e\n```\n\n2. Load the plist to start the script:\n\n```bash\nlaunchctl load ~/Library/LaunchAgents/com.user.app_activity.plist\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falex000kim%2Fmac-activity-logger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falex000kim%2Fmac-activity-logger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falex000kim%2Fmac-activity-logger/lists"}