rename non-camel-case vars, refactor, satisfy linter

This commit is contained in:
2026-08-22 17:47:37 +02:00
parent 9e558e1f3c
commit d64f84c887
13 changed files with 220 additions and 206 deletions

View File

@@ -7,24 +7,26 @@ import (
"strings"
)
// Execute the specified global command[s] (one or more commands can be
// given) and returns a response list.
// RunGlobalCommand can be used to execute the specified global
// command[s] (one or more commands can be given) and returns a
// response list.
//
// Possible commands are all non-specific commands, see sway(5)
func (ipc *SwayIPC) RunGlobalCommand(command ...string) ([]Response, error) {
return ipc.RunCommand(0, "", command...)
}
// Execute the specified container command[s] (one or more commands can be
// given) and returns a response list.
// RunContainerCommand can be used to execute the specified container
// command[s] (one or more commands can be given) and returns a
// response list.
//
// Possible commands are all container-specific commands, see sway(5)
func (ipc *SwayIPC) RunContainerCommand(id int, command ...string) ([]Response, error) {
return ipc.RunCommand(id, "con", command...)
}
// Execute the specified (target) command[s] (one or more commands can be
// given) and returns a response list.
// RunCommand executes the specified (target) command[s] (one or more
// commands can be given) and returns a response list.
//
// Possible commands are all container-specific commands, see sway(5).
//
@@ -41,7 +43,7 @@ func (ipc *SwayIPC) RunCommand(id int, target string, command ...string) ([]Resp
commands = fmt.Sprintf("[%s_id=%d] %s", target, id, commands)
}
err := ipc.sendHeader(RUN_COMMAND, uint32(len(commands)))
err := ipc.sendHeader(MsgRunCommand, uint32(len(commands)))
if err != nil {
return nil, fmt.Errorf("failed to send run_command to IPC %w", err)
}