focus-last.py: Terminate threads and re-instantiate after a broken pipe #179
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When restarting i3 the socket connection with the script is lost (broken pipe), requiring manual restart of the script and also optionally killing the previous rogue instance(s).
This PR invents a stopping mechanism for the threads which then re-instantiate
FocusWatcher
after a broken pipe exception is detected, thereby providing uninterrupted operation of the script between restarts. (It takes a few seconds until it re-establishes)The last remembered window is lost but registry continues on the new session as the user keeps changing focus.
Maybe someone else can assist to implement persistent history?
Fixes and improvements are welcome