update readme

This commit is contained in:
Simon Vieille 2022-08-30 19:58:02 +02:00
parent 42b76dd78d
commit f1771fe367
Signed by: deblan
GPG Key ID: 579388D585F70417
2 changed files with 2 additions and 20 deletions

View File

@ -55,7 +55,7 @@ interval=1000
### Date
Show the time using given format and run `gnome-calendar` when clicked.
Show the time using given format.
```
[time]

View File

@ -6,32 +6,16 @@ import (
"github.com/enescakir/emoji"
"github.com/itchyny/timefmt-go"
r "gitnet.fr/deblan/i3-blocks-go/rendering"
"os"
"os/exec"
"sync"
"time"
)
func runCalendar(wg *sync.WaitGroup) {
defer wg.Done()
command := exec.Command("tmux", "new", "-d", "gnome-calendar")
command.Run()
}
func main() {
argFormat := flag.String("format", "%H:%M:%S %m-%d-%Y", "time format")
flag.Parse()
var wg sync.WaitGroup
symbol := string(emoji.Calendar)
for {
now := time.Now()
if os.Getenv("BLOCK_BUTTON") == "1" {
wg.Add(1)
go runCalendar(&wg)
}
symbol := string(emoji.Calendar)
date := timefmt.Format(now, *argFormat)
options := r.NewBlockOptions()
@ -44,6 +28,4 @@ func main() {
fmt.Println(block)
time.Sleep(time.Millisecond * 500)
}
wg.Wait()
}