From 041e3540e8030c620d5185dba5ea5ba152a427d5 Mon Sep 17 00:00:00 2001 From: milarin Date: Sat, 7 Oct 2023 16:53:14 +0200 Subject: [PATCH] RunCommand implemented --- run_command.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 run_command.go diff --git a/run_command.go b/run_command.go new file mode 100644 index 0000000..769f33e --- /dev/null +++ b/run_command.go @@ -0,0 +1,16 @@ +package sway + +import ( + "context" + "os/exec" +) + +func RunCommand(ctx context.Context, command string) error { + cmd := exec.CommandContext(ctx, "swaymsg", command) + + if err := cmd.Start(); err != nil { + return err + } + + return cmd.Wait() +}