package main import ( "fmt" r "gitnet.fr/deblan/i3-blocks-go/rendering" "io" "net/http" "os" "os/exec" "strings" "sync" ) type Telemetry struct { Progress int `json:"progress"` TempNozzle int `json:"temp_nozzle"` TempBed int `json:"temp_bed"` TimeEst string `json:"time_est"` } func openBrowser(wg *sync.WaitGroup, url string) { defer wg.Done() command := exec.Command("tmux", "new", "-d", "xdg-open", url) command.Run() } func main() { var wg sync.WaitGroup if os.Getenv("BLOCK_BUTTON") == "1" { wg.Add(1) go openBrowser(&wg, os.Args[3]) } resp, err := http.Get(os.Args[2]) if err != nil { return } defer resp.Body.Close() body, _ := io.ReadAll(resp.Body) content := string(body) count := strings.Count(content, " 0 { label = fmt.Sprintf("%s +%d", label, count) fb.Foreground = os.Args[5] } options := r.NewBlockOptions() options.FullText = r.TextWithPadding(label, fb) block := r.Block(os.Args[1], options) fmt.Println(block) wg.Wait() }