From a00525a6ded7772ba480b0999a980415ab107e41 Mon Sep 17 00:00:00 2001 From: Victor Kareh Date: Fri, 14 Feb 2020 09:31:31 -0500 Subject: [PATCH] Ignore dock and desktop windows Fixed logic that determines whether the window in focus is the desktop by using the window type from WNCK. Also added the Dock type to avoid showing mate-menu and mate-panel, since activating them has undefined behavior. --- window-buttons-applet/window-buttons-applet.vala | 8 ++++++-- window-menu-applet/window-menu-applet.vala | 8 ++++++-- window-title-applet/window-title-applet.vala | 8 ++++++-- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/window-buttons-applet/window-buttons-applet.vala b/window-buttons-applet/window-buttons-applet.vala index 94bdf93..88cce36 100644 --- a/window-buttons-applet/window-buttons-applet.vala +++ b/window-buttons-applet/window-buttons-applet.vala @@ -218,13 +218,17 @@ namespace WindowButtonsApplet{ private Wnck.Window get_current_window(){ Wnck.Window* win = null; + Wnck.WindowType window_type; string behaviour = gsettings.get_string("behaviour"); switch(behaviour){ case "active-always": win = Wnck.Screen.get_default().get_active_window(); - if(win != null && win->get_class_instance_name() == "desktop_window") - win = null; + if(win != null){ + window_type = win->get_window_type(); + if(window_type == Wnck.WindowType.DESKTOP || window_type == Wnck.WindowType.DOCK) + win = null; + } break; case "active-maximized": win = Wnck.Screen.get_default().get_active_window(); diff --git a/window-menu-applet/window-menu-applet.vala b/window-menu-applet/window-menu-applet.vala index b8531ad..4c834e1 100644 --- a/window-menu-applet/window-menu-applet.vala +++ b/window-menu-applet/window-menu-applet.vala @@ -76,13 +76,17 @@ namespace WindowMenuApplet{ private Wnck.Window get_current_window(){ Wnck.Window* win = null; + Wnck.WindowType window_type; string behaviour = gsettings.get_string("behaviour"); switch(behaviour){ case "active-always": win = Wnck.Screen.get_default().get_active_window(); - if(win != null && win->get_class_instance_name() == "desktop_window") - win = null; + if(win != null){ + window_type = win->get_window_type(); + if(window_type == Wnck.WindowType.DESKTOP || window_type == Wnck.WindowType.DOCK) + win = null; + } break; case "active-maximized": win = Wnck.Screen.get_default().get_active_window(); diff --git a/window-title-applet/window-title-applet.vala b/window-title-applet/window-title-applet.vala index 8fae8cd..c3c4261 100644 --- a/window-title-applet/window-title-applet.vala +++ b/window-title-applet/window-title-applet.vala @@ -59,13 +59,17 @@ namespace WindowTitleApplet{ private Wnck.Window get_current_window(){ Wnck.Window* win = null; + Wnck.WindowType window_type; string behaviour = gsettings.get_string("behaviour"); switch(behaviour){ case "active-always": win = Wnck.Screen.get_default().get_active_window(); - if(win != null && win->get_class_instance_name() == "desktop_window") - win = null; + if(win != null){ + window_type = win->get_window_type(); + if(window_type == Wnck.WindowType.DESKTOP || window_type == Wnck.WindowType.DOCK) + win = null; + } break; case "active-maximized": win = Wnck.Screen.get_default().get_active_window();