aboutsummaryrefslogtreecommitdiffstats
path: root/sway/commands/focus.c
diff options
context:
space:
mode:
authorLibravatar Ian Fan <ianfan0@gmail.com>2018-08-12 15:40:24 +0100
committerLibravatar Ian Fan <ianfan0@gmail.com>2018-08-18 17:25:06 +0100
commitb3f7801fca21dc792020a407050ae993615c293d (patch)
tree912dc469ea3b1da429e8418fde5e9cafafa2c5a5 /sway/commands/focus.c
parentcommands: complete assign command (diff)
downloadsway-b3f7801fca21dc792020a407050ae993615c293d.tar.gz
sway-b3f7801fca21dc792020a407050ae993615c293d.tar.zst
sway-b3f7801fca21dc792020a407050ae993615c293d.zip
commands: prevent focusing mode with no containers
Explicitly fail when trying to focus tiling/floating when there are no tiling/floating containers.
Diffstat (limited to 'sway/commands/focus.c')
-rw-r--r--sway/commands/focus.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/sway/commands/focus.c b/sway/commands/focus.c
index 135a2908..fe15b4c7 100644
--- a/sway/commands/focus.c
+++ b/sway/commands/focus.c
@@ -52,6 +52,10 @@ static struct cmd_results *focus_mode(struct sway_container *con,
52 } 52 }
53 if (new_focus) { 53 if (new_focus) {
54 seat_set_focus(seat, new_focus); 54 seat_set_focus(seat, new_focus);
55 } else {
56 return cmd_results_new(CMD_FAILURE, "focus",
57 "Failed to find a %s container in workspace",
58 floating ? "floating" : "tiling");
55 } 59 }
56 return cmd_results_new(CMD_SUCCESS, NULL, NULL); 60 return cmd_results_new(CMD_SUCCESS, NULL, NULL);
57} 61}