added WaitForDefaultClient

This commit is contained in:
Milarin 2024-08-26 21:53:37 +02:00
parent 8c1df2310c
commit f358112c7e

View File

@ -70,6 +70,15 @@ func GetClients() ([]*Client, error) {
return clients, nil 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) { func WaitForClient(ctx context.Context, signature string) (*Client, error) {
lockFilePath := fmt.Sprintf("/run/user/1000/hypr/%s/hyprland.lock", signature) lockFilePath := fmt.Sprintf("/run/user/1000/hypr/%s/hyprland.lock", signature)