{"id":13413148,"url":"https://github.com/prashantgupta24/mac-sleep-notifier","last_synced_at":"2025-12-26T14:54:09.248Z","repository":{"id":47898480,"uuid":"178493138","full_name":"prashantgupta24/mac-sleep-notifier","owner":"prashantgupta24","description":"macOS Sleep/ Wake notifications in golang","archived":false,"fork":false,"pushed_at":"2019-06-17T15:59:38.000Z","size":20,"stargazers_count":32,"open_issues_count":0,"forks_count":6,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-07-31T20:51:56.947Z","etag":null,"topics":["c","cgo","golang","macos","sleep"],"latest_commit_sha":null,"homepage":"","language":"Go","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/prashantgupta24.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}},"created_at":"2019-03-30T00:43:23.000Z","updated_at":"2024-05-20T19:17:21.000Z","dependencies_parsed_at":"2022-08-12T14:00:42.573Z","dependency_job_id":null,"html_url":"https://github.com/prashantgupta24/mac-sleep-notifier","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prashantgupta24%2Fmac-sleep-notifier","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prashantgupta24%2Fmac-sleep-notifier/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prashantgupta24%2Fmac-sleep-notifier/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prashantgupta24%2Fmac-sleep-notifier/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/prashantgupta24","download_url":"https://codeload.github.com/prashantgupta24/mac-sleep-notifier/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221498723,"owners_count":16833053,"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":["c","cgo","golang","macos","sleep"],"created_at":"2024-07-30T20:01:34.130Z","updated_at":"2025-12-26T14:54:09.166Z","avatar_url":"https://github.com/prashantgupta24.png","language":"Go","funding_links":[],"categories":["GUI","Relational Databases","Go"],"sub_categories":["Advanced Console UIs","检索及分析资料库","Search and Analytic Databases","SQL 查询语句构建库"],"readme":"[![Mentioned in Awesome Go](https://awesome.re/mentioned-badge.svg)](https://github.com/avelino/awesome-go) [![Go Report Card](https://goreportcard.com/badge/github.com/prashantgupta24/mac-sleep-notifier)](https://goreportcard.com/report/github.com/prashantgupta24/mac-sleep-notifier) [![codecov](https://codecov.io/gh/prashantgupta24/mac-sleep-notifier/branch/master/graph/badge.svg)](https://codecov.io/gh/prashantgupta24/mac-sleep-notifier) [![version][version-badge]][RELEASES] [![godoc-badge][godoc-badge]][godoc-link]\n\n## macOS Sleep/ Wake notifications in golang\n\nInspired from [this](https://nicolai86.eu/blog/2017/12/sleep-wake-notifications-in-go/) blog.\n\nThis libary notifies through a channel whenever your machine is put to sleep or is woken up. Calling the `Start` function will get you a channel on which you receive both `Sleep` and `Awake` activities.\n\n## Installation\n\n`go get -u github.com/prashantgupta24/mac-sleep-notifier/notifier`\n\n## Usage\n\n```go\nnotifierCh := notifier.GetInstance().Start()\n\nfor {\n\tselect {\n\tcase activity := \u003c-notifierCh:\n\t\tif activity.Type == notifier.Awake {\n\t\t\tlog.Println(\"machine awake\")\n\t\t} else {\n\t\t\tif activity.Type == notifier.Sleep {\n\t\t\t\tlog.Println(\"machine sleeping\")\n\t\t\t}\n\t\t}\n\t}\n}\n```\n## Example\nSee example [here](https://github.com/prashantgupta24/mac-sleep-notifier/blob/master/example/example.go)\n\n[godoc-badge]: https://img.shields.io/badge/godoc-reference-blue.svg\n[godoc-link]: https://godoc.org/github.com/prashantgupta24/mac-sleep-notifier/notifier\n\n[version-badge]: https://img.shields.io/github/release/prashantgupta24/mac-sleep-notifier.svg\n[RELEASES]: https://github.com/prashantgupta24/mac-sleep-notifier/releases\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprashantgupta24%2Fmac-sleep-notifier","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprashantgupta24%2Fmac-sleep-notifier","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprashantgupta24%2Fmac-sleep-notifier/lists"}