package main import ( "fmt" "github.com/atotto/clipboard" r "gitnet.fr/deblan/i3-blocks-go/rendering" "io" "net/http" "os" ) func main() { resp, err := http.Get("https://api.ipify.org/") if err != nil { return } defer resp.Body.Close() ip, _ := io.ReadAll(resp.Body) label := r.TextWithPadding( "wan", r.FB{ Foreground: r.Color("grey"), Background: r.Color("black2"), }, ) if os.Getenv("BLOCK_BUTTON") == "1" { clipboard.WriteAll(string(ip)) } value := r.TextWithPadding(string(ip), r.FB{}) options := r.NewBlockOptions() options.FullText = fmt.Sprintf("%s%s", label, value) block := r.Block("ip_wan", options) fmt.Println(block) }