38 lines
567 B
Go
38 lines
567 B
Go
|
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)
|
||
|
}
|