From a1fd252e2ab9ce3a8c69655791b0b0bb86862532 Mon Sep 17 00:00:00 2001 From: Kevin Lyda <kevin@lyda.ie> Date: Sat, 26 Nov 2022 20:42:37 +0000 Subject: [PATCH] Get the correct signal numbers. --- bar/run.go | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/bar/run.go b/bar/run.go index fde399d..8b3d7f9 100644 --- a/bar/run.go +++ b/bar/run.go @@ -4,12 +4,29 @@ package bar import ( "fmt" + "time" "github.com/spf13/cobra" + "golang.org/x/sys/unix" ) // Run is essentially the main program. func Run(cmd *cobra.Command, args []string) { fmt.Println(`{"version":1}`) - fmt.Println(`{ "version": 1, "stop_signal": 10, "cont_signal": 12, "click_events": true }`) + fmt.Printf(`{ "version": 1, "stop_signal": %d, "cont_signal": %d, "click_events": true }`+"\n", + unix.SignalNum("SIGSTOP"), unix.SignalNum("SIGCONT")) + fmt.Println("[") + for { + fmt.Printf(` [ + { + "full_text": "RED", + "color": "#ff1111" + }, + { + "full_text": "default" + } + ], +`) + time.Sleep(5 * time.Second) + } } -- GitLab