fix: suspend hover focus during tab rename#97
Open
Munawwar wants to merge 2 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Hi. First off, nice project. I like it and I use this everyday now.
I noticed that when "Hover terminal focus" toggle is enabled I could not rename tabs without accidentally focusing on terminal. So I couldn't type inside the tab rename text field (which is bug 1), nor could I focus back at it (which is bug 2). This change attempts to fix both.
Bug 1
The way I implemented is to try a skip the hover focus code path by checking if any tab (
one or more .. so had to use a counter¹) is in "rename" state. I don't know if this was the cleanest fix, and I know zero rust (did c++ before but not rust), and codex did helped me through.¹ after my fix of bug 2 it can only be 1 tab in rename state at a time .. so this was a bit too defensive .. but changing it from counter to boolean doesn't reduce LoC either, so 🤷♂️ going to keep it the way it is
Bug 2
On checking code for this bug, I realized the code was meant to exit rename state on focus exit. But it remained in a partial exited state as you can see in this video:
https://github.com/user-attachments/assets/80348bf2-113c-4b76-ac53-8a21c512ef89
My understanding is that one cant just mutate tab state within
connect_leaveevent as GTK focus transitioning hasn't fully finished yet, and that's why this bug happens. You have to wait a bit. So my idea is 1. dont even rely on that event, rather watch forhas-focusbecoming false as that feels more stable state and 2. then add a GTK idle state callback to exit from the "rename" state.