Execute function implemented

This commit is contained in:
milarin 2024-01-19 13:20:41 +01:00 committed by Milarin
parent f9990e1097
commit 399d484f6e

21
execute_command.go Normal file
View File

@ -0,0 +1,21 @@
package hypr
import (
"fmt"
"net"
"os"
)
func Execute(cmd string) error {
conn, err := net.Dial("unix", os.ExpandEnv("/tmp/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock"))
if err != nil {
return err
}
defer conn.Close()
if _, err := fmt.Fprintln(conn, cmd); err != nil {
return err
}
return nil
}