mirror of
https://codeberg.org/scip/swayipc.git
synced 2025-12-16 20:20:56 +01:00
some initial examples
This commit is contained in:
26
_examples/current_workspace/main.go
Normal file
26
_examples/current_workspace/main.go
Normal file
@@ -0,0 +1,26 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
"github.com/tlinden/i3ipc"
|
||||
)
|
||||
|
||||
func main() {
|
||||
ipc := i3ipc.NewI3ipc("SWAYSOCK")
|
||||
|
||||
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)
|
||||
}
|
||||
Reference in New Issue
Block a user