{"id":19273753,"url":"https://github.com/thisdougb/magicpoweralert","last_synced_at":"2025-04-21T22:33:12.768Z","repository":{"id":43218196,"uuid":"259257374","full_name":"thisdougb/MagicPowerAlert","owner":"thisdougb","description":"Better alerts when your Apple mouse or keyboard is getting low on power.","archived":false,"fork":false,"pushed_at":"2024-03-26T08:10:26.000Z","size":89,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-01T16:24:03.101Z","etag":null,"topics":["apple","bluetooth","macos","productivity"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thisdougb.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":"2020-04-27T08:49:34.000Z","updated_at":"2024-05-06T23:26:59.000Z","dependencies_parsed_at":"2024-11-09T20:44:04.273Z","dependency_job_id":"407edd7f-a0c9-4ca9-84f8-b25df4a3bb5b","html_url":"https://github.com/thisdougb/MagicPowerAlert","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thisdougb%2FMagicPowerAlert","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thisdougb%2FMagicPowerAlert/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thisdougb%2FMagicPowerAlert/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thisdougb%2FMagicPowerAlert/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thisdougb","download_url":"https://codeload.github.com/thisdougb/MagicPowerAlert/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250145094,"owners_count":21382345,"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":["apple","bluetooth","macos","productivity"],"created_at":"2024-11-09T20:44:01.433Z","updated_at":"2025-04-21T22:33:07.756Z","avatar_url":"https://github.com/thisdougb.png","language":"Shell","readme":"# MagicPowerAlert\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/thisdougb/MagicPowerAlert/blob/master/example.jpeg\" /\u003e\n\u003c/p\u003e\n\nConvenient low-battery notification for your Apple Mac with Bluetooth devices.\n\nMac OS warns your Magic Mouse is running out of power at 2%. Not ideal given the charging port location.\nMagicPowerAlert lets you know at 20%, giving you lots of time to fit in a charging session at a time of your choosing.\n\nCompetency level: comfortable using Terminal, and cron.\n\n### Instructions:\n\n##### Download Code\n\n```\n$ mkdir MagicPower\n$ cd MagicPower\n$ curl -L0 -O https://raw.githubusercontent.com/thisdougb/MagicPowerAlert/master/MagicPowerAlert.sh\n```\n#### View Battery and Charging Status (without the pop-up alert)\n```\n$ ./MagicPowerAlert.sh status\nMagic Keyboard with Numeric Keypad at 98%\nMagic Mouse 2 at 47% (charging)\n```\n#### Configure\nThe default should be fine, it'll pick up either mouse or keyboard below 20% power.\nBut you can change this is you like.\n\n```\n# Set to mute consecutive alerts for a period of minutes. Makes it practical to schedule\n# MagicPowerAlert to run frequently, say every 30 minutes. Really, two alerts per day are\n# probably enough of a reminder. So a good value is maybe 4 hours.\nMUTE_CONSECUTIVE_ALERTS_HOURS=4\n\n# Inactivity detection. If user is afk, don't continue and possibly spam the desktop with alerts.\n# For example, no alerts during the night when running other automated tasks.\nINACTIVITY_THRESHOLD_MINS=5\n\n# You can change the message, if coffee is not your thing.\nMESSAGE=\"Get a coffee and charge:\\n\"\n```\n#### Test Pop-up Alert\nGive it a quick test, set the alert THRESHOLD to 100 by supplying as an argument.\nA window prompt should pop-up, with your alert.\n```\n$ chmod +x MagicPowerAlert.sh\n$ ./MagicPowerAlert.sh 100\n```\nRemember that running while muted will not pop-up an alert. So just remove this file if you want to re-test.\n```\n$ ls -l MagicPowerAlert.sh.mute\n-rw-r--r--  1 dougb  staff  0  4 Apr 11:29 MagicPowerAlert.sh.mute\n```\n#### Schedule It\nIf you haven't used cron before, then the relevant info (from 'man 5 cron') is:\n```\nThe time and date fields are:\n\n       field         allowed values\n       -----         --------------\n       minute        0-59\n       hour          0-23\n       day of month  1-31\n       month         1-12 (or names, see below)\n       day of week   0-7 (0 or 7 is Sun, or use names)\n\nA field may be an asterisk (*), which always stands for first-last.\n\nTo specific a range use 9-12, which gives 9, 10, 11, 12.\n\nTo step through a range use */\u003cstep\u003e, for example */5 will give 0, 5, 10, etc.\n```\nAdd a cron entry with your file path and time preferences.\nTo avoid waking up to a hundred pop-up alerts, ensure you configure muting and inactivity to suitable values.\n\nFor example, this runs every 30 minutes:\n```\n*/30 * * * * /Users/dougb/dev/MagicPowerAlert/MagicPowerAlert.sh\n```\n#### Switch Off\nOf course you can delete the cron entry, or simply comment it out.\n```\n# switched off\n#*/30 * * * * /Users/dougb/dev/MagicPowerAlert/MagicPowerAlert.sh\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthisdougb%2Fmagicpoweralert","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthisdougb%2Fmagicpoweralert","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthisdougb%2Fmagicpoweralert/lists"}