Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[x11] Better stacking unmanaged windows #4583

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

elParaguayo
Copy link
Member

DRAFT FOR NOW - will add some comments.

Where qtile has unmanaged windows (e.g. override redirect) then these windows were ignored for stacking purposes which meant they could appear in the wrong place.

This PR adds the ability for qtile to stack these windows correctly while still not fully managing the windows.

Fixes #4466

@@ -171,6 +171,8 @@ def __init__(self, display_name: str | None = None) -> None:

self.last_focused: base.Window | None = None

self.override_redirect_map: dict[int, window._Window] = {}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May be badly named as rofi (as an example) does not set the override redirect window.

@@ -736,6 +737,9 @@ def handle_MappingNotify(self, event): # noqa: N802
def handle_MapRequest(self, event) -> None: # noqa: N802
assert self.qtile is not None

if event.window in self.override_redirect_map:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we're mapping it then the window will be in windows_map so we should remove it here.

@@ -771,9 +775,17 @@ def handle_MapRequest(self, event) -> None: # noqa: N802
self.update_client_lists()
win.change_layer()

def handle_CreateNotify(self, event) -> None: # noqa: N802
xwin = window.XWindow(self.conn, event.window)
win = window._Window(xwin, self.qtile)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use the _Window class as Window sets various attributes etc on __init__ which results in errors for some windows.

self.qtile.windows_map[wid].window.configure(
stackmode=xcffib.xproto.StackMode.Below, sibling=same[0]
)
win = self.qtile.windows_map.get(wid, self.qtile.core.override_redirect_map[wid])
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks up the wid in windows_map and, if it's not there then it must be in the override_redirect map.

@elParaguayo elParaguayo mentioned this pull request Nov 19, 2023
2 tasks
@elParaguayo
Copy link
Member Author

Need to check the tests too!

@@ -47,7 +47,7 @@
from libqtile.core.manager import Qtile

_IGNORED_EVENTS = {
xcffib.xproto.CreateNotifyEvent,
# xcffib.xproto.CreateNotifyEvent,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove it instead

@jwijenbergh
Copy link
Contributor

Tbf I don't really understand the details here still, but the code to me looks pretty clean

@elParaguayo
Copy link
Member Author

This didn't work for the OP of the issue. Back to the drawing board...

Copy link

This PR is stale because it has been open 90 days with no activity. Remove the status: stale label or comment, or this will be closed in 30 days.

Where qtile has unmanaged windows (e.g. override redirect) then these
windows were ignored for stacking purposes which meant they could appear
in the wrong place.

This PR adds the ability for qtile to stack these windows correctly
while still not fully managing the windows.

Fixes qtile#4466
@elParaguayo elParaguayo force-pushed the issue-4466-new-window-stack-position branch from 37587a7 to 31623e1 Compare May 28, 2024 20:39
Copy link

This PR is stale because it has been open 90 days with no activity. Remove the status: stale label or comment, or this will be closed in 30 days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

New Window Will Block Rofi
3 participants