Skip to content

Commit

Permalink
Move bring_to_front to _Window
Browse files Browse the repository at this point in the history
  • Loading branch information
elParaguayo authored and tych0 committed May 12, 2024
1 parent 3f33231 commit 3c71b21
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 30 deletions.
27 changes: 11 additions & 16 deletions libqtile/backend/base/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,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):
"""
Expand Down Expand Up @@ -392,17 +403,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(
Expand Down Expand Up @@ -580,10 +580,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]
21 changes: 7 additions & 14 deletions libqtile/backend/x11/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"""
Expand Down Expand Up @@ -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 = (
Expand Down Expand Up @@ -2309,13 +2309,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]

Expand Down

0 comments on commit 3c71b21

Please sign in to comment.