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 ### Date
Show the time using given format and run `gnome-calendar` when clicked. Show the time using given format.
``` ```
[time] [time]

View file

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