aboutsummaryrefslogtreecommitdiff
path: root/sway/commands/for_window.c
diff options
context:
space:
mode:
authorAshkan Kiani <ashkan.k.kiani@gmail.com>2019-07-26 12:30:04 -0700
committerSimon Ser <contact@emersion.fr>2019-07-27 03:53:05 +0300
commite4bba906b68b9347c085a7833f6dbc7ddb1a41b4 (patch)
treeb5291ecfd217807534a8fd537d6243a02ff2d34b /sway/commands/for_window.c
parent17c9a0e84f066f6ad1e7d93be0edf8e7bf3a59b7 (diff)
Avoid adding duplicate criteria for no_focus and command
Diffstat (limited to 'sway/commands/for_window.c')
-rw-r--r--sway/commands/for_window.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/sway/commands/for_window.c b/sway/commands/for_window.c
index 63cba099..ee9f4647 100644
--- a/sway/commands/for_window.c
+++ b/sway/commands/for_window.c
@@ -22,6 +22,14 @@ struct cmd_results *cmd_for_window(int argc, char **argv) {
criteria->type = CT_COMMAND;
criteria->cmdlist = join_args(argv + 1, argc - 1);
+ // Check if it already exists
+ if (criteria_already_exists(criteria)) {
+ sway_log(SWAY_DEBUG, "for_window already exists: '%s' -> '%s'",
+ criteria->raw, criteria->cmdlist);
+ criteria_destroy(criteria);
+ return cmd_results_new(CMD_SUCCESS, NULL);
+ }
+
list_add(config->criteria, criteria);
sway_log(SWAY_DEBUG, "for_window: '%s' -> '%s' added", criteria->raw, criteria->cmdlist);