]> git.lizzy.rs Git - bspwm.git/commitdiff
Optional desktop name for list_history
authorBastien Dejean <nihilhill@gmail.com>
Sun, 3 Mar 2013 12:10:52 +0000 (13:10 +0100)
committerBastien Dejean <nihilhill@gmail.com>
Sun, 3 Mar 2013 12:10:52 +0000 (13:10 +0100)
README.md
messages.c
types.c

index 5564bf3bcb4c70d575bf4d7c1e209878634a37d3..514de5596606454ed6806ab15428f5168313f4c6 100644 (file)
--- a/README.md
+++ b/README.md
@@ -87,6 +87,8 @@ The following messages are handled:
 
 - `list_monitors [--quiet]` — Perform a dump of each monitor.
 
+- `list_history [DESKTOP_NAME]` — Return the node focus history.
+
 - `list_windows` — Return the list of managed windows (i.e. their identifiers).
 
 - `list_rules` — Return the list of rules.
index 8e32e2441e12ca0c65072032a0b881f43cb46362..cf3acd6155297489fbdb013a0c244125dd0a2221 100644 (file)
@@ -55,7 +55,15 @@ void process_message(char *msg, char *rsp)
         list_windows(rsp);
         return;
     } else if (strcmp(cmd, "list_history") == 0) {
-        list_history(mon->desk, rsp);
+        char *name = strtok(NULL, TOK_SEP);
+        if (name != NULL) {
+            desktop_location_t loc;
+            if (locate_desktop(name, &loc))
+                list_history(loc.desktop, rsp);
+        } else {
+            list_history(mon->desk, rsp);
+        }
+        return;
     } else if (strcmp(cmd, "list_rules") == 0) {
         list_rules(rsp);
         return;
diff --git a/types.c b/types.c
index 2a1d6d56c05223dbb16d077218e26ae016f77330..50213dfa9dd333990ffb21bd6b21b7710cbe149b 100644 (file)
--- a/types.c
+++ b/types.c
@@ -204,6 +204,8 @@ void history_remove(focus_history_t *f, node_t *n)
             if (a != NULL) {
                 while (c != NULL && (c->node == a->node || c->node == n)) {
                     node_list_t *d = c->next;
+                    if (f->tail == c)
+                        f->tail = (d == NULL ? b : d);
                     free(c);
                     c = d;
                 }