]> git.sur5r.net Git - i3/i3/blobdiff - src/scratchpad.c
Merge branch 'next' into master
[i3/i3] / src / scratchpad.c
index 95154014c729a655a40b4ab9be49dd42f815eedf..d564bf3208e1ac7768522db2c9ca9a09295a0a44 100644 (file)
@@ -84,7 +84,7 @@ void scratchpad_move(Con *con) {
  * can press the same key to quickly look something up).
  *
  */
-void scratchpad_show(Con *con) {
+bool scratchpad_show(Con *con) {
     DLOG("should show scratchpad window %p\n", con);
     Con *__i3_scratch = workspace_get("__i3_scratch", NULL);
     Con *floating;
@@ -97,7 +97,7 @@ void scratchpad_show(Con *con) {
         floating->scratchpad_state != SCRATCHPAD_NONE) {
         DLOG("Focused window is a scratchpad window, hiding it.\n");
         scratchpad_move(focused);
-        return;
+        return true;
     }
 
     /* If the current con or any of its parents are in fullscreen mode, we
@@ -124,7 +124,7 @@ void scratchpad_show(Con *con) {
                  * window inside this scratch container in order to
                  * keep the focus the same within this container */
             con_activate(con_descend_tiling_focused(walk_con));
-            return;
+            return true;
         }
     }
 
@@ -141,7 +141,8 @@ void scratchpad_show(Con *con) {
             DLOG("Found a visible scratchpad window on another workspace,\n");
             DLOG("moving it to this workspace: con = %p\n", walk_con);
             con_move_to_workspace(walk_con, focused_ws, true, false, false);
-            return;
+            con_activate(con_descend_focused(walk_con));
+            return true;
         }
     }
 
@@ -149,7 +150,7 @@ void scratchpad_show(Con *con) {
      * is actually in the scratchpad */
     if (con && con->parent->scratchpad_state == SCRATCHPAD_NONE) {
         DLOG("Window is not in the scratchpad, doing nothing.\n");
-        return;
+        return false;
     }
 
     /* If this was 'scratchpad show' with criteria, we check if it matches a
@@ -165,7 +166,7 @@ void scratchpad_show(Con *con) {
         if (current == active) {
             DLOG("Window is a scratchpad window, hiding it.\n");
             scratchpad_move(con);
-            return;
+            return true;
         }
     }
 
@@ -178,7 +179,7 @@ void scratchpad_show(Con *con) {
         if (!con) {
             LOG("You don't have any scratchpad windows yet.\n");
             LOG("Use 'move scratchpad' to move a window to the scratchpad.\n");
-            return;
+            return false;
         }
     } else {
         /* We used a criterion, so we need to do what follows (moving,
@@ -206,6 +207,8 @@ void scratchpad_show(Con *con) {
     }
 
     con_activate(con_descend_focused(con));
+
+    return true;
 }
 
 /*