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

[FEAT] [Scratchpads] Improved error handling and recovery #125

Open
punk-dev-robot opened this issue Jul 12, 2024 · 4 comments
Open

[FEAT] [Scratchpads] Improved error handling and recovery #125

punk-dev-robot opened this issue Jul 12, 2024 · 4 comments
Assignees
Labels
enhancement New feature or request

Comments

@punk-dev-robot
Copy link

Is your feature request related to a problem? Please describe.
Sometimes when a scratchpad app crashes or I close it by mistake it causes pyprland to stop working, not only for that app but also for other scratchpads.

Describe the solution you'd like
It would be great if it could handle errors like that more gracefully and provide options to recover. Maybe a notify-send system notification with some actions like stop tracking relaunch (that would run exec again and update process_id)

@punk-dev-robot punk-dev-robot added the enhancement New feature or request label Jul 12, 2024
@fdev31
Copy link
Collaborator

fdev31 commented Jul 12, 2024

Can you provide a relatively simple setup which is a "worst case" in terms of scratchpad management when the window is closed ? (this is typically supported and isn't failing... so that must be with a specific config/unsupported app).

@axelKeizoStahl
Copy link
Contributor

@kuba-gaj
Can you give steps to reproduce? When using Firefox and Kitty, I close kitty and when trying to reopen kitty it launches again and everything is alright.

@punk-dev-robot
Copy link
Author

I think it's mostly electron and pwa apps. But sometimes it feels random. I can replicate it easily with slack app:

[scratchpads.slack]
animation = "fromBottom"
command = "/usr/bin/slack --ozone-platform=wayland --enable-features=UseOzonePlatform,WebRTCPipeWireCapturer,WaylandWindowDecorations"
match_by = "initialTitle"
initialTitle = "re:.*Slack$"
class = "Slack"
size = "90% 90%"
max_size = "1920px 90%"
excludes = "*"

It is tracked by initialTitle because I think there was problem with class if I get logged out and see login screen first.
After closing slack or other scratchpads stop working, including kitty with an error:

1425   │ Jul 16 00:16:49 arch pypr[9887]: [07/16/24, 00:16:49:804] info: [VISIBILITY-STATE] (T033J3T2Y) Main window visibility state changed: hidden
1426   │ Jul 16 00:16:51 arch pypr[2840]: ERROR:scratch:The client window 0x582467562000 vanished
1427   │ Jul 16 00:16:51 arch pypr[2840]: scratchpads::run_toggle(('slack',)) failed:
1428   │ Jul 16 00:16:51 arch pypr[2840]: Traceback (most recent call last):
1429   │ Jul 16 00:16:51 arch pypr[2840]:   File "/usr/lib/python3.12/site-packages/pyprland/command.py", line 208, in _run_plugin_handler
1430   │ Jul 16 00:16:51 arch pypr[2840]:     await getattr(plugin, full_name)(*params)
1431   │ Jul 16 00:16:51 arch pypr[2840]:   File "/usr/lib/python3.12/site-packages/pyprland/plugins/scratchpads/__init__.py", line 464, in run_toggle
1432   │ Jul 16 00:16:51 arch pypr[2840]:     await asyncio.gather(*(asyncio.create_task(t()) for t in tasks))
1433   │ Jul 16 00:16:51 arch pypr[2840]:   File "/usr/lib/python3.12/site-packages/pyprland/plugins/scratchpads/__init__.py", line 726, in run_hide
1434   │ Jul 16 00:16:51 arch pypr[2840]:     await scratch.update_client_info(clients=clients)
1435   │ Jul 16 00:16:51 arch pypr[2840]:   File "/usr/lib/python3.12/site-packages/pyprland/plugins/scratchpads/objects.py", line 159, in update_client_info
1436   │ Jul 16 00:16:51 arch pypr[2840]:     raise KeyError(msg)
1437   │ Jul 16 00:16:51 arch pypr[2840]: KeyError: 'Client window 0x582467562000 not found'
1438   │ Jul 16 00:16:52 arch pypr[2840]: ERROR:scratch:The client window 0x582467562000 vanished
1439   │ Jul 16 00:16:52 arch pypr[2840]: scratchpads::run_toggle(('dropterm',)) failed:
1440   │ Jul 16 00:16:52 arch pypr[2840]: Traceback (most recent call last):
1441   │ Jul 16 00:16:52 arch pypr[2840]:   File "/usr/lib/python3.12/site-packages/pyprland/command.py", line 208, in _run_plugin_handler
1442   │ Jul 16 00:16:52 arch pypr[2840]:     await getattr(plugin, full_name)(*params)
1443   │ Jul 16 00:16:52 arch pypr[2840]:   File "/usr/lib/python3.12/site-packages/pyprland/plugins/scratchpads/__init__.py", line 464, in run_toggle
1444   │ Jul 16 00:16:52 arch pypr[2840]:     await asyncio.gather(*(asyncio.create_task(t()) for t in tasks))
1445   │ Jul 16 00:16:52 arch pypr[2840]:   File "/usr/lib/python3.12/site-packages/pyprland/plugins/scratchpads/__init__.py", line 549, in run_show
1446   │ Jul 16 00:16:52 arch pypr[2840]:     await self.run_hide(e_uid, autohide=True)
1447   │ Jul 16 00:16:52 arch pypr[2840]:   File "/usr/lib/python3.12/site-packages/pyprland/plugins/scratchpads/__init__.py", line 726, in run_hide
1448   │ Jul 16 00:16:52 arch pypr[2840]:     await scratch.update_client_info(clients=clients)
1449   │ Jul 16 00:16:52 arch pypr[2840]:   File "/usr/lib/python3.12/site-packages/pyprland/plugins/scratchpads/objects.py", line 159, in update_client_info
1450   │ Jul 16 00:16:52 arch pypr[2840]:     raise KeyError(msg)
1451   │ Jul 16 00:16:52 arch pypr[2840]: KeyError: 'Client window 0x582467562000 not found'

@fdev31 fdev31 changed the title [FEAT] Improved error handling and recovery [FEAT] [Scratchpads] Improved error handling and recovery Jul 16, 2024
@fdev31
Copy link
Collaborator

fdev31 commented Jul 19, 2024

I am not sure I want to add complexity for the PWA apps, I think it's already a bit borderline...
Can you see if #127 can be a solution to this problem too?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants