Popularity
1.1
Growing
Activity
0.0
Stable
7
2
1

Programming language: Go
License: MIT License
Tags: GUI    
Latest version: v1.0.1

mac-sleep-notifier alternatives and similar packages

Based on the "GUI" category.
Alternatively, view mac-sleep-notifier alternatives based on common mentions on social networks and blogs.

Do you think we are missing an alternative of mac-sleep-notifier or a related project?

Add another 'GUI' Package

README

Mentioned in Awesome Go Go Report Card codecov version godoc-badge

macOS Sleep/ Wake notifications in golang

Inspired from this blog.

This 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.

Installation

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

Usage

notifierCh := notifier.GetInstance().Start()

for {
    select {
    case activity := <-notifierCh:
        if activity.Type == notifier.Awake {
            log.Println("machine awake")
        } else {
            if activity.Type == notifier.Sleep {
                log.Println("machine sleeping")
            }
        }
    }
}

Example

See example here