38 lines
618 B
Go
38 lines
618 B
Go
|
package main
|
||
|
|
||
|
import (
|
||
|
"log"
|
||
|
"go.i3wm.org/i3/v4"
|
||
|
)
|
||
|
|
||
|
func runOrLog(cmd string) []i3.CommandResult {
|
||
|
res, err := i3.RunCommand(cmd)
|
||
|
if err != nil {
|
||
|
log.Fatal(err)
|
||
|
}
|
||
|
|
||
|
return res
|
||
|
}
|
||
|
|
||
|
func main() {
|
||
|
outputs, err := i3.GetOutputs()
|
||
|
if err != nil {
|
||
|
log.Fatal(err)
|
||
|
}
|
||
|
|
||
|
activeWorkspaces := make([]string, 0, 2)
|
||
|
|
||
|
for _, o := range outputs {
|
||
|
if o.Active {
|
||
|
activeWorkspaces = append(activeWorkspaces, o.CurrentWorkspace)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
runOrLog("workspace " + activeWorkspaces[0])
|
||
|
runOrLog("move workspace to output right")
|
||
|
|
||
|
runOrLog("workspace " + activeWorkspaces[1])
|
||
|
runOrLog("move workspace to output right")
|
||
|
|
||
|
}
|