renovate the code, update to go 1.26 and satisfy linter (#3)

This commit is contained in:
T. von Dein
2026-08-22 17:59:59 +02:00
parent 9cd6e4a6b9
commit 6d9763a0a9
77 changed files with 681 additions and 227 deletions

View File

@@ -0,0 +1,5 @@
all:
go build .
clean:
rm -f events

9
_examples/events/go.mod Normal file
View File

@@ -0,0 +1,9 @@
module send_tick
go 1.26
require github.com/alecthomas/repr v0.5.4 // indirect
replace codeberg.org/scip/swayipc/v2 => ../..
require codeberg.org/scip/swayipc/v2 v2.1.0

2
_examples/events/go.sum Normal file
View File

@@ -0,0 +1,2 @@
github.com/alecthomas/repr v0.5.4 h1:OVP7JEcuzU9CCDsT6STCr3rg17oQfWILtPWd2EG0uN4=
github.com/alecthomas/repr v0.5.4/go.mod h1:Fr0507jx4eOXV7AlPV6AVZLYrLIuIeSOWtW57eE/O/4=

View File

@@ -9,8 +9,8 @@ import (
"fmt"
"log"
"codeberg.org/scip/swayipc/v2"
"github.com/alecthomas/repr"
"codeberg.org/scip/swayipc/v1"
)
// Event callback function, needs to implement each subscribed events,
@@ -18,11 +18,11 @@ import (
func ProcessTick(event *swayipc.RawResponse) error {
var err error
switch event.PayloadType {
case swayipc.EV_Tick:
case swayipc.EvTick:
ev := &swayipc.EventTick{}
err = json.Unmarshal(event.Payload, &ev)
repr.Println(ev)
case swayipc.EV_Window:
case swayipc.EvWindow:
ev := &swayipc.EventWindow{}
err = json.Unmarshal(event.Payload, &ev)
repr.Println(ev)