From f358112c7eae3006761f6ec4337ce29105acda2e Mon Sep 17 00:00:00 2001 From: Milarin Date: Mon, 26 Aug 2024 21:53:37 +0200 Subject: [PATCH] added WaitForDefaultClient --- get_clients.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/get_clients.go b/get_clients.go index 3764c63..4c42986 100644 --- a/get_clients.go +++ b/get_clients.go @@ -70,6 +70,15 @@ func GetClients() ([]*Client, error) { return clients, nil } +func WaitForDefaultClient(ctx context.Context) (*Client, error) { + signature, ok := os.LookupEnv("HYPRLAND_INSTANCE_SIGNATURE") + if !ok { + return nil, errors.New("default instance not found because HYPRLAND_INSTANCE_SIGNATURE is not set") + } + + return WaitForClient(ctx, signature) +} + func WaitForClient(ctx context.Context, signature string) (*Client, error) { lockFilePath := fmt.Sprintf("/run/user/1000/hypr/%s/hyprland.lock", signature)