fix command runner
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
Simon Vieille 2022-08-28 20:56:31 +02:00
parent ab4d7c98fa
commit f384772e81
Signed by: deblan
GPG key ID: 579388D585F70417
2 changed files with 25 additions and 4 deletions

View file

@ -5,12 +5,21 @@ import (
r "gitnet.fr/deblan/i3-blocks-go/rendering"
"os"
"os/exec"
"sync"
)
func runCmd(wg *sync.WaitGroup, value string) {
defer wg.Done()
command := exec.Command("tmux", "new", "-d", value)
command.Run()
}
func main() {
var wg sync.WaitGroup
if os.Getenv("BLOCK_BUTTON") == "1" {
command := exec.Command("bash", "-c", os.Args[5])
command.Run()
wg.Add(1)
go runCmd(&wg, os.Args[5])
}
options := r.NewBlockOptions()
@ -20,6 +29,6 @@ func main() {
})
block := r.Block(os.Args[1], options)
fmt.Println(block)
wg.Wait()
}

View file

@ -6,14 +6,26 @@ import (
"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 := os.Args[1]
now := time.Now()
var wg sync.WaitGroup
if os.Getenv("BLOCK_BUTTON") == "1" {
wg.Add(1)
go runCalendar(&wg)
}
symbol := r.Emoji(emoji.Calendar)
@ -26,6 +38,6 @@ func main() {
})
block := r.Block("date", options)
fmt.Println(block)
wg.Wait()
}