Closed andresilva closed 7 months ago
Can you provide the pypr logs when this happens ? I can turn off a monitor & don't get this issue... I would like to understand which plugin creates this problem.
Mar 12 14:32:10 systemd[3470]: Started pyprland.
Mar 12 21:10:59 pypr[3851]: scratchpads::event_monitorremoved(('DP-1',)) failed:
Mar 12 21:10:59 pypr[3851]: no focused monitor
Mar 12 21:10:59 pypr[3851]: Traceback (most recent call last):
Mar 12 21:10:59 pypr[3851]: File "/nix/store/9yckjzm6zlkb4bs8b3lasmx0825b5pv9-pyprland-2.0.8/lib/python3.11/site-packages/pyprland/command.py", line 144, in _run_plugin_handler
Mar 12 21:10:59 pypr[3851]: await getattr(plugin, full_name)(*params)
Mar 12 21:10:59 pypr[3851]: File "/nix/store/9yckjzm6zlkb4bs8b3lasmx0825b5pv9-pyprland-2.0.8/lib/python3.11/site-packages/pyprland/plugins/scratchpads.py", line 608, in event_monitorremoved
Mar 12 21:10:59 pypr[3851]: await self.run_hide(scratch.uid, autohide=True)
Mar 12 21:10:59 pypr[3851]: File "/nix/store/9yckjzm6zlkb4bs8b3lasmx0825b5pv9-pyprland-2.0.8/lib/python3.11/site-packages/pyprland/plugins/scratchpads.py", line 918, in run_hide
Mar 12 21:10:59 pypr[3851]: await self._anim_hide(animation_type, scratch)
Mar 12 21:10:59 pypr[3851]: File "/nix/store/9yckjzm6zlkb4bs8b3lasmx0825b5pv9-pyprland-2.0.8/lib/python3.11/site-packages/pyprland/plugins/scratchpads.py", line 756, in _anim_hide
Mar 12 21:10:59 pypr[3851]: off_x, off_y = await self.get_offsets(scratch)
Mar 12 21:10:59 pypr[3851]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Mar 12 21:10:59 pypr[3851]: File "/nix/store/9yckjzm6zlkb4bs8b3lasmx0825b5pv9-pyprland-2.0.8/lib/python3.11/site-packages/pyprland/plugins/scratchpads.py", line 749, in get_offsets
Mar 12 21:10:59 pypr[3851]: return await scratch.get_auto_offset(monitor)
Mar 12 21:10:59 pypr[3851]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Mar 12 21:10:59 pypr[3851]: File "/nix/store/9yckjzm6zlkb4bs8b3lasmx0825b5pv9-pyprland-2.0.8/lib/python3.11/site-packages/pyprland/plugins/scratchpads.py", line 184, in get_auto_offset
Mar 12 21:10:59 pypr[3851]: monitor = await get_focused_monitor_props(self.log)
Mar 12 21:10:59 pypr[3851]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Mar 12 21:10:59 pypr[3851]: File "/nix/store/9yckjzm6zlkb4bs8b3lasmx0825b5pv9-pyprland-2.0.8/lib/python3.11/site-packages/pyprland/ipc.py", line 153, in get_focused_monitor_props
Mar 12 21:10:59 pypr[3851]: raise RuntimeError("no focused monitor")
Mar 12 21:10:59 pypr[3851]: RuntimeError: no focused monitor
It happens with scratchpads which is the only plugin I'm using.
So it only happens at the moment a monitor is removed while there was a scratchpad visible on it, isn't it ?
It happens when the scratchpad is hidden. Here's my config as well, in case it helps to debug:
[pyprland]
plugins = ["scratchpads"]
[scratchpads.term]
command = "foot -a foot-scratchpad"
class = "foot-scratchpad"
animation = "fromTop"
unfocus = "hide"
size = "50% 50%"
margin = 300
Are you able to use the latest git version? I can't reproduce but I may have some idea to solve the problem... it would be great if you can test it after I commit the code!
Yes no problem. Just let me know here when the change lands in master and I'll test it and report back.
Here it is
Seems like it solves the issue, no longer getting that exception in the logs.
Pyprland version
2.1.1
Describe the bug
Whenever the monitor gets disconnected (because of DPMS), I get an error notification saying "no focused monitor". This is a bit annoying since turning off the monitor on idle is normal and expected behavior. Would it be possible to silence this error?
To Reproduce Steps to reproduce the behavior: