This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
// operation is a clean up function on shutting down | |
type operation func(ctx context.Context) error | |
// gracefulShutdown waits for termination syscalls and doing clean up operations after received it | |
func gracefulShutdown(ctx context.Context, timeout time.Duration, ops map[string]operation) <-chan struct{} { | |
wait := make(chan struct{}) | |
go func() { | |
s := make(chan os.Signal, 1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local hyper = { "cmd", "alt", "ctrl", "shift" } | |
hs.hotkey.bind(hyper, "0", function() | |
hs.reload() | |
end) | |
hs.notify.new({title="Hammerspoon", informativeText="Config loaded"}):send() | |
hs.hotkey.bind(hyper, "l", function() | |
hs.caffeinate.lockScreen() |