update readme
This commit is contained in:
parent
42b76dd78d
commit
f1771fe367
|
@ -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]
|
||||
|
|
|
@ -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()
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue