Skip to content

Commit

Permalink
examples/events: init
Browse files Browse the repository at this point in the history
  • Loading branch information
thiagokokada committed Aug 31, 2024
1 parent 2911f0f commit 775c0f5
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions examples/events/events.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// Basic example on how to handle events in hyprland-go.
package main

import (
"fmt"

"github.com/thiagokokada/hyprland-go/event"
)

type ev struct {
event.NoopEventHandler
}

func (e *ev) Workspace(w event.WorkspaceName) {
fmt.Printf("Workspace: %+v\n", w)
}

func (e *ev) ActiveWindow(w event.ActiveWindow) {
fmt.Printf("ActiveWindow: %+v\n", w)
}

func main() {
c := event.MustEventClient()
event.Subscribe(
c, &ev{},
event.EventWorkspace,
event.EventActiveWindow,
)

}

0 comments on commit 775c0f5

Please sign in to comment.