summaryrefslogtreecommitdiff
path: root/sway/commands/no_focus.c
diff options
context:
space:
mode:
authorAshkan Kiani <[email protected]>2019-07-26 12:30:04 -0700
committerSimon Ser <[email protected]>2019-07-27 03:53:05 +0300
commite4bba906b68b9347c085a7833f6dbc7ddb1a41b4 (patch)
treeb5291ecfd217807534a8fd537d6243a02ff2d34b /sway/commands/no_focus.c
parent17c9a0e84f066f6ad1e7d93be0edf8e7bf3a59b7 (diff)
Avoid adding duplicate criteria for no_focus and command
Diffstat (limited to 'sway/commands/no_focus.c')
-rw-r--r--sway/commands/no_focus.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/sway/commands/no_focus.c b/sway/commands/no_focus.c
index 07e824a1..2001e04f 100644
--- a/sway/commands/no_focus.c
+++ b/sway/commands/no_focus.c
@@ -18,7 +18,16 @@ struct cmd_results *cmd_no_focus(int argc, char **argv) {
return error;
}
+
criteria->type = CT_NO_FOCUS;
+
+ // Check if it already exists
+ if (criteria_already_exists(criteria)) {
+ sway_log(SWAY_DEBUG, "no_focus already exists: '%s'", criteria->raw);
+ criteria_destroy(criteria);
+ return cmd_results_new(CMD_SUCCESS, NULL);
+ }
+
list_add(config->criteria, criteria);
return cmd_results_new(CMD_SUCCESS, NULL);