hypr/execute_command.go

22 lines
317 B
Go
Raw Normal View History

2024-01-19 13:20:41 +01:00
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
}