return;
}
+ /* If the current con is in fullscreen mode, we need to disable that,
+ * as a scratchpad window should never be in fullscreen mode */
+ if (focused && focused->type != CT_WORKSPACE && focused->fullscreen_mode != CF_NONE) {
+ con_toggle_fullscreen(focused, CF_OUTPUT);
+ }
+
/* 1: Ensure the window or any parent is floating. From now on, we deal
* with the CT_FLOATING_CON. We use automatic == false because the user
* made the choice that this window should be a scratchpad (and floating).
* adjusted in size according to what the user specifies. */
if (con->scratchpad_state == SCRATCHPAD_NONE) {
DLOG("This window was never used as a scratchpad before.\n");
- con->scratchpad_state = SCRATCHPAD_FRESH;
+ if (con == maybe_floating_con) {
+ DLOG("It was in floating mode before, set scratchpad state to changed.\n");
+ con->scratchpad_state = SCRATCHPAD_CHANGED;
+ } else {
+ DLOG("It was in tiling mode before, set scratchpad state to fresh.\n");
+ con->scratchpad_state = SCRATCHPAD_FRESH;
+ }
}
}
Con *__i3_scratch = workspace_get("__i3_scratch", NULL);
Con *floating;
- /* If the current con or any of its parents are in fullscreen mode, we
- * first need to disable it before showing the scratchpad con. */
- Con *fs = focused;
- while (fs && fs->fullscreen_mode == CF_NONE)
- fs = fs->parent;
-
- if (fs->type != CT_WORKSPACE) {
- con_toggle_fullscreen(focused, CF_OUTPUT);
- }
-
/* If this was 'scratchpad show' without criteria, we check if the
* currently focused window is a scratchpad window and should be hidden
* again. */
return;
}
+ /* If the current con or any of its parents are in fullscreen mode, we
+ * first need to disable it before showing the scratchpad con. */
+ Con *fs = focused;
+ while (fs && fs->fullscreen_mode == CF_NONE)
+ fs = fs->parent;
+
+ if (fs && fs->type != CT_WORKSPACE) {
+ con_toggle_fullscreen(fs, CF_OUTPUT);
+ }
+
/* If this was 'scratchpad show' without criteria, we check if there is a
* unfocused scratchpad on the current workspace and focus it */
Con *walk_con;
LOG("Use 'move scratchpad' to move a window to the scratchpad.\n");
return;
}
+ } else {
+ /* We used a criterion, so we need to do what follows (moving,
+ * resizing) on the floating parent. */
+ con = con_inside_floating(con);
}
/* 1: Move the window from __i3_scratch to the current workspace. */