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

New Window Will Block Rofi #4466

Open
2 tasks done
gavinhoward opened this issue Sep 23, 2023 · 15 comments · May be fixed by #4583
Open
2 tasks done

New Window Will Block Rofi #4466

gavinhoward opened this issue Sep 23, 2023 · 15 comments · May be fixed by #4583

Comments

@gavinhoward
Copy link

Issue description

I tried to use Rofi while a program was loading. The new program window blocked Rofi, even though Rofi was the Window taking input.

I have a few programs that take a bit to load. A browser is a good example, but this is better seen with something that can be partially transparent, like a terminal.

Here are the steps to reproduce:

  1. Make sure you use picom or Compton to get transparency.
  2. Put the following in a script:
#! /bin/sh

sleep 5

exec alacritty # or some other terminal with transparency
  1. Run rofi -show run and then type the full path of the script from 1.
  2. While the script is in its sleep, run rofi -show run again. Do not type anything.
  3. Wait until Alacritty or the terminal appears. You will see Rofi behind the terminal.
  4. Type stuff; it will appear in Rofi. Try to run a command; it will succeed even though Rofi is behind the terminal. You can also press escape to leave Rofi, but you cannot input to the window that just appeared until Rofi is gone.

This appears to be a bug in the stacking code documented here because the stacking code says that windows with _NET_WM_STATE_ABOVE set should be above new windows.

Rofi does have that set; its xprop output is the following:

WM_CLIENT_MACHINE(STRING) = "<redacted>"
_NET_WM_PID(CARDINAL) = 125634
WM_CLASS(STRING) = "rofi", "Rofi"
WM_NAME(STRING) = "rofi - run"
_NET_WM_NAME(UTF8_STRING) = "rofi - run"
WM_PROTOCOLS(ATOM): protocols  WM_TAKE_FOCUS
_NET_WM_STATE(ATOM) = _NET_WM_STATE_ABOVE

The logs below are of an exception that happens whenever a new window is opened.

Version

0.22.1

Backend

X11 (default)

Config

# Here is the relevant parts of my config:

dgroups_key_binder = None
dgroups_app_rules = []  # type: list
follow_mouse_focus = True
bring_front_click = False
cursor_warp = True
floating_layout = layout.Floating(
    border_focus=colors[8],
    border_width=2,
    float_rules=[
        # Run the utility of `xprop` to see the wm class and name of an X client.
        *layout.Floating.default_float_rules,
        Match(wm_class="confirmreset"),   # gitk
        Match(wm_class="dialog"),         # dialog boxes
        Match(wm_class="download"),       # downloads
        Match(wm_class="error"),          # error msgs
        Match(wm_class="file_progress"),  # file progress boxes
        Match(wm_class='kdenlive'),       # kdenlive
        Match(wm_class="makebranch"),     # gitk
        Match(wm_class="maketag"),        # gitk
        Match(wm_class="notification"),   # notifications
        Match(wm_class='pinentry-gtk-2'), # GPG key password entry
        Match(wm_class="ssh-askpass"),    # ssh-askpass
        Match(wm_class="toolbar"),        # toolbars
        Match(wm_class="Yad"),            # yad boxes
        Match(title="branchdialog"),      # gitk
        Match(title='Confirmation'),      # tastyworks exit box
        Match(title='Qalculate!'),        # qalculate-gtk
        Match(title="pinentry"),          # GPG key password entry
        Match(title="tastycharts"),       # tastytrade pop-out charts
        Match(title="tastytrade"),        # tastytrade pop-out side gutter
        Match(title="tastytrade - Portfolio Report"), # tastytrade pop-out allocation
        Match(wm_class="tasty.javafx.launcher.LauncherFxApp"), # tastytrade settings
        Match(wm_class="rofi"),
        Match(wm_class="Rofi"),
    ]
)
auto_fullscreen = True
focus_on_window_activation = "smart"
reconfigure_screens = True

# If things like steam games want to auto-minimize themselves when losing
# focus, should we respect this or not?
auto_minimize = True

# When using the Wayland backend, this can be used to configure input devices.
wl_input_rules = None

Logs

2023-09-23 16:34:43,279 ERROR libqtile loop.py:_handle_exception():L63 initializer for ctype 'PangoLayout *' must be a cdata pointer, not NoneType
Traceback (most recent call last):
  File "/usr/lib/python3.11/asyncio/events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "/usr/lib/python3.11/site-packages/libqtile/core/manager.py", line 871, in f
    func(*args)
  File "/usr/lib/python3.11/site-packages/libqtile/widget/notify.py", line 123, in real_update
    self.set_notif_text(notif)
  File "/usr/lib/python3.11/site-packages/libqtile/widget/notify.py", line 99, in set_notif_text
    self.text = pangocffi.markup_escape_text(notif.summary)
    ^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/libqtile/widget/base.py", line 483, in text
    self.layout.text = self.formatted_text
    ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/libqtile/drawer.py", line 73, in text
    self.layout.set_attributes(attrlist)
  File "/usr/lib/python3.11/site-packages/libqtile/pangocffi.py", line 118, in set_attributes
    pango.pango_layout_set_attributes(self._pointer, attrs)
TypeError: initializer for ctype 'PangoLayout *' must be a cdata pointer, not NoneType
2023-09-23 16:34:43,280 ERROR libqtile loop.py:_handle_exception():L63 initializer for ctype 'PangoLayout *' must be a cdata pointer, not NoneType
Traceback (most recent call last):
  File "/usr/lib/python3.11/asyncio/events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "/usr/lib/python3.11/site-packages/libqtile/core/manager.py", line 871, in f
    func(*args)
  File "/usr/lib/python3.11/site-packages/libqtile/widget/notify.py", line 123, in real_update
    self.set_notif_text(notif)
  File "/usr/lib/python3.11/site-packages/libqtile/widget/notify.py", line 99, in set_notif_text
    self.text = pangocffi.markup_escape_text(notif.summary)
    ^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/libqtile/widget/base.py", line 483, in text
    self.layout.text = self.formatted_text
    ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/libqtile/drawer.py", line 73, in text
    self.layout.set_attributes(attrlist)
  File "/usr/lib/python3.11/site-packages/libqtile/pangocffi.py", line 118, in set_attributes
    pango.pango_layout_set_attributes(self._pointer, attrs)
TypeError: initializer for ctype 'PangoLayout *' must be a cdata pointer, not NoneType
2023-09-23 16:34:43,280 ERROR libqtile loop.py:_handle_exception():L63 initializer for ctype 'PangoLayout *' must be a cdata pointer, not NoneType
Traceback (most recent call last):
  File "/usr/lib/python3.11/asyncio/events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "/usr/lib/python3.11/site-packages/libqtile/core/manager.py", line 871, in f
    func(*args)
  File "/usr/lib/python3.11/site-packages/libqtile/widget/notify.py", line 123, in real_update
    self.set_notif_text(notif)
  File "/usr/lib/python3.11/site-packages/libqtile/widget/notify.py", line 99, in set_notif_text
    self.text = pangocffi.markup_escape_text(notif.summary)
    ^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/libqtile/widget/base.py", line 483, in text
    self.layout.text = self.formatted_text
    ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/libqtile/drawer.py", line 73, in text
    self.layout.set_attributes(attrlist)
  File "/usr/lib/python3.11/site-packages/libqtile/pangocffi.py", line 118, in set_attributes
    pango.pango_layout_set_attributes(self._pointer, attrs)
TypeError: initializer for ctype 'PangoLayout *' must be a cdata pointer, not NoneType
2023-09-23 16:34:43,281 ERROR libqtile loop.py:_handle_exception():L63 initializer for ctype 'PangoLayout *' must be a cdata pointer, not NoneType
Traceback (most recent call last):
  File "/usr/lib/python3.11/asyncio/events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "/usr/lib/python3.11/site-packages/libqtile/core/manager.py", line 871, in f
    func(*args)
  File "/usr/lib/python3.11/site-packages/libqtile/widget/notify.py", line 123, in real_update
    self.set_notif_text(notif)
  File "/usr/lib/python3.11/site-packages/libqtile/widget/notify.py", line 99, in set_notif_text
    self.text = pangocffi.markup_escape_text(notif.summary)
    ^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/libqtile/widget/base.py", line 483, in text
    self.layout.text = self.formatted_text
    ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/libqtile/drawer.py", line 73, in text
    self.layout.set_attributes(attrlist)
  File "/usr/lib/python3.11/site-packages/libqtile/pangocffi.py", line 118, in set_attributes
    pango.pango_layout_set_attributes(self._pointer, attrs)
TypeError: initializer for ctype 'PangoLayout *' must be a cdata pointer, not NoneType

Required

  • I have searched past issues to see if this bug has already been reported, and it hasn't been.
  • I understand that people give their precious time for free, and thus I've done my very best to make this problem as easy as possible to investigate.
@gavinhoward
Copy link
Author

Here is the output of xprop on an Alacritty window created by the script:

WM_HINTS(WM_HINTS):
_NET_WM_STATE(ATOM) = _NET_WM_STATE_FOCUSED, _NET_WM_STATE_MAXIMIZED_HORZ, _NET_WM_STATE_MAXIMIZED_VERT
_NET_FRAME_EXTENTS(CARDINAL) = 0, 0, 0, 0
_NET_WM_DESKTOP(CARDINAL) = 1
WM_STATE(WM_STATE):
		window state: Normal
		icon window: 0x0
_VARIABLE_REFRESH(CARDINAL) = 1
WM_PROTOCOLS(ATOM): protocols  WM_DELETE_WINDOW, _NET_WM_PING
_NET_WM_ICON(CARDINAL) = 	Icon (64 x 64): <redacted>

WM_NORMAL_HINTS(WM_SIZE_HINTS):
		program specified size: 800 by 600
_NET_WM_WINDOW_TYPE(ATOM) = _NET_WM_WINDOW_TYPE_NORMAL
WM_CLIENT_MACHINE(STRING) = "nile"
_NET_WM_PID(CARDINAL) = 6218
WM_CLASS(STRING) = "Alacritty", "Alacritty"
XdndAware(ATOM) = BITMAP
_MOTIF_WM_HINTS(_MOTIF_WM_HINTS) = 0x2, 0x0, 0x1, 0x0, 0x0
_NET_WM_NAME(UTF8_STRING) = "Alacritty"
WM_NAME(STRING) = "Alacritty"

@elParaguayo
Copy link
Member

elParaguayo commented Sep 24, 2023

Your link in the docs is to the "latest" version but you're only running 0.22.1. The window stacking code was added after that release.

Ideally, could you test this in the latest git version? That being said, I've never had any issues with rofi.

@gavinhoward
Copy link
Author

Oops. Egg on face. Sorry.

I managed to test a newer version: 0.23.0b3.dev37+g9f232768 is the output from qtile --version. However, the bug still exists in that version.

By the way, the transparency is not necessary to reproduce (I don't think). It's just to make it easier to see the problem.

@elParaguayo
Copy link
Member

Ok. Thanks for checking. Let me take a look later.

@ramnes ramnes added this to Needs triage in Bug triage via automation Oct 14, 2023
@elParaguayo
Copy link
Member

Sorry for the delay. Can confirm I get the issue with your steps.

Will take a look at fixing this.

@elParaguayo elParaguayo self-assigned this Nov 18, 2023
elParaguayo added a commit to elParaguayo/qtile that referenced this issue Nov 18, 2023
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 linked a pull request Nov 18, 2023 that will close this issue
@elParaguayo
Copy link
Member

I've got a fix working in #4583. If you're able to test it, that would be great. We may still make some changes to that PR as it's more to check whether I've identified the problem correctly but any feedback we can get would be good.

@gavinhoward
Copy link
Author

Unfortunately, after testing the branch at https://github.com/elParaguayo/qtile/tree/issue-4466-new-window-stack-position, the bug still exists on my machine.

@elParaguayo
Copy link
Member

Oh. That's a shame. Thanks for testing.

Let me try something else!

@gavinhoward
Copy link
Author

I hate to say it, but after running the branch some more, it seems to have messed up dialogs.

I kept trying to save a PDF using my browser, which would pop up a save dialog, but I could not press "Save" nor change the name.

@elParaguayo
Copy link
Member

You can be as rude as you like about the branch! To be honest, the more bugs you spot, the better.

@gavinhoward
Copy link
Author

Thank you. :) I know you are doing your best with limited time.

I should be clearer about what happened. There were several things:

  • Dialogs would refuse to pop up unless I switched groups, then switched back.
  • If I exited a dialog, it would sometimes remain in the window list (in the bar) unless I restarted Qtile.
  • Dialogs would accept highlighting and unhighlighting the file name, but there was no cursor, they would not accept backspace or other keyboard input, and the buttons on the dialog did not accept mouse presses.

@elParaguayo
Copy link
Member

Wow. That commit really shouldn't have had that much impact!

@gavinhoward
Copy link
Author

Yeah, it blew me away too. I had looked at the commit before I tested it, and it looked quite sane.

elParaguayo added a commit to elParaguayo/qtile that referenced this issue Jan 28, 2024
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
Copy link
Member

@gavinhoward I've pushed a couple more commits to that PR to see if I can get it working. Are you able to take another look?

@gavinhoward
Copy link
Author

Works for me!

elParaguayo added a commit to elParaguayo/qtile that referenced this issue May 5, 2024
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Bug triage
  
Needs triage
Development

Successfully merging a pull request may close this issue.

4 participants