mirror of
https://github.com/swaywm/sway.git
synced 2025-11-01 22:58:41 -04:00
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:
parent
082488a81c
commit
cb66bbea42
9 changed files with 28 additions and 19 deletions
|
|
@ -4,6 +4,8 @@
|
|||
#include <wlr/util/edges.h>
|
||||
#include "config.h"
|
||||
|
||||
struct sway_container;
|
||||
|
||||
typedef struct cmd_results *sway_cmd(int argc, char **argv);
|
||||
|
||||
struct cmd_handler {
|
||||
|
|
@ -50,8 +52,13 @@ struct cmd_handler *find_handler(char *line, struct cmd_handler *cmd_handlers,
|
|||
int handlers_size);
|
||||
/**
|
||||
* Parse and executes a command.
|
||||
*
|
||||
* If the command string contains criteria then the command will be executed on
|
||||
* all matching containers. Otherwise, it'll run on the `con` container. If
|
||||
* `con` is NULL then it'll run on the currently focused container.
|
||||
*/
|
||||
struct cmd_results *execute_command(char *command, struct sway_seat *seat);
|
||||
struct cmd_results *execute_command(char *command, struct sway_seat *seat,
|
||||
struct sway_container *con);
|
||||
/**
|
||||
* Parse and handles a command during config file loading.
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue