Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

macOS Sleep/ Wake notifications in golang

License

NotificationsYou must be signed in to change notification settings

prashantgupta24/mac-sleep-notifier

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mentioned in Awesome GoGo Report Cardcodecovversiongodoc-badge

macOS Sleep/ Wake notifications in golang

Inspired fromthis blog.

This libary notifies through a channel whenever your machine is put to sleep or is woken up. Calling theStart function will get you a channel on which you receive bothSleep andAwake activities.

Installation

go get -u github.com/prashantgupta24/mac-sleep-notifier/notifier

Usage

notifierCh:=notifier.GetInstance().Start()for {select {caseactivity:=<-notifierCh:ifactivity.Type==notifier.Awake {log.Println("machine awake")}else {ifactivity.Type==notifier.Sleep {log.Println("machine sleeping")}}}}

Example

See examplehere

About

macOS Sleep/ Wake notifications in golang

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp