diff --git a/event/event.go b/event/event.go index 1603dd4..07150f6 100644 --- a/event/event.go +++ b/event/event.go @@ -20,15 +20,15 @@ const ( // automatically find the proper socket to connect and use the // HYPRLAND_INSTANCE_SIGNATURE for the current user. // If you need to connect to arbitrary user instances or need a method that -// will not panic on error, use [NewEventClient] instead. -func MustEventClient() *EventClient { - return assert.Must1(NewEventClient(helpers.MustSocket(".socket2.sock"))) +// will not panic on error, use [NewClient] instead. +func MustClient() *EventClient { + return assert.Must1(NewClient(helpers.MustSocket(".socket2.sock"))) } // Initiate a new event client. // Receive as parameters a socket that is generally localised in // '$XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock'. -func NewEventClient(socket string) (*EventClient, error) { +func NewClient(socket string) (*EventClient, error) { conn, err := net.Dial("unix", socket) if err != nil { return nil, fmt.Errorf("error while connecting to socket: %w", err) diff --git a/event/event_test.go b/event/event_test.go index 85170d7..e747966 100644 --- a/event/event_test.go +++ b/event/event_test.go @@ -31,7 +31,8 @@ func TestReceive(t *testing.T) { }() // We must capture this event - c := MustEventClient() + c := MustClient() + defer c.Close() data, err := c.Receive() assert.NoError(t, err)