Skip to content

Commit

Permalink
event/event: MustEventClient() -> MustClient, NewEventClient() -> New…
Browse files Browse the repository at this point in the history
…Client
  • Loading branch information
thiagokokada committed Aug 31, 2024
1 parent 98eba7e commit 9ed06b1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
8 changes: 4 additions & 4 deletions event/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion event/event_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 9ed06b1

Please sign in to comment.