Merge pull request #2975 from RyanDwyer/deny-commands-when-no-outputs

Deny several commands when there's no outputs connected
This commit is contained in:
Drew DeVault 2018-10-25 17:10:36 +02:00 committed by GitHub
commit 51ad2676d0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 52 additions and 0 deletions

View file

@ -224,6 +224,10 @@ struct cmd_results *cmd_focus(int argc, char **argv) {
if (config->reading || !config->active) {
return cmd_results_new(CMD_DEFER, NULL, NULL);
}
if (!root->outputs->length) {
return cmd_results_new(CMD_INVALID, "focus",
"Can't run this command while there's no outputs connected.");
}
struct sway_node *node = config->handler_context.node;
struct sway_container *container = config->handler_context.container;
struct sway_workspace *workspace = config->handler_context.workspace;