2025-08-15 12:16:08 +02:00
|
|
|
package main
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
send a tick with an arbitrary payload, supply some argument to the
|
|
|
|
|
command, which will then be attached to the tick. Use the events
|
|
|
|
|
example to retrieve the tick (command out the Window event type to
|
|
|
|
|
better see it)
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"fmt"
|
|
|
|
|
"log"
|
|
|
|
|
"os"
|
|
|
|
|
|
2025-11-10 20:59:46 +01:00
|
|
|
"codeberg.org/scip/swayipc/v1"
|
2025-08-15 12:16:08 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
|
payload := "send_tick.go"
|
|
|
|
|
|
|
|
|
|
if len(os.Args) > 1 {
|
|
|
|
|
payload = os.Args[1]
|
|
|
|
|
}
|
|
|
|
|
|
2025-08-16 19:50:30 +02:00
|
|
|
ipc := swayipc.NewSwayIPC()
|
2025-08-15 12:16:08 +02:00
|
|
|
|
|
|
|
|
err := ipc.Connect()
|
|
|
|
|
if err != nil {
|
|
|
|
|
log.Fatal(err)
|
|
|
|
|
}
|
|
|
|
|
defer ipc.Close()
|
|
|
|
|
|
|
|
|
|
err = ipc.SendTick(payload)
|
|
|
|
|
if err != nil {
|
|
|
|
|
log.Fatal(err)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fmt.Printf("Sent tick with payload '%s'.\n", payload)
|
|
|
|
|
}
|