diff --git a/README.md b/README.md index 921b315..1aa80c4 100644 --- a/README.md +++ b/README.md @@ -95,6 +95,7 @@ Description=Deckmaster Service # adjust the path to deckmaster and .deck file to suit your needs ExecStart=/usr/local/bin/deckmaster --deck path-to/some.deck Restart=on-failure +ExecReload=kill -HUP $MAINPID [Install] WantedBy=default.target diff --git a/main.go b/main.go index dfba332..1e0c40f 100644 --- a/main.go +++ b/main.go @@ -84,6 +84,9 @@ func eventLoop(dev *streamdeck.Device, tch chan interface{}) error { sigs := make(chan os.Signal, 1) signal.Notify(sigs, syscall.SIGINT, syscall.SIGTERM) + hup := make(chan os.Signal, 1) + signal.Notify(hup, syscall.SIGHUP) + var keyStates sync.Map keyTimestamps := make(map[uint8]time.Time) @@ -144,6 +147,14 @@ func eventLoop(dev *streamdeck.Device, tch chan interface{}) error { case err := <-shutdown: return err + case <-hup: + verbosef("Received SIGHUP, reloading configuration...") + deck, err = LoadDeck(dev, "", deck.File) + if err != nil { + return err + } + deck.updateWidgets() + case <-sigs: fmt.Println("Shutting down...") return nil