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

[GTK4] Disallow tab bar focussing #4885

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

danudey
Copy link
Contributor

@danudey danudey commented Jan 9, 2025

~Adds configuration to allow/~Disallow the Adwaita tab bar from gaining focus with an additional click. This is the default behaviour of the tab bar, and it allows users to use the arrow keys to navigate the tabs and then the tab key to move to the window surface.

Personally, I hate when this happens and don't ever want my tabs focussed by accident, so I thought it might make sense to add a configuration option functionality to prevent this from happening.

Works great with adwaita 1.5 (Ubuntu 24.04) and adwaita 1.1 (Ubuntu 22.04). Tab bars in 22.04 are showing up above the window title bar, but I'm not sure if that's related to this change that seems to be unrelated to this change that is resolved separately in #5410.

@tristan957
Copy link
Collaborator

I can't say that I agree with the premise. Why can't you just use keybinds with next_tab/previous_tab actions to fit your workflow?

@tristan957
Copy link
Collaborator

Tab bars in 22.04 are showing up above the window title bar, but I'm not sure if that's related to this change that seems to be unrelated to this change.

Known problem if you're interested in fixing it in a separate PR. Would be good to have a fix before the next release. I tried reproducing the issue but never could.

@jcollie
Copy link
Collaborator

jcollie commented Jan 21, 2025

Tab bars in 22.04 are showing up above the window title bar, but I'm not sure if that's related to this change that seems to be unrelated to this change.

Known problem if you're interested in fixing it in a separate PR. Would be good to have a fix before the next release. I tried reproducing the issue but never could.

I think that I solved that along with my menu reorganization PR (#4952), but that'll have to wait until Mitchell finishes his GTK App/Window refactor because I need to touch some of the same code.

@mitchellh
Copy link
Contributor

I don't love the configuration on this.

I think my question instead would be: is it desirable for the tab bar to EVER have keyboard focus? Is that a common thing? Tab navigation is already heavily bindable in Ghostty and I do agree with the premise that the tab bar getting focus from an extra click is not ideal.

@tristan957
Copy link
Collaborator

tristan957 commented Jan 24, 2025

I don't love the configuration on this.

I think my question instead would be: is it desirable for the tab bar to EVER have keyboard focus? Is that a common thing? Tab navigation is already heavily bindable in Ghostty and I do agree with the premise that the tab bar getting focus from an extra click is not ideal.

You know I checked what GNOME Text Editor does, and they seem to make the tab bar not focusable if you click on a tab. Though you can still tab through the widget tree to focus it if you try hard enough. I would say matching that behavior makes sense. Instead of call gtk_widget_can_focus() or whatever. The tab page contents should instead grab the focus.

The feature request makes sense to me, and we should definitely get it in for 1.1!

@mitchellh
Copy link
Contributor

The feature request makes sense to me, and we should definitely get it in for 1.1!

Fantastic. Thanks for doing the research. I agree. I think at least for 1.1, making the tab bar not focusable at all (as this PR does -- but without the config) seems fine. I think its far far far less desirable for that to ever gain focus than the incidental case you actually want it to via the keyboard or something.

@danudey
Copy link
Contributor Author

danudey commented Jan 28, 2025

Sorry for the delay, but I've taken out the configuration option and made it so that the "don't focus" functionality is the only behavior. PTAL and let me know if there's anything else you think could be improved.

@danudey
Copy link
Contributor Author

danudey commented Jan 28, 2025

Tab bars in 22.04 are showing up above the window title bar, but I'm not sure if that's related to this change that seems to be unrelated to this change.

Known problem if you're interested in fixing it in a separate PR. Would be good to have a fix before the next release. I tried reproducing the issue but never could.

@tristan957 Fixed in #5410

@danudey danudey changed the title [GTK4] Add config to disallow tab bar focussing [GTK4] Disallow tab bar focussing Jan 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants