aboutsummaryrefslogtreecommitdiffstats
path: root/include/sway/commands.h
diff options
context:
space:
mode:
authorLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-09-23 08:38:15 +1000
committerLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-09-23 08:39:11 +1000
commitcb66bbea42adeabd7bd87132a66589e14a46940f (patch)
tree43f409e1619b2deded320f0af7064e73e3969d30 /include/sway/commands.h
parentMerge pull request #2677 from ggreer/pretty-fonts (diff)
downloadsway-cb66bbea42adeabd7bd87132a66589e14a46940f.tar.gz
sway-cb66bbea42adeabd7bd87132a66589e14a46940f.tar.zst
sway-cb66bbea42adeabd7bd87132a66589e14a46940f.zip
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.
Diffstat (limited to 'include/sway/commands.h')
-rw-r--r--include/sway/commands.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/include/sway/commands.h b/include/sway/commands.h
index 226cf932..1654eb48 100644
--- a/include/sway/commands.h
+++ b/include/sway/commands.h
@@ -4,6 +4,8 @@
4#include <wlr/util/edges.h> 4#include <wlr/util/edges.h>
5#include "config.h" 5#include "config.h"
6 6
7struct sway_container;
8
7typedef struct cmd_results *sway_cmd(int argc, char **argv); 9typedef struct cmd_results *sway_cmd(int argc, char **argv);
8 10
9struct cmd_handler { 11struct cmd_handler {
@@ -50,8 +52,13 @@ struct cmd_handler *find_handler(char *line, struct cmd_handler *cmd_handlers,
50 int handlers_size); 52 int handlers_size);
51/** 53/**
52 * Parse and executes a command. 54 * Parse and executes a command.
55 *
56 * If the command string contains criteria then the command will be executed on
57 * all matching containers. Otherwise, it'll run on the `con` container. If
58 * `con` is NULL then it'll run on the currently focused container.
53 */ 59 */
54struct cmd_results *execute_command(char *command, struct sway_seat *seat); 60struct cmd_results *execute_command(char *command, struct sway_seat *seat,
61 struct sway_container *con);
55/** 62/**
56 * Parse and handles a command during config file loading. 63 * Parse and handles a command during config file loading.
57 * 64 *