summaryrefslogtreecommitdiff
path: root/sway/tree/root.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/tree/root.c')
-rw-r--r--sway/tree/root.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/sway/tree/root.c b/sway/tree/root.c
index 8934721f..636a3b75 100644
--- a/sway/tree/root.c
+++ b/sway/tree/root.c
@@ -55,6 +55,17 @@ void root_destroy(struct sway_root *root) {
free(root);
}
+/* Set minimized state from scratchpad container `show` state */
+static void root_scratchpad_set_minimize(struct sway_container *con, bool minimize) {
+ struct wlr_foreign_toplevel_handle_v1 *foreign_toplevel = con->view->foreign_toplevel;
+ if (wlr_surface_is_xwayland_surface(con->view->surface)) {
+ struct wlr_xwayland_surface *xsurface = wlr_xwayland_surface_from_wlr_surface(con->view->surface);
+ wlr_xwayland_surface_set_minimized(xsurface, minimize);
+ } else if (foreign_toplevel) {
+ wlr_foreign_toplevel_handle_v1_set_minimized(foreign_toplevel, minimize);
+ }
+}
+
void root_scratchpad_add_container(struct sway_container *con, struct sway_workspace *ws) {
if (!sway_assert(!con->scratchpad, "Container is already in scratchpad")) {
return;
@@ -96,6 +107,11 @@ void root_scratchpad_add_container(struct sway_container *con, struct sway_works
seat_set_focus(seat, new_focus);
}
+ // Set minimize state to minimized
+ if (config->scratchpad_minimize) {
+ root_scratchpad_set_minimize(con, true);
+ }
+
ipc_event_window(con, "move");
}
@@ -141,6 +157,11 @@ void root_scratchpad_show(struct sway_container *con) {
}
workspace_add_floating(new_ws, con);
+ // Set minimize state to normalized
+ if (config->scratchpad_minimize) {
+ root_scratchpad_set_minimize(con, false);
+ }
+
// Make sure the container's center point overlaps this workspace
double center_lx = con->pending.x + con->pending.width / 2;
double center_ly = con->pending.y + con->pending.height / 2;
@@ -172,6 +193,11 @@ void root_scratchpad_hide(struct sway_container *con) {
return;
}
+ // Set minimize state to minimized
+ if (config->scratchpad_minimize) {
+ root_scratchpad_set_minimize(con, true);
+ }
+
disable_fullscreen(con, NULL);
container_for_each_child(con, disable_fullscreen, NULL);
container_detach(con);