Allow running commands on containers without focusing them

This adds a `con` argument to `execute_command` which allows you to
specify the container to execute the command on. In most cases it leaves
it as `NULL` which makes it use the focused node. We only set it when
executing `for_window` criteria such as when a view maps. This means we
don't send unnecessary IPC focus events, and fixes a crash when the
criteria command is `move scratchpad` (because we can't give focus to a
hidden scratchpad container).

Each of the shell map handlers now check to see if the view has a
workspace. It won't have a workspace if criteria has moved it to the
scratchpad.
This commit is contained in:
Ryan Dwyer 2018-09-23 08:38:15 +10:00
parent 082488a81c
commit cb66bbea42
9 changed files with 28 additions and 19 deletions

View file

@ -580,7 +580,7 @@ void ipc_client_handle_command(struct ipc_client *client) {
switch (client->current_command) {
case IPC_COMMAND:
{
struct cmd_results *results = execute_command(buf, NULL);
struct cmd_results *results = execute_command(buf, NULL, NULL);
transaction_commit_dirty();
char *json = cmd_results_to_json(results);
int length = strlen(json);