Do not resize/reposition floating containers when moving them to scratchpad
Patch status: merged
Patch by jj
To apply this patch, use:
curl http://cr.i3wm.org/patch/243/raw.patch | git am
b/src/scratchpad.c
| 15 |
@@ -66,7 +66,13 @@ void scratchpad_move(Con *con) {
|
| 16 |
* adjusted in size according to what the user specifies. */ |
| 17 |
if (con->scratchpad_state == SCRATCHPAD_NONE) {
|
| 18 |
DLOG("This window was never used as a scratchpad before.\n");
|
| 19 |
- con->scratchpad_state = SCRATCHPAD_FRESH; |
| 20 |
+ if (con == maybe_floating_con) {
|
| 21 |
+ DLOG("It was in floating mode before, set scratchpad state to changed.\n");
|
| 22 |
+ con->scratchpad_state = SCRATCHPAD_CHANGED; |
| 23 |
+ } else {
|
| 24 |
+ DLOG("It was in tiling mode before, set scratchpad state to fresh.\n");
|
| 25 |
+ con->scratchpad_state = SCRATCHPAD_FRESH; |
| 26 |
+ } |
| 27 |
} |
| 28 |
} |
| 29 |
|
b/testcases/t/185-scratchpad.t
| 34 |
@@ -446,4 +446,29 @@ is(get_focused($ws), $scratch, 'scratchpad is focused'); |
| 35 |
|
| 36 |
# TODO: make i3bar display *something* when a window on the scratchpad has the urgency hint |
| 37 |
|
| 38 |
+################################################################################ |
| 39 |
+# 14: Verify that 'move scratchpad' sends floating containers to scratchpad but |
| 40 |
+# does not resize/resposition the container on the next 'scratchpad show', i.e., |
| 41 |
+# i3 sets the scratchpad flag to SCRATCHPAD_CHANGED |
| 42 |
+################################################################################ |
| 43 |
+ |
| 44 |
+clear_scratchpad; |
| 45 |
+$tmp = fresh_workspace; |
| 46 |
+open_window; |
| 47 |
+ |
| 48 |
+($nodes, $focus) = get_ws_content($tmp); |
| 49 |
+is(scalar @$nodes, 1, 'precisely one window on current ws'); |
| 50 |
+is($nodes->[0]->{scratchpad_state}, 'none', 'scratchpad_state none');
|
| 51 |
+ |
| 52 |
+cmd 'floating toggle'; |
| 53 |
+cmd 'move scratchpad'; |
| 54 |
+ |
| 55 |
+$__i3_scratch = get_ws('__i3_scratch');
|
| 56 |
+@scratch_nodes = @{$__i3_scratch->{floating_nodes}};
|
| 57 |
+is(scalar @scratch_nodes, 1, '__i3_scratch contains our window'); |
| 58 |
+($nodes, $focus) = get_ws_content($tmp); |
| 59 |
+is(scalar @$nodes, 0, 'no window on current ws anymore'); |
| 60 |
+ |
| 61 |
+is($scratch_nodes[0]->{scratchpad_state}, 'changed', 'scratchpad_state changed');
|
| 62 |
+ |
| 63 |
done_testing; |