Files
swayipc/_examples/current_workspace/main.go

27 lines
338 B
Go
Raw Normal View History

2025-08-14 14:16:17 +02:00
package main
import (
"fmt"
"log"
2025-11-10 20:59:46 +01:00
"codeberg.org/scip/swayipc/v1"
2025-08-14 14:16:17 +02:00
)
func main() {
2025-08-16 19:50:30 +02:00
ipc := swayipc.NewSwayIPC()
2025-08-14 14:16:17 +02:00
err := ipc.Connect()
if err != nil {
log.Fatal(err)
}
tree, err := ipc.GetTree()
if err != nil {
log.Fatal(err)
}
workspace := tree.FindCurrentWorkspace()
fmt.Printf("current workspace: %s\n", workspace)
}