aboutsummaryrefslogtreecommitdiff
path: root/sway/commands/swap.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/commands/swap.c')
-rw-r--r--sway/commands/swap.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/sway/commands/swap.c b/sway/commands/swap.c
index afe11a47..a70a6cdd 100644
--- a/sway/commands/swap.c
+++ b/sway/commands/swap.c
@@ -171,6 +171,10 @@ struct cmd_results *cmd_swap(int argc, char **argv) {
if ((error = checkarg(argc, "swap", EXPECTED_AT_LEAST, 4))) {
return error;
}
+ if (!root->outputs->length) {
+ return cmd_results_new(CMD_INVALID, "swap",
+ "Can't run this command while there's no outputs connected.");
+ }
if (strcasecmp(argv[0], "container") || strcasecmp(argv[1], "with")) {
return cmd_results_new(CMD_INVALID, "swap", EXPECTED_SYNTAX);