hlctl/panelctl/panel.go

38 lines
567 B
Go
Raw Normal View History

2023-01-07 16:56:15 +00:00
package panelctl
import (
"fmt"
"log"
"os"
"os/exec"
"sectorinf.com/emilis/hlctl/hlcl"
)
func Run() error {
screens, err := hlcl.ListMonitors()
if err != nil {
return err
}
panel := func(mon string) error {
return exec.Command(
"bash",
fmt.Sprintf(
"%s/.config/herbstluftwm/panel.sh",
os.Getenv("HOME"),
),
mon,
).Run()
}
for i := 1; i < len(screens); i++ {
id := screens[i].ID
go func() {
if err := panel(id); err != nil {
log.Fatalf("Monitor [%s] panel: %s", id, err)
}
}()
}
return panel(screens[0].ID)
}