]> git.sur5r.net Git - i3/i3/commitdiff
bugfix: fix workspace back_and_forth after displaying a scratchpad window
authorMichael Stapelberg <michael@stapelberg.de>
Sat, 10 Nov 2012 08:01:04 +0000 (09:01 +0100)
committerMichael Stapelberg <michael@stapelberg.de>
Sat, 10 Nov 2012 08:01:04 +0000 (09:01 +0100)
fixes #868

src/workspace.c
testcases/t/176-workspace-baf.t

index 2b7b19e5e66bb8ecfbbc607525f7170935687b05..1e7071875cd97f186986723f193d2c6e9bba6fa6 100644 (file)
@@ -340,11 +340,16 @@ static void _workspace_show(Con *workspace) {
     /* Remember currently focused workspace for switching back to it later with
      * the 'workspace back_and_forth' command.
      * NOTE: We have to duplicate the name as the original will be freed when
-     * the corresponding workspace is cleaned up. */
-
-    FREE(previous_workspace_name);
-    if (current)
-        previous_workspace_name = sstrdup(current->name);
+     * the corresponding workspace is cleaned up.
+     * NOTE: Internal cons such as __i3_scratch (when a scratchpad window is
+     * focused) are skipped, see bug #868. */
+    if (current && !con_is_internal(current)) {
+        FREE(previous_workspace_name);
+        if (current) {
+            previous_workspace_name = sstrdup(current->name);
+            DLOG("Setting previous_workspace_name = %s\n", previous_workspace_name);
+        }
+    }
 
     workspace_reassign_sticky(workspace);
 
index 07c3c84a1e8fe8c016ad0e68bb7bf33c2a229921..659d469d1a31e062dc5fbe81b5bd4117b221fb91 100644 (file)
@@ -106,6 +106,23 @@ is(focused_ws, '6: baz', 'workspace 6 now focused');
 cmd 'workspace number 6';
 is(focused_ws, '5: foo', 'workspace 5 focused again');
 
+################################################################################
+# Place a window in the scratchpad, see if BAF works after showing the
+# scratchpad window.
+################################################################################
+
+my $scratchwin = open_window;
+cmd 'move scratchpad';
+
+# show scratchpad window
+cmd 'scratchpad show';
+
+# hide scratchpad window
+cmd 'scratchpad show';
+
+cmd 'workspace back_and_forth';
+is(focused_ws, '6: baz', 'workspace 6 now focused');
+
 exit_gracefully($pid);
 
 done_testing;