aboutsummaryrefslogtreecommitdiff
path: root/sway/commands
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2017-04-07 14:17:01 -0400
committerGitHub <noreply@github.com>2017-04-07 14:17:01 -0400
commit8d191b2785161a204c4df15aadeca66e306afa1c (patch)
treeb929def6e7bcdbff10a7f1cc815f9a278821c666 /sway/commands
parent4e12bf64ef946f25e602fd609b80349d100a86ed (diff)
parent154c6718c1f0e34e0f217150ba2770ee100e5b38 (diff)
Merge pull request #1155 from 4e554c4c/get_marks
Add `-t get_marks` and use more i3-like marks
Diffstat (limited to 'sway/commands')
-rw-r--r--sway/commands/mark.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/sway/commands/mark.c b/sway/commands/mark.c
index 919883b0..c1d959df 100644
--- a/sway/commands/mark.c
+++ b/sway/commands/mark.c
@@ -5,6 +5,15 @@
#include "list.h"
#include "stringop.h"
+static void find_marks_callback(swayc_t *container, void *_mark) {
+ char *mark = (char *)_mark;
+
+ int index;
+ if (container->marks && ((index = list_seq_find(container->marks, (int (*)(const void *, const void *))strcmp, mark)) != -1)) {
+ list_del(container->marks, index);
+ }
+}
+
struct cmd_results *cmd_mark(int argc, char **argv) {
struct cmd_results *error = NULL;
if (config->reading) return cmd_results_new(CMD_FAILURE, "mark", "Can't be used in config file.");
@@ -30,6 +39,10 @@ struct cmd_results *cmd_mark(int argc, char **argv) {
if (argc) {
char *mark = join_args(argv, argc);
+
+ // Remove all existing marks of this type
+ container_map(&root_container, find_marks_callback, mark);
+
if (view->marks) {
if (add) {
int index;