From 87fcd4cf57027a6ced6cb5036c743444f3d6fb13 Mon Sep 17 00:00:00 2001 From: elParaguayo Date: Thu, 1 Feb 2024 17:55:27 +0000 Subject: [PATCH] Move bring_to_front to _Window --- libqtile/backend/base/window.py | 27 +++++++++++---------------- libqtile/backend/x11/window.py | 21 +++++++-------------- 2 files changed, 18 insertions(+), 30 deletions(-) diff --git a/libqtile/backend/base/window.py b/libqtile/backend/base/window.py index a937a29b1a..22f38953f6 100644 --- a/libqtile/backend/base/window.py +++ b/libqtile/backend/base/window.py @@ -218,6 +218,17 @@ def move_to_bottom(self) -> None: window. """ + @abstractmethod + @expose_command() + def bring_to_front(self) -> None: + """ + Bring the window to the front. + + In X11, `bring_to_front` ignores all other layering rules and brings the + window to the very front. When that window loses focus, it will be stacked + again according the appropriate rules. + """ + class Window(_Window, metaclass=ABCMeta): """ @@ -393,17 +404,6 @@ def enable_fullscreen(self) -> None: def disable_fullscreen(self) -> None: """Un-fullscreen the window""" - @abstractmethod - @expose_command() - def bring_to_front(self) -> None: - """ - Bring the window to the front. - - In X11, `bring_to_front` ignores all other layering rules and brings the - window to the very front. When that window loses focus, it will be stacked - again according the appropriate rules. - """ - @abstractmethod @expose_command() def togroup( @@ -588,10 +588,5 @@ def info(self) -> dict: id=self.wid, ) - @abstractmethod - @expose_command() - def bring_to_front(self) -> None: - """Bring the window to the front""" - WindowType = typing.Union[Window, Internal, Static] diff --git a/libqtile/backend/x11/window.py b/libqtile/backend/x11/window.py index 1e3c4370bd..cf041abc60 100644 --- a/libqtile/backend/x11/window.py +++ b/libqtile/backend/x11/window.py @@ -1489,6 +1489,13 @@ def kept_below(self, value): self.window.set_property("_NET_WM_STATE", reply) self.change_layer(up=False) + @expose_command() + def bring_to_front(self): + if self.get_wm_type() != "desktop": + self.window.configure(stackmode=xcffib.xproto.StackMode.Above) + self.raise_children() + self.qtile.core.update_client_lists() + class Internal(_Window, base.Internal): """An internal window, that should not be managed by qtile""" @@ -1660,13 +1667,6 @@ def handle_PropertyNotify(self, e): # noqa: N802 if name == "_NET_WM_STRUT_PARTIAL": self.update_strut() - @expose_command() - def bring_to_front(self): - if self.get_wm_type() != "desktop": - self.window.configure(stackmode=xcffib.xproto.StackMode.Above) - self.raise_children() - self.qtile.core.update_client_lists() - class Window(_Window, base.Window): _window_mask = ( @@ -2293,13 +2293,6 @@ def enable_fullscreen(self): def disable_fullscreen(self): self.fullscreen = False - @expose_command() - def bring_to_front(self): - if self.get_wm_type() != "desktop": - self.window.configure(stackmode=xcffib.xproto.StackMode.Above) - self.raise_children() - self.qtile.core.update_client_lists() - def _is_in_window(self, x, y, window): return window.edges[0] <= x <= window.edges[2] and window.edges[1] <= y <= window.edges[3]