hyprland-community/pyprland

[BUG] Clent address is invalid for scratchpad plugin

Closed this issue · 2 comments

Pyprland version
Which version did you use? (copy & paste the string returned by pypr version)

2.2.20-49

Describe the bug
On startup I see the error

Pypr integrity check failed on event scratchpads::event_openwindow: Client address invalid

After this attempting to use the scratchpad plugin results in a error notification reading

Pypr integrity check failed on event scratchpads::run_toggle: Client address invalid

To Reproduce
Steps to reproduce the behavior:

  1. run pypr
  2. See first error message
  3. run pypr toggle term
  4. See second error message

Expected behavior
A working terminal scratch pad

Configuration (provide following files/samples when relevant):

  • pyprland.toml
  • hyprland.conf

pyprland.toml

Pypr integrity check failed on event scratchpads::run_toggle: Client address invalid
[pyprland]
plugins = [
  "scratchpads",
]

[scratchpads.term]
animation = "fromRight"
command = "kitty --class kitty-dropterm"
match_by="class"
process_tracking = false
class = "kitty-dropterm"
size = "75% 60%"

Additional context
Add any other context about the problem here.

Running nixos, both hyprwm and pyprland built from flakes.

hypctrl version -j

{
    "branch": "",
    "commit": "2ead1fd22103ce065661555513bace5897083ded",
    "dirty": false,
    "commit_message": "",
    "commit_date": "2024-05-17",
    "tag": "",
    "commits": "",
    "flags": []
}

Logs

DEBUG=1 pypr 
                      ipc - Logger "ipc" initialized // common.py:185
                  startup - Logger "startup" initialized // common.py:185
                     pypr - Logger "pypr" initialized // common.py:185
                     pypr - Loading /home/andrew/.config/hypr/pyprland.toml // command.py:89
                 pyprland - Logger "pyprland" initialized // common.py:185
                 pyprland - version // ipc.py:80
                 pyprland - No tag available, assuming a recent git version. // pyprland.py:27
                 pyprland - activeworkspace // ipc.py:80
                 pyprland - monitors // ipc.py:80
                 pyprland - configured // command.py:154
              scratchpads - Logger "scratchpads" initialized // common.py:185
              scratchpads - monitors (CACHE HIT) // ipc.py:78
              scratchpads - keyword ['windowrule float,^(kitty-dropterm)$', 'windowrule workspace special:scratch_term silent,^(kitty-dropterm)$', 'windowrule move 680 -200%,^(kitty-dropterm)$', 'windowrule size 1200 600,^(kitty-dropterm)$'] // ipc.py:127
              scratchpads - term is not running, starting... // __init__.py:232
              scratchpads - scratch term (kitty --class kitty-dropterm) has pid 11070 // __init__.py:253
              scratchpads - starting term // __init__.py:207
              scratchpads - ==> Wait for term spawning // __init__.py:161
              scratchpads - clients // ipc.py:80
[0.161] [glfw error 65544]: process_desktop_settings: failed with error: [org.freedesktop.DBus.Error.UnknownMethod] No such interface “org.freedesktop.portal.Settings” on object at path /org/freedesktop/portal/desktop
              scratchpads - clients // ipc.py:80
              scratchpads - => term client (proc:11070, addr:0x348d78b0) detected on time // __init__.py:172
              scratchpads - keyword windowrule unset,^(kitty-dropterm)$ // ipc.py:127
              scratchpads - configured // command.py:154
            menus adapter - Logger "menus adapter" initialized // common.py:185
        fetch_client_menu - Logger "fetch_client_menu" initialized // common.py:185
        fetch_client_menu - configured // command.py:154
                     pypr - ================================[ initialized ]================================= // command.py:355
                 pyprland - event_activewindowv2('349ce180',) // command.py:177
                 pyprland - Active window is incorrect: 349ce180. // pyprland.py:56
              scratchpads - event_activewindowv2('349ce180',) // command.py:177
              scratchpads - event_openwindow('348d78b0,special:scratch_term silent,kitty-dropterm,kitty',) // command.py:177
                     pypr - This could be a bug in Pyprland, if you think so, report on https://github.com/fdev31/pyprland/issues // command.py:185
Traceback (most recent call last):
  File "/nix/store/ip19chf6gb8prjh9s5j0w57kxwqlzlvf-python3.11-pyprland-2.2.20/lib/python3.11/site-packages/pyprland/command.py", line 183, in _run_plugin_handler
    await getattr(plugin, full_name)(*params)
  File "/nix/store/ip19chf6gb8prjh9s5j0w57kxwqlzlvf-python3.11-pyprland-2.2.20/lib/python3.11/site-packages/pyprland/plugins/scratchpads/__init__.py", line 365, in event_openwindow
    await item.initialize(self)
  File "/nix/store/ip19chf6gb8prjh9s5j0w57kxwqlzlvf-python3.11-pyprland-2.2.20/lib/python3.11/site-packages/pyprland/plugins/scratchpads/objects.py", line 77, in initialize
    await self.update_client_info()
  File "/nix/store/ip19chf6gb8prjh9s5j0w57kxwqlzlvf-python3.11-pyprland-2.2.20/lib/python3.11/site-packages/pyprland/plugins/scratchpads/objects.py", line 140, in update_client_info
    client_info = await self.get_client_props(addr=self.full_address, clients=clients)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/ip19chf6gb8prjh9s5j0w57kxwqlzlvf-python3.11-pyprland-2.2.20/lib/python3.11/site-packages/pyprland/ipc.py", line 206, in get_client_props
    assert len(addr) > MINIMUM_ADDR_LEN, "Client address is invalid"
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: Client address is invalid
                      ipc - notify 0 5000 rgb(ff1010)  Pypr integrity check failed on scratchpads::event_openwindow: Client address is invalid // ipc.py:127

Pushed a fix for it, I added more checks recently and didn't expect such short addresses even though in theory it's possible...

Pulled the latest and it works fine. Thanks!