From 633077b29620faef5fea95e876382da1571a2b14 Mon Sep 17 00:00:00 2001 From: koekeishiya Date: Sun, 28 Jul 2019 16:02:07 +0200 Subject: [PATCH] #162 ignore windows that report a main role of AXPopover --- CHANGELOG.md | 1 + src/event.c | 9 +++++++++ src/window.c | 11 +++++++++++ src/window.h | 1 + src/window_manager.c | 8 ++++++++ 5 files changed, 30 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index caf3f6f2..d5adade1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Resolve a potential multi-threaded issue due to "undefined behaviour" regarding x86 instruction ordering [#153](https://github.com/koekeishiya/yabai/issues/153) - Fix space padding and gap underflow when modified with a relative value [#141](https://github.com/koekeishiya/yabai/issues/141) - window_* signals no longer pass the application pid [#154](https://github.com/koekeishiya/yabai/issues/154) +- ignore all windows that report a main role of AXPopover [#162](https://github.com/koekeishiya/yabai/issues/162) ## [1.1.2] - 2019-07-15 ### Changed diff --git a/src/event.c b/src/event.c index 431fb292..0629cafa 100644 --- a/src/event.c +++ b/src/event.c @@ -417,6 +417,15 @@ static EVENT_CALLBACK(EVENT_HANDLER_WINDOW_CREATED) if (!application) return EVENT_FAILURE; struct window *window = window_create(application, CFRetain(context), window_id); + if (window_is_popover(window)) { + debug("%s: ignoring popover window %s %d\n", __FUNCTION__, window->application->name, window->id); + window_manager_make_children_floating(&g_window_manager, window, true); + window_manager_make_floating(&g_window_manager, window->id, true); + window_manager_remove_lost_focused_event(&g_window_manager, window->id); + window_destroy(window); + return EVENT_FAILURE; + } + window_manager_apply_rules_to_window(&g_space_manager, &g_window_manager, window); window_manager_set_window_opacity(&g_window_manager, window, g_window_manager.normal_window_opacity); window_manager_purify_window(&g_window_manager, window); diff --git a/src/window.c b/src/window.c index 5ac02e1f..d189af05 100644 --- a/src/window.c +++ b/src/window.c @@ -369,6 +369,17 @@ bool window_is_dialog(struct window *window) return standard_win; } +bool window_is_popover(struct window *window) +{ + CFStringRef role = window_role(window); + if (!role) return false; + + bool result = CFEqual(role, kAXPopoverRole); + CFRelease(role); + + return result; +} + struct window *window_create(struct application *application, AXUIElementRef window_ref, uint32_t window_id) { struct window *window = malloc(sizeof(struct window)); diff --git a/src/window.h b/src/window.h index 526bf3fb..f6b3c629 100644 --- a/src/window.h +++ b/src/window.h @@ -66,6 +66,7 @@ bool window_is_fullscreen(struct window *window); bool window_is_sticky(struct window *window); bool window_is_standard(struct window *window); bool window_is_dialog(struct window *window); +bool window_is_popover(struct window *window); bool window_observe(struct window *window); void window_unobserve(struct window *window); struct window *window_create(struct application *application, AXUIElementRef window_ref, uint32_t window_id); diff --git a/src/window_manager.c b/src/window_manager.c index b7084a50..6bc3191c 100644 --- a/src/window_manager.c +++ b/src/window_manager.c @@ -941,6 +941,14 @@ void window_manager_add_application_windows(struct space_manager *sm, struct win continue; } + if (window_is_popover(window)) { + debug("%s: ignoring popover window %s %d\n", __FUNCTION__, window->application->name, window->id); + window_manager_make_children_floating(wm, window, true); + window_manager_make_floating(wm, window->id, true); + window_destroy(window); + continue; + } + window_manager_apply_rules_to_window(sm, wm, window); window_manager_set_window_opacity(wm, window, wm->normal_window_opacity); window_manager_purify_window(wm, window);