diff options
author | Ashkan Kiani <ashkan.k.kiani@gmail.com> | 2019-07-26 12:30:04 -0700 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2019-07-27 03:53:05 +0300 |
commit | e4bba906b68b9347c085a7833f6dbc7ddb1a41b4 (patch) | |
tree | b5291ecfd217807534a8fd537d6243a02ff2d34b /sway/commands/no_focus.c | |
parent | arrange: remove gaps for workspace location deltas (diff) | |
download | sway-e4bba906b68b9347c085a7833f6dbc7ddb1a41b4.tar.gz sway-e4bba906b68b9347c085a7833f6dbc7ddb1a41b4.tar.zst sway-e4bba906b68b9347c085a7833f6dbc7ddb1a41b4.zip |
Avoid adding duplicate criteria for no_focus and command
Diffstat (limited to 'sway/commands/no_focus.c')
-rw-r--r-- | sway/commands/no_focus.c | 9 |
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) { | |||
18 | return error; | 18 | return error; |
19 | } | 19 | } |
20 | 20 | ||
21 | |||
21 | criteria->type = CT_NO_FOCUS; | 22 | criteria->type = CT_NO_FOCUS; |
23 | |||
24 | // Check if it already exists | ||
25 | if (criteria_already_exists(criteria)) { | ||
26 | sway_log(SWAY_DEBUG, "no_focus already exists: '%s'", criteria->raw); | ||
27 | criteria_destroy(criteria); | ||
28 | return cmd_results_new(CMD_SUCCESS, NULL); | ||
29 | } | ||
30 | |||
22 | list_add(config->criteria, criteria); | 31 | list_add(config->criteria, criteria); |
23 | 32 | ||
24 | return cmd_results_new(CMD_SUCCESS, NULL); | 33 | return cmd_results_new(CMD_SUCCESS, NULL); |