{"id":22364536,"url":"https://github.com/roelvangils/battery-saver","last_synced_at":"2026-05-15T21:34:54.614Z","repository":{"id":247629938,"uuid":"826400405","full_name":"roelvangils/battery-saver","owner":"roelvangils","description":"A bash script that audibly reminds you to plug in your MacBook when it's on battery power and connected to specific Wi-Fi networks. Perfect for preserving battery life at work or in other familiar locations.","archived":false,"fork":false,"pushed_at":"2024-07-09T16:33:37.000Z","size":4,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-27T19:13:04.065Z","etag":null,"topics":["bash","battery","energy","power","wifi"],"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/roelvangils.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}},"created_at":"2024-07-09T16:27:53.000Z","updated_at":"2024-07-09T19:15:29.000Z","dependencies_parsed_at":"2024-07-09T21:14:18.935Z","dependency_job_id":null,"html_url":"https://github.com/roelvangils/battery-saver","commit_stats":null,"previous_names":["roelvangils/battery-saver"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/roelvangils/battery-saver","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roelvangils%2Fbattery-saver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roelvangils%2Fbattery-saver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roelvangils%2Fbattery-saver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roelvangils%2Fbattery-saver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/roelvangils","download_url":"https://codeload.github.com/roelvangils/battery-saver/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roelvangils%2Fbattery-saver/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33080777,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-15T20:25:35.270Z","status":"ssl_error","status_checked_at":"2026-05-15T20:25:34.732Z","response_time":103,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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","battery","energy","power","wifi"],"created_at":"2024-12-04T17:24:05.995Z","updated_at":"2026-05-15T21:34:54.598Z","avatar_url":"https://github.com/roelvangils.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🔋⚠️ Office Wi-Fi Battery Alert\n\nThis project contains a bash script that checks if your MacBook is on battery power when connected to certain Wi-Fi networks (like office networks). If it meets both conditions, it'll use text-to-speech to remind you to plug in your laptop and save battery life!\n\n## Requirements\n\n-   macOS (tested on macOS Catalina and later)\n-   Terminal access\n\n## Installation\n\n1. Clone this repository or download the script file.\n2. Open Terminal and navigate to the directory containing the script.\n3. Make the script executable:\n\n```bash\nchmod +x battery-saver.sh\n```\n\n## Configuration\n\n1. Open `battery-saver.sh` in a text editor.\n2. Modify the `office_networks` array to include your office Wi-Fi network names:\n\n```bash\noffice_networks=(\"Eleven Ways\" \"Home\")\n```\n\n## Setting Up the Cron Job\n\nTo run the script automatically every 15 minutes:\n\n1. Open Terminal.\n2. Edit your crontab file:\n    ```\n    crontab -e\n    ```\n3. Add the following line (replace `/path/to/script` with the actual path):\n    ```\n    */15 * * * * /path/to/script/battery-saver.sh\n    ```\n4. Save and exit the editor.\n\n## Manual Execution\n\nTo run the script manually:\n\n```\n./battery-saver.sh\n```\n\n## How It Works\n\n1. The script checks if the MacBook is running on battery power.\n2. It then checks if the current Wi-Fi network matches any in the predefined list of office networks.\n3. If both conditions are true, it uses the `say` command to speak a reminder message.\n\n## Customization\n\n-   Modify the `speak_message` function to change the reminder text.\n-   Adjust the cron job timing as needed (e.g., change `*/15` to `*/5` for every 5 minutes).\n\n## Troubleshooting\n\n-   Ensure the script has execute permissions.\n-   Check that the Wi-Fi interface name (en0) matches your system. Use `networksetup -listallhardwareports` to verify.\n-   Make sure your system volume is audible for the speech alert.\n\n## License\n\nThis project is open source and available under the [MIT License](LICENSE).\n\n## Contributing\n\nContributions, issues, and feature requests are welcome. Feel free to check [issues page](https://github.com/yourusername/your-repo-name/issues) if you want to contribute.\n\n## Author\n\nRoel Van Gils\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froelvangils%2Fbattery-saver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Froelvangils%2Fbattery-saver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froelvangils%2Fbattery-saver/lists"}