diff options
author | Ashkan Kiani <ashkan.k.kiani@gmail.com> | 2019-04-12 00:54:09 -0700 |
---|---|---|
committer | Brian Ashworth <bosrsf04@gmail.com> | 2019-04-12 16:52:24 -0400 |
commit | 27f51360b7cabc990258544ed6a74013db76e9df (patch) | |
tree | 3f0bdef967f91c865d5df2586c17803f96b30c63 /sway/tree | |
parent | 090e1015812e8b26d008fb570152804b506b48f7 (diff) |
Fix scratchpad logic for floating windows
When a tiled window is sent to the scratchpad, we want to use sane
defaults, which is to center it and resize it to the default.
For floating windows, we want to use their existing geometry.
Diffstat (limited to 'sway/tree')
-rw-r--r-- | sway/tree/root.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/sway/tree/root.c b/sway/tree/root.c index c7c5e1df..a9d306a4 100644 --- a/sway/tree/root.c +++ b/sway/tree/root.c @@ -61,9 +61,14 @@ void root_scratchpad_add_container(struct sway_container *con) { struct sway_container *parent = con->parent; struct sway_workspace *workspace = con->workspace; - container_set_floating(con, true); - container_floating_set_default_size(con); - container_floating_move_to_center(con); + + // When a tiled window is sent to scratchpad, center and resize it. + if (!container_is_floating(con)) { + container_set_floating(con, true); + container_floating_set_default_size(con); + container_floating_move_to_center(con); + } + container_detach(con); con->scratchpad = true; list_add(root->scratchpad, con); |