implemented more stuff along with samples

This commit is contained in:
2025-08-14 22:59:38 +02:00
parent a09b04ab7a
commit f5b0ee026f
26 changed files with 2768 additions and 12 deletions

View File

@@ -0,0 +1,44 @@
package main
/*
This example toggles the current terminal window's floating
state. Execute repeatedly to toggle between full and floating
state. Run this from a terminal window to see the effect.
*/
import (
"log"
"github.com/alecthomas/repr"
"github.com/tlinden/i3ipc"
)
func main() {
ipc := i3ipc.NewI3ipc()
err := ipc.Connect()
if err != nil {
log.Fatal(err)
}
// retrieve the sway tree
tree, err := ipc.GetTree()
if err != nil {
log.Fatal(err)
}
// find the data for the current window
focused := tree.FindFocused()
if focused == nil {
log.Fatal("no focused window found")
}
// finally execute the given commands on it, you can use any run
// command, see sway(5)
responses, err := ipc.RunCommand(focused.Id, "floating toggle, border toggle")
if err != nil {
repr.Println(responses)
log.Fatal(err)
}
}