Code Monkey home page Code Monkey logo

Comments (30)

elParaguayo avatar elParaguayo commented on June 9, 2024 1

You'd need to download the branch containing that pull request as it's not merged into the main repo yet.

Could you run xprop on the polkit window and also run qtile cmd-obj -o cmd -f windows in a terminal while the polkit window is open.

from qtile.

elParaguayo avatar elParaguayo commented on June 9, 2024 1

Thanks. Qtile is managing the window so you can probably solve this with a hook in your config.

Something like this:

from libqtile import hook

@hook.subscribe.client_managed
def restack_polkit(client):
    if "polkit-kde-authentication-agent-1" in client.get_wm_class():
        client.move_to_top()

from qtile.

elParaguayo avatar elParaguayo commented on June 9, 2024 1

Sigh...

Ok. Can you do the qtile cmd-obj ... command again and get the ID of the password window. Then do qtile cmd-obj -o window WINDOW_ID -f bring_to_front.

If that doesn't work, can you see if there are any errors in your log.

from qtile.

elParaguayo avatar elParaguayo commented on June 9, 2024 1

Ok. That suggests the client_managed hook isn't working properly - or the hook isn't being fired for that window. Let me check the underlying code when I get home and I'll see if I can suggest a better fix.

from qtile.

elParaguayo avatar elParaguayo commented on June 9, 2024 1

OK - so the hook is working but, for some reason, it's not bringing the window to the front.

This is a very long shot, but try this:

import asyncio

@hook.subscribe.client_managed
async def restack_polkit(client):
    if "polkit-kde-authentication-agent-1" in client.get_wm_class():
        await asyncio.sleep(0.5)
        client.bring_to_front()

from qtile.

elParaguayo avatar elParaguayo commented on June 9, 2024 1

Great. Glad we got there in the end!

from qtile.

elParaguayo avatar elParaguayo commented on June 9, 2024 1

In case you're interested, I've now worked out why the above solution works:

  • The original hooked function (without async) ran as soon as qtile managed the window. However, the window code stacks window after this point. So the hook was bringing the window to the front but immediately restacking it (in the wrong place)
  • By making this async and introducing the sleep the window is managed and stacked before your call to bring_to_front

from qtile.

elParaguayo avatar elParaguayo commented on June 9, 2024 1

Don't worry about the duplicate key bindings, that's an issue we're aware of. I'm not sure it's a problem, but it does make the logs messy!

For the second one, your problem is in this part of the code:

    else:
        # Falls kein Gruppenmatch, in die erste freie Gruppe
        for group in groups:
            if not group.windows:
                group.toscreen(toggle=False)
                break

groups is the list define in your config but that doesn't have a windows attribute or a toscreen method. You actually need to get the group object from the groups_map like you do in the first half of the code.

There's probably a neater way to fix that but I can't check until later tonight.

from qtile.

elParaguayo avatar elParaguayo commented on June 9, 2024

You could see if #4583 fixes this.

Alternatively, assuming qtile is managing this window, you could use a hook ("client_managed") to check when a new window appears and, if it's the window you want, bring it to the front.

from qtile.

avnibilgin avatar avnibilgin commented on June 9, 2024

I obtained qtile from the Arch repositories. Does (Arch) version 0.23.0-2 include this fix or do I have to download the Git version?

from qtile.

avnibilgin avatar avnibilgin commented on June 9, 2024

xprop:

_NET_FRAME_EXTENTS(CARDINAL) = 1, 1, 1, 1
_NET_WM_STATE(ATOM) = _NET_WM_STATE_ABOVE
_NET_WM_DESKTOP(CARDINAL) = 0
_KDE_NET_WM_BLUR_BEHIND_REGION(CARDINAL) = 0, 0, 511, 266
WM_STATE(WM_STATE):
		window state: Normal
		icon window: 0x0
_NET_WM_USER_TIME(CARDINAL) = 3329479
WM_TRANSIENT_FOR(WINDOW): window id # 0x1200008
_NET_WM_ICON(CARDINAL) = 	Icon (64 x 64):
	(not shown)

_NET_WM_ICON_NAME(UTF8_STRING) =
XdndAware(ATOM) = BITMAP
WM_NAME(STRING) = "Authentifizierung erforderlich"
_NET_WM_NAME(UTF8_STRING) = "Authentifizierung erforderlich — PolicyKit1-KDE-Agent"
_MOTIF_WM_HINTS(_MOTIF_WM_HINTS) = 0x3, 0x26, 0x1e, 0x0, 0x0
_NET_WM_WINDOW_TYPE(ATOM) = _NET_WM_WINDOW_TYPE_DIALOG, _NET_WM_WINDOW_TYPE_NORMAL
_XEMBED_INFO(_XEMBED_INFO) = 0x0, 0x1
WM_CLIENT_LEADER(WINDOW): window id # 0x1200008
WM_HINTS(WM_HINTS):
		Client accepts input or input focus: True
		window id # of group leader: 0x1200008
WM_CLIENT_MACHINE(STRING) = "arch"
_NET_WM_PID(CARDINAL) = 683
_NET_WM_SYNC_REQUEST_COUNTER(CARDINAL) = 18874402
WM_CLASS(STRING) = "polkit-kde-authentication-agent-1", "polkit-kde-authentication-agent-1"
WM_PROTOCOLS(ATOM): protocols  WM_DELETE_WINDOW, WM_TAKE_FOCUS, _NET_WM_PING, _NET_WM_SYNC_REQUEST, _NET_WM_CONTEXT_HELP
WM_NORMAL_HINTS(WM_SIZE_HINTS):
		user specified location: 695, 367
		user specified size: 511 by 266
		program specified minimum size: 302 by 266
		window gravity: Static

qtile cmd-obj -o cmd -f windows:

[{'float_info': {'height': 1030, 'width': 1900, 'x': 10, 'y': 40},
  'floating': False,
  'fullscreen': False,
  'group': '1',
  'height': 1030,
  'id': 29360142,
  'maximized': False,
  'minimized': False,
  'name': 'config.py - /home/thor/.config/qtile - Geany',
  'width': 1900,
  'wm_class': ['geany', 'Geany'],
  'x': 10,
  'y': 40},
 {'float_info': {'height': 503, 'width': 938, 'x': 970, 'y': 555},
  'floating': True,
  'fullscreen': False,
  'group': '1',
  'height': 513,
  'id': 31457284,
  'maximized': False,
  'minimized': False,
  'name': 'Repositories',
  'width': 938,
  'wm_class': ['pamac-manager', 'pamac-manager'],
  'x': 970,
  'y': 555},
 {'float_info': {'height': 1080, 'width': 1146, 'x': 10, 'y': 40},
  'floating': False,
  'fullscreen': False,
  'group': '2',
  'height': 1030,
  'id': 35651629,
  'maximized': False,
  'minimized': False,
  'name': 'Polkit-kde-authentication-agent-1 at the back window level · Issue '
          '#4648 · qtile/qtile – Mozilla Firefox',
  'width': 1900,
  'wm_class': ['Navigator', 'firefox'],
  'x': 10,
  'y': 40},
 {'float_info': {'height': 444, 'width': 764, 'x': 970, 'y': 40},
  'floating': True,
  'fullscreen': False,
  'group': '1',
  'height': 1020,
  'id': 33554435,
  'maximized': False,
  'minimized': False,
  'name': 'qtile cmd-obj -o cmd -f windows',
  'width': 797,
  'wm_class': ['Alacritty', 'Alacritty'],
  'x': 970,
  'y': 40},
 {'float_info': {'height': 266, 'width': 511, 'x': 695, 'y': 367},
  'floating': True,
  'fullscreen': False,
  'group': '1',
  'height': 266,
  'id': 18874401,
  'maximized': False,
  'minimized': False,
  'name': 'Authentifizierung erforderlich — PolicyKit1-KDE-Agent',
  'width': 511,
  'wm_class': ['polkit-kde-authentication-agent-1',
               'polkit-kde-authentication-agent-1'],
  'x': 695,
  'y': 367}]

from qtile.

avnibilgin avatar avnibilgin commented on June 9, 2024

Thanks for your efforts, neither this hook nor any other one I've tried brings the password prompt forward. The parent app, for example Pamac Software Manager, also opens subpages, such as the summary of transactions, only the damn KDE authentication password query remains stubbornly behind.

from libqtile import hook

@hook.subscribe.client_managed
def restack_polkit(client):
    if "polkit-kde-authentication-agent-1" in client.get_wm_class():
        client.move_to_top()
from libqtile import hook

@hook.subscribe.client_managed
def bring_to_front(window):
    # Bring the new window to the front
    window.group.focus(window, False)
    window.group.cmd_bring_to_front()
    ```

from qtile.

elParaguayo avatar elParaguayo commented on June 9, 2024

Does client.bring_to_front() work with my code?

from qtile.

avnibilgin avatar avnibilgin commented on June 9, 2024

I just tried it too. Unfortunately that doesn't work either.

@hook.subscribe.client_managed
def restack_polkit(client):
    if "polkit-kde-authentication-agent-1" in client.get_wm_class():
        client.bring_to_front()

from qtile.

avnibilgin avatar avnibilgin commented on June 9, 2024

Bingo! It's worked out! How can I best integrate this into my config.py?

from qtile.

avnibilgin avatar avnibilgin commented on June 9, 2024

Great, thank you again for your great effort and help

from qtile.

elParaguayo avatar elParaguayo commented on June 9, 2024

Can't see any obvious reason why it wouldn't work.

Let's do some debugging:

from libqtile import hook
from libqtile.log_utils import logger

@hook.subscribe.client_new
def new_client(client):
    logger.warning(f"New client: {client.name=} {client.get_wm_class()=}")

@hook.subscribe.client_managed
def managed_client(client):
    logger.warning(f"Managed client: {client.name=} {client.get_wm_class()=}")

Add this to your config and reload it. Open the password window and then check the log file. Paste the lines here.

from qtile.

avnibilgin avatar avnibilgin commented on June 9, 2024
2024-01-16 19:51:50,331 ERROR libqtile hook.py:fire():L903 Error in hook client_new
Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/libqtile/hook.py", line 901, in fire
    i(*args, **kwargs)
  File "/home/thor/.config/qtile/config.py", line 697, in modify_window
    if not group.windows:
           ^^^^^^^^^^^^^
AttributeError: 'Group' object has no attribute 'windows'
2024-01-16 19:51:50,331 WARNING libqtile config.py:new_client():L712 New client: client.name='Software hinzufügen/entfernen' client.get_wm_class()=['pamac-manager', 'pamac-manager']
2024-01-16 19:51:50,335 WARNING libqtile base.py:__getattr__():L271 Deprecation Warning: commands exposed via IPC no longer use the 'cmd_' prefix. Please replace 'cmd_toscreen' with 'toscreen' in your code.
2024-01-16 19:51:50,365 WARNING libqtile config.py:managed_client():L716 Managed client: client.name='Software hinzufügen/entfernen' client.get_wm_class()=['pamac-manager', 'pamac-manager']
2024-01-16 19:52:17,897 WARNING libqtile base.py:__getattr__():L271 Deprecation Warning: commands exposed via IPC no longer use the 'cmd_' prefix. Please replace 'cmd_toscreen' with 'toscreen' in your code.
2024-01-16 19:52:17,914 ERROR libqtile hook.py:fire():L903 Error in hook client_new
Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/libqtile/hook.py", line 901, in fire
    i(*args, **kwargs)
  File "/home/thor/.config/qtile/config.py", line 697, in modify_window
    if not group.windows:
           ^^^^^^^^^^^^^
AttributeError: 'Group' object has no attribute 'windows'
2024-01-16 19:52:17,915 WARNING libqtile config.py:new_client():L712 New client: client.name='Wähle die optionalen Abhängigkeiten für blender' client.get_wm_class()=['pamac-manager', 'pamac-manager']
2024-01-16 19:52:17,915 WARNING libqtile config.py:managed_client():L716 Managed client: client.name='Wähle die optionalen Abhängigkeiten für blender' client.get_wm_class()=['pamac-manager', 'pamac-manager']
2024-01-16 19:52:22,995 WARNING libqtile base.py:__getattr__():L271 Deprecation Warning: commands exposed via IPC no longer use the 'cmd_' prefix. Please replace 'cmd_toscreen' with 'toscreen' in your code.
2024-01-16 19:52:23,017 ERROR libqtile hook.py:fire():L903 Error in hook client_new
Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/libqtile/hook.py", line 901, in fire
    i(*args, **kwargs)
  File "/home/thor/.config/qtile/config.py", line 697, in modify_window
    if not group.windows:
           ^^^^^^^^^^^^^
AttributeError: 'Group' object has no attribute 'windows'
2024-01-16 19:52:23,017 WARNING libqtile config.py:new_client():L712 New client: client.name='Transaktionszusammenfassung' client.get_wm_class()=['pamac-manager', 'pamac-manager']
2024-01-16 19:52:23,017 WARNING libqtile config.py:managed_client():L716 Managed client: client.name='Transaktionszusammenfassung' client.get_wm_class()=['pamac-manager', 'pamac-manager']
2024-01-16 19:52:24,793 ERROR libqtile hook.py:fire():L903 Error in hook client_new
Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/libqtile/hook.py", line 901, in fire
    i(*args, **kwargs)
  File "/home/thor/.config/qtile/config.py", line 697, in modify_window
    if not group.windows:
           ^^^^^^^^^^^^^
AttributeError: 'Group' object has no attribute 'windows'
2024-01-16 19:52:24,794 WARNING libqtile config.py:new_client():L712 New client: client.name='Authentifizierung erforderlich — PolicyKit1-KDE-Agent' client.get_wm_class()=['polkit-kde-authentication-agent-1', 'polkit-kde-authentication-agent-1']
2024-01-16 19:52:24,794 WARNING libqtile base.py:__getattr__():L271 Deprecation Warning: commands exposed via IPC no longer use the 'cmd_' prefix. Please replace 'cmd_toscreen' with 'toscreen' in your code.
2024-01-16 19:52:24,802 WARNING libqtile config.py:managed_client():L716 Managed client: client.name='Authentifizierung erforderlich — PolicyKit1-KDE-Agent' client.get_wm_class()=['polkit-kde-authentication-agent-1', 'polkit-kde-authentication-agent-1']
2024-01-16 19:53:00,302 WARNING libqtile base.py:__getattr__():L271 Deprecation Warning: commands exposed via IPC no longer use the 'cmd_' prefix. Please replace 'cmd_toscreen' with 'toscreen' in your code.
2024-01-16 19:53:00,315 ERROR libqtile hook.py:fire():L903 Error in hook client_new
Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/libqtile/hook.py", line 901, in fire
    i(*args, **kwargs)
  File "/home/thor/.config/qtile/config.py", line 697, in modify_window
    if not group.windows:
           ^^^^^^^^^^^^^
AttributeError: 'Group' object has no attribute 'windows'
2024-01-16 19:53:00,316 WARNING libqtile config.py:new_client():L712 New client: client.name='Fehler' client.get_wm_class()=['pamac-manager', 'pamac-manager']
2024-01-16 19:53:00,316 WARNING libqtile config.py:managed_client():L716 Managed client: client.name='Fehler' client.get_wm_class()=['pamac-manager', 'pamac-manager']
2024-01-16 19:53:20,534 WARNING libqtile config.py:<module>():L59 Using config.py with x11
2024-01-16 19:53:20,534 WARNING libqtile config.py:<module>():L70 Status bar: qtile
2024-01-16 19:53:20,543 WARNING libqtile config.py:<module>():L563 Loading qtile bar
2024-01-16 19:53:20,565 WARNING libqtile config.py:<module>():L59 Using config.py with x11
2024-01-16 19:53:20,566 WARNING libqtile config.py:<module>():L70 Status bar: qtile
2024-01-16 19:53:20,573 WARNING libqtile config.py:<module>():L563 Loading qtile bar
2024-01-16 19:53:20,613 WARNING libqtile manager.py:grab_key():L477 Key spec duplicated, overriding previous: <Key (['mod4', 'control'], l)>
2024-01-16 19:53:20,614 WARNING libqtile manager.py:grab_key():L477 Key spec duplicated, overriding previous: <Key (['mod4'], 1)>
2024-01-16 19:53:20,614 WARNING libqtile manager.py:grab_key():L477 Key spec duplicated, overriding previous: <Key (['mod4', 'shift'], 1)>
2024-01-16 19:53:20,614 WARNING libqtile manager.py:grab_key():L477 Key spec duplicated, overriding previous: <Key (['mod4', 'control'], 1)>
2024-01-16 19:53:20,614 WARNING libqtile manager.py:grab_key():L477 Key spec duplicated, overriding previous: <Key (['mod4'], 2)>
2024-01-16 19:53:20,614 WARNING libqtile manager.py:grab_key():L477 Key spec duplicated, overriding previous: <Key (['mod4', 'shift'], 2)>
2024-01-16 19:53:20,615 WARNING libqtile manager.py:grab_key():L477 Key spec duplicated, overriding previous: <Key (['mod4', 'control'], 2)>
2024-01-16 19:53:20,615 WARNING libqtile manager.py:grab_key():L477 Key spec duplicated, overriding previous: <Key (['mod4'], 3)>
2024-01-16 19:53:20,615 WARNING libqtile manager.py:grab_key():L477 Key spec duplicated, overriding previous: <Key (['mod4', 'shift'], 3)>
2024-01-16 19:53:20,615 WARNING libqtile manager.py:grab_key():L477 Key spec duplicated, overriding previous: <Key (['mod4', 'control'], 3)>
2024-01-16 19:53:20,615 WARNING libqtile manager.py:grab_key():L477 Key spec duplicated, overriding previous: <Key (['mod4'], 4)>
2024-01-16 19:53:20,615 WARNING libqtile manager.py:grab_key():L477 Key spec duplicated, overriding previous: <Key (['mod4', 'shift'], 4)>
2024-01-16 19:53:20,615 WARNING libqtile manager.py:grab_key():L477 Key spec duplicated, overriding previous: <Key (['mod4', 'control'], 4)>
2024-01-16 19:53:20,615 WARNING libqtile manager.py:grab_key():L477 Key spec duplicated, overriding previous: <Key (['mod4'], 5)>
2024-01-16 19:53:20,615 WARNING libqtile manager.py:grab_key():L477 Key spec duplicated, overriding previous: <Key (['mod4', 'shift'], 5)>
2024-01-16 19:53:20,616 WARNING libqtile manager.py:grab_key():L477 Key spec duplicated, overriding previous: <Key (['mod4', 'control'], 5)>
2024-01-16 19:53:20,616 WARNING libqtile manager.py:grab_key():L477 Key spec duplicated, overriding previous: <Key (['mod4'], 6)>
2024-01-16 19:53:20,616 WARNING libqtile manager.py:grab_key():L477 Key spec duplicated, overriding previous: <Key (['mod4', 'shift'], 6)>
2024-01-16 19:53:20,616 WARNING libqtile manager.py:grab_key():L477 Key spec duplicated, overriding previous: <Key (['mod4', 'control'], 6)>
2024-01-16 19:53:20,620 WARNING libqtile base.py:__getattr__():L271 Deprecation Warning: commands exposed via IPC no longer use the 'cmd_' prefix. Please replace 'cmd_toscreen' with 'toscreen' in your code.
2024-01-16 19:53:20,635 WARNING libqtile base.py:__getattr__():L271 Deprecation Warning: commands exposed via IPC no longer use the 'cmd_' prefix. Please replace 'cmd_toscreen' with 'toscreen' in your code.
2024-01-16 19:53:20,655 WARNING libqtile base.py:__getattr__():L271 Deprecation Warning: commands exposed via IPC no longer use the 'cmd_' prefix. Please replace 'cmd_toscreen' with 'toscreen' in your code.
2024-01-16 19:53:36,317 ERROR libqtile hook.py:fire():L903 Error in hook client_new
Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/libqtile/hook.py", line 901, in fire
    i(*args, **kwargs)
  File "/home/thor/.config/qtile/config.py", line 697, in modify_window
    if not group.windows:
           ^^^^^^^^^^^^^
AttributeError: 'Group' object has no attribute 'windows'
2024-01-16 19:53:36,317 WARNING libqtile config.py:new_client():L712 New client: client.name='Software hinzufügen/entfernen' client.get_wm_class()=['pamac-manager', 'pamac-manager']
2024-01-16 19:53:36,320 WARNING libqtile base.py:__getattr__():L271 Deprecation Warning: commands exposed via IPC no longer use the 'cmd_' prefix. Please replace 'cmd_toscreen' with 'toscreen' in your code.
2024-01-16 19:53:36,355 WARNING libqtile config.py:managed_client():L716 Managed client: client.name='Software hinzufügen/entfernen' client.get_wm_class()=['pamac-manager', 'pamac-manager']
2024-01-16 19:53:48,326 WARNING libqtile base.py:__getattr__():L271 Deprecation Warning: commands exposed via IPC no longer use the 'cmd_' prefix. Please replace 'cmd_toscreen' with 'toscreen' in your code.
2024-01-16 19:53:48,353 ERROR libqtile hook.py:fire():L903 Error in hook client_new
Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/libqtile/hook.py", line 901, in fire
    i(*args, **kwargs)
  File "/home/thor/.config/qtile/config.py", line 697, in modify_window
    if not group.windows:
           ^^^^^^^^^^^^^
AttributeError: 'Group' object has no attribute 'windows'
2024-01-16 19:53:48,353 WARNING libqtile config.py:new_client():L712 New client: client.name='Wähle die optionalen Abhängigkeiten für vlc' client.get_wm_class()=['pamac-manager', 'pamac-manager']
2024-01-16 19:53:48,353 WARNING libqtile config.py:managed_client():L716 Managed client: client.name='Wähle die optionalen Abhängigkeiten für vlc' client.get_wm_class()=['pamac-manager', 'pamac-manager']
2024-01-16 19:53:52,033 WARNING libqtile base.py:__getattr__():L271 Deprecation Warning: commands exposed via IPC no longer use the 'cmd_' prefix. Please replace 'cmd_toscreen' with 'toscreen' in your code.
2024-01-16 19:53:52,046 ERROR libqtile hook.py:fire():L903 Error in hook client_new
Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/libqtile/hook.py", line 901, in fire
    i(*args, **kwargs)
  File "/home/thor/.config/qtile/config.py", line 697, in modify_window
    if not group.windows:
           ^^^^^^^^^^^^^
AttributeError: 'Group' object has no attribute 'windows'
2024-01-16 19:53:52,046 WARNING libqtile config.py:new_client():L712 New client: client.name='Transaktionszusammenfassung' client.get_wm_class()=['pamac-manager', 'pamac-manager']
2024-01-16 19:53:52,046 WARNING libqtile config.py:managed_client():L716 Managed client: client.name='Transaktionszusammenfassung' client.get_wm_class()=['pamac-manager', 'pamac-manager']
2024-01-16 19:53:54,135 ERROR libqtile hook.py:fire():L903 Error in hook client_new
Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/libqtile/hook.py", line 901, in fire
    i(*args, **kwargs)
  File "/home/thor/.config/qtile/config.py", line 697, in modify_window
    if not group.windows:
           ^^^^^^^^^^^^^
AttributeError: 'Group' object has no attribute 'windows'
2024-01-16 19:53:54,136 WARNING libqtile config.py:new_client():L712 New client: client.name='Authentifizierung erforderlich — PolicyKit1-KDE-Agent' client.get_wm_class()=['polkit-kde-authentication-agent-1', 'polkit-kde-authentication-agent-1']
2024-01-16 19:53:54,136 WARNING libqtile base.py:__getattr__():L271 Deprecation Warning: commands exposed via IPC no longer use the 'cmd_' prefix. Please replace 'cmd_toscreen' with 'toscreen' in your code.
2024-01-16 19:53:54,146 WARNING libqtile config.py:managed_client():L716 Managed client: client.name='Authentifizierung erforderlich — PolicyKit1-KDE-Agent' client.get_wm_class()=['polkit-kde-authentication-agent-1', 'polkit-kde-authentication-agent-1']
2024-01-16 19:54:29,793 WARNING libqtile base.py:__getattr__():L271 Deprecation Warning: commands exposed via IPC no longer use the 'cmd_' prefix. Please replace 'cmd_toscreen' with 'toscreen' in your code.
2024-01-16 19:54:29,818 ERROR libqtile hook.py:fire():L903 Error in hook client_new
Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/libqtile/hook.py", line 901, in fire
    i(*args, **kwargs)
  File "/home/thor/.config/qtile/config.py", line 697, in modify_window
    if not group.windows:
           ^^^^^^^^^^^^^
AttributeError: 'Group' object has no attribute 'windows'
2024-01-16 19:54:29,819 WARNING libqtile config.py:new_client():L712 New client: client.name='Datei öffnen' client.get_wm_class()=['geany', 'Geany']
2024-01-16 19:54:29,819 WARNING libqtile config.py:managed_client():L716 Managed client: client.name='Datei öffnen' client.get_wm_class()=['geany', 

from qtile.

elParaguayo avatar elParaguayo commented on June 9, 2024

Well you've got some other errors with your config but it does look like the password window is being managed (assuming it's this one: "'Authentifizierung erforderlich — PolicyKit1-KDE-Agent'").

If that's the case then this hook really should work:

from libqtile import hook
from libqtile.log_utils import logger

@hook.subscribe.client_managed
def restack_polkit(client):
    if "polkit-kde-authentication-agent-1" in client.get_wm_class():
        logger.warning("Password window found. Bringing to front...")
        client.bring_to_front()

from qtile.

avnibilgin avatar avnibilgin commented on June 9, 2024

Unfortunately this doesn't bring the window to the front either, I also tried this code, it didn't work either:

@hook.subscribe.client_managed
def restack_polkit(client):
    if "polkit-kde-authentication-agent-1" in client.get_wm_class():
        qtile_cmd = f"qtile cmd-obj -o window {client.window.wid} -f bring_to_front"
        os.system(qtile_cmd)

from qtile.

avnibilgin avatar avnibilgin commented on June 9, 2024

This code didn't help either:

@hook.subscribe.client_managed
def restack_polkit(client):
    if client.get_wm_class() == "polkit-kde-authentication-agent-1":
        qtile_cmd = f"qtile cmd-obj -o window {client.window.wid} -f bring_to_front"
        os.system(qtile_cmd)

from qtile.

elParaguayo avatar elParaguayo commented on June 9, 2024

Did the message appear in the log?

from qtile.

avnibilgin avatar avnibilgin commented on June 9, 2024

After I integrated and executed the code you last shared, the following log message appears:

2024-01-17 11:09:29,196 ERROR libqtile hook.py:fire():L903 Error in hook client_new
Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/libqtile/hook.py", line 901, in fire
    i(*args, **kwargs)
  File "/home/thor/.config/qtile/config.py", line 694, in modify_window
    if not group.windows:
           ^^^^^^^^^^^^^
AttributeError: 'Group' object has no attribute 'windows'
2024-01-17 11:09:33,596 ERROR libqtile hook.py:fire():L903 Error in hook client_new
Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/libqtile/hook.py", line 901, in fire
    i(*args, **kwargs)
  File "/home/thor/.config/qtile/config.py", line 694, in modify_window
    if not group.windows:
           ^^^^^^^^^^^^^
AttributeError: 'Group' object has no attribute 'windows'
2024-01-17 11:09:34,801 ERROR libqtile hook.py:fire():L903 Error in hook client_new
Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/libqtile/hook.py", line 901, in fire
    i(*args, **kwargs)
  File "/home/thor/.config/qtile/config.py", line 694, in modify_window
    if not group.windows:
           ^^^^^^^^^^^^^
AttributeError: 'Group' object has no attribute 'windows'
2024-01-17 11:09:34,814 WARNING libqtile config.py:restack_polkit():L710 Password window found. Bringing to front...

from qtile.

avnibilgin avatar avnibilgin commented on June 9, 2024

Yesssssssssssss, it works!!!!!!! After several hours, this is salvation. Thank you very very much

screenshot_17012024_113340

from qtile.

avnibilgin avatar avnibilgin commented on June 9, 2024

I reduced the sleep(0.5) to sleep(0.1) and now you don't notice any delay. Thanks man, even after a year I wouldn't come up with this solution....

from qtile.

avnibilgin avatar avnibilgin commented on June 9, 2024

Yes, thank you again for taking so long and not slacking off in finding a solution.

from qtile.

avnibilgin avatar avnibilgin commented on June 9, 2024

Yes, thanks for the feedback. In fact, it's interesting to me. Soon I will take such cases into account when looking for a solution or at least keep them in the back of my mind!

from qtile.

avnibilgin avatar avnibilgin commented on June 9, 2024

I don't want to be rude and take up even more of your time, but I would like to ask you a few questions about the error messages in the log, which you pointed out to me with the following quote:

Well you've got some other errors with your config but ...

These are the error messages I get regularly and I'll post the corresponding config.py passages so you know what they are. I can't fix these errors.

2024-01-17 13:43:27,692 WARNING libqtile config.py:<module>():L60 Using config.py with x11
2024-01-17 13:43:27,692 WARNING libqtile config.py:<module>():L71 Status bar: qtile
2024-01-17 13:43:27,712 WARNING libqtile config.py:<module>():L561 Loading qtile bar
2024-01-17 13:43:27,922 WARNING libqtile manager.py:grab_key():L477 Key spec duplicated, overriding previous: <Key (['mod4'], 1)>
2024-01-17 13:43:27,923 WARNING libqtile manager.py:grab_key():L477 Key spec duplicated, overriding previous: <Key (['mod4', 'shift'], 1)>
2024-01-17 13:43:27,923 WARNING libqtile manager.py:grab_key():L477 Key spec duplicated, overriding previous: <Key (['mod4', 'control'], 1)>
2024-01-17 13:43:27,923 WARNING libqtile manager.py:grab_key():L477 Key spec duplicated, overriding previous: <Key (['mod4'], 2)>
2024-01-17 13:43:27,923 WARNING libqtile manager.py:grab_key():L477 Key spec duplicated, overriding previous: <Key (['mod4', 'shift'], 2)>
2024-01-17 13:43:27,924 WARNING libqtile manager.py:grab_key():L477 Key spec duplicated, overriding previous: <Key (['mod4', 'control'], 2)>
2024-01-17 13:43:27,924 WARNING libqtile manager.py:grab_key():L477 Key spec duplicated, overriding previous: <Key (['mod4'], 3)>
2024-01-17 13:43:27,924 WARNING libqtile manager.py:grab_key():L477 Key spec duplicated, overriding previous: <Key (['mod4', 'shift'], 3)>
2024-01-17 13:43:27,924 WARNING libqtile manager.py:grab_key():L477 Key spec duplicated, overriding previous: <Key (['mod4', 'control'], 3)>
2024-01-17 13:43:27,924 WARNING libqtile manager.py:grab_key():L477 Key spec duplicated, overriding previous: <Key (['mod4'], 4)>
2024-01-17 13:43:27,925 WARNING libqtile manager.py:grab_key():L477 Key spec duplicated, overriding previous: <Key (['mod4', 'shift'], 4)>
2024-01-17 13:43:27,925 WARNING libqtile manager.py:grab_key():L477 Key spec duplicated, overriding previous: <Key (['mod4', 'control'], 4)>
2024-01-17 13:43:27,925 WARNING libqtile manager.py:grab_key():L477 Key spec duplicated, overriding previous: <Key (['mod4'], 5)>
2024-01-17 13:43:27,925 WARNING libqtile manager.py:grab_key():L477 Key spec duplicated, overriding previous: <Key (['mod4', 'shift'], 5)>
2024-01-17 13:43:27,925 WARNING libqtile manager.py:grab_key():L477 Key spec duplicated, overriding previous: <Key (['mod4', 'control'], 5)>
2024-01-17 13:43:27,926 WARNING libqtile manager.py:grab_key():L477 Key spec duplicated, overriding previous: <Key (['mod4'], 6)>
2024-01-17 13:43:27,926 WARNING libqtile manager.py:grab_key():L477 Key spec duplicated, overriding previous: <Key (['mod4', 'shift'], 6)>
2024-01-17 13:43:27,926 WARNING libqtile manager.py:grab_key():L477 Key spec duplicated, overriding previous: <Key (['mod4', 'control'], 6)>
2024-01-17 13:43:39,514 ERROR libqtile hook.py:fire():L903 Error in hook client_new
Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/libqtile/hook.py", line 901, in fire
    i(*args, **kwargs)
  File "/home/thor/.config/qtile/config.py", line 696, in modify_window
    if not group.windows:
           ^^^^^^^^^^^^^
AttributeError: 'Group' object has no attribute 'windows'
2024-01-17 13:44:51,112 ERROR libqtile hook.py:fire():L903 Error in hook client_new
Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/libqtile/hook.py", line 901, in fire
    i(*args, **kwargs)
  File "/home/thor/.config/qtile/config.py", line 696, in modify_window
    if not group.windows:
           ^^^^^^^^^^^^^
AttributeError: 'Group' object has no attribute 'windows'

I attribute the error messages related to keybinding to this config.py setting: dgroups_key_binder = simple_key_binder(mod)

And I attribute the error messages related to the “hook client_new” to this hook:

@hook.subscribe.client_new
def modify_window(client):
    # Gruppe "Scratchpad" ausschließen
    for group in groups:
        match = next((m for m in group.matches if m.compare(client)), None)
        if match:
            targetgroup = qtile.groups_map[group.name]  # Verwende qtile.groups_map, um die richtige Gruppe zu erhalten
            targetgroup.toscreen(toggle=False)
            break
    else:
        # Falls kein Gruppenmatch, in die erste freie Gruppe
        for group in groups:
            if not group.windows:
                group.toscreen(toggle=False)
                break

Where could the errors lie?

from qtile.

avnibilgin avatar avnibilgin commented on June 9, 2024

I don't have any custom keybindings for the keybindings pointed out in the error log. So there are definitely no duplicate keybindings. For example, all keybindings that are affected such as: "mod4+1", "mod4+shift+1" or "mod4+ctrl+1" are all keybindings specified by the qtile and do not appear in my config.py.

from qtile.

avnibilgin avatar avnibilgin commented on June 9, 2024

Okay, I did it like you said. Here is the new hook:

@hook.subscribe.client_new
def modify_window(client):
     # Exclude group "Scratchpad".
     for group in groups:
         match = next((m for m in group.matches if m.compare(client)), None)
         if match:
             targetgroup = qtile.groups_map[group.name]
             targetgroup.toscreen(toggle=False)
             break
     else:
         # If no group match, in the first free group
         for group in groups:
             if not qtile.groups_map[group.name].info()["focus"]:
                 qtile.groups_map[group.name].toscreen(toggle=False)
                 break

No error message appears in the log anymore. Thanks again. This is a very useful hook because I often move windows to different groups and I want to follow the window into the group instead of staying in the old group.

from qtile.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.