summaryrefslogtreecommitdiff
path: root/sway/desktop/xwayland.c
diff options
context:
space:
mode:
authorErik Reider <[email protected]>2023-03-26 17:44:21 +0200
committerGitHub <[email protected]>2023-03-26 11:44:21 -0400
commitf2d29ceb6b831a07ce2bce4534fe6fec1f16eee3 (patch)
treed90b5fd546d6f55c7be7d0af43863f8f9262b4db /sway/desktop/xwayland.c
parent7d5d7a3022eb17835cea7af7290b1a5d2fe4b03a (diff)
Extend minimize logic to work with XWayland and XDG applications (#132)
* Extend minimize logic * Removed redundant xwayland minimize logic * minor fixes * Fixed not properly checking if window is ran though XWayland * Added config option with default being off * Set scratchpad_minimize to true by default * Improve config dependant logic * Switch to using enable|disable instead of on|off
Diffstat (limited to 'sway/desktop/xwayland.c')
-rw-r--r--sway/desktop/xwayland.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/sway/desktop/xwayland.c b/sway/desktop/xwayland.c
index e15a3341..55a14c0b 100644
--- a/sway/desktop/xwayland.c
+++ b/sway/desktop/xwayland.c
@@ -575,6 +575,7 @@ static void handle_request_fullscreen(struct wl_listener *listener, void *data)
transaction_commit_dirty();
}
+/* Minimize to scratchpad */
static void handle_request_minimize(struct wl_listener *listener, void *data) {
struct sway_xwayland_view *xwayland_view =
wl_container_of(listener, xwayland_view, request_minimize);
@@ -585,6 +586,27 @@ static void handle_request_minimize(struct wl_listener *listener, void *data) {
}
struct wlr_xwayland_minimize_event *e = data;
+ if (config->scratchpad_minimize) {
+ struct sway_container *container = view->container;
+ if (!container->pending.workspace) {
+ while (container->pending.parent) {
+ container = container->pending.parent;
+ }
+ }
+ if(e->minimize) {
+ if (!container->scratchpad) {
+ root_scratchpad_add_container(container, NULL);
+ } else if (container->pending.workspace) {
+ root_scratchpad_hide(container);
+ }
+ } else {
+ if(container->scratchpad) {
+ root_scratchpad_show(container);
+ }
+ }
+ transaction_commit_dirty();
+ return;
+ }
struct sway_seat *seat = input_manager_current_seat();
bool focused = seat_get_focus(seat) == &view->container->node;
wlr_xwayland_surface_set_minimized(xsurface, !focused && e->minimize);