Skip to content

gtk: add option to always display the tab bar #5590

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

pluiedev
Copy link
Member

@pluiedev pluiedev commented Feb 5, 2025

Also fixes crashes in both vanilla GTK and Adwaita implementations of closeTab, which erroneously close windows twice when there are no more tabs left (we probably already handle it somewhere else).

jcollie
jcollie previously approved these changes Feb 5, 2025
Copy link
Contributor

@mitchellh mitchellh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One request.

I also want to consider a bike shed on the config option. I wonder if we want to rename it to something like window-tab-bar and support like auto, always right now. There's some requests to have never already (weird but exist) and while I dont' want to support it now it'd let us reuse that config one day.

/// Whether tabs should always be displayed, regardless of how many tabs
/// are open. If false (default), the tab bar is only displayed when there
/// are two or more tabs.
@"window-always-show-tabs": bool = false,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should note it's only GTK for now. This has been requested on macOS as well so I'm interested in making it work there eventually.

@pluiedev
Copy link
Member Author

pluiedev commented Feb 5, 2025

Why would you want to have it as never... 🤦‍♀️ Though I guess it's not that hard to implement

@pluiedev pluiedev added os/linux gui GUI or app issue regardless of platform (i.e. Swift, GTK) labels Feb 9, 2025
@pluiedev
Copy link
Member Author

pluiedev commented Feb 10, 2025

So I've been thinking about this for a while, and I think it might be worthwhile to reorganize the config options pertaining to tab bars:

  • window-tab-bar = auto, always, none

    • auto is behavior we have right now, and none has roughly the same effect as gtk-tabs-location=hidden, but the tab bar is merely hidden instead of not being attached
  • window-tab-bar-position = top, bottom, (left, right?)

    • AFAICT macOS currently only supports top due to native tabbing limitations, but bottom could be supported when we move to a custom tabbing solution. left and right aren't included by default as it's not a design that libadwaita supports natively, but we could devise a hack later using something like AdwOverlaySplitView with the sidebar always visible.
  • Remove gtk-tabs-location and supersede it with the above two options

@pluiedev pluiedev added the feedback-requested Discussion needs feedback before anything can be done. label Feb 10, 2025
@lcgix0
Copy link

lcgix0 commented Feb 10, 2025

Why would you want to have it as never... 🤦‍♀️ Though I guess it's not that hard to implement

I can answer that. I prefer either slim tabs or none if it's drawn by libadwaita. My personal issue with libadwaita is the vertical space it requires for tabs (CSD and SSD), and that it doesn't respect (prob can't) what I have otherwise configured as GTK theme. Another, hopefully temporary, reason is that if tabs are always hidden (or always shown), it would remove a second cause of stretching other than using a tiling compositor.

@mitchellh
Copy link
Contributor

My personal issue with libadwaita is the vertical space it requires for tabs (CSD and SSD), and that it doesn't respect (prob can't) what I have otherwise configured as GTK theme.

Note you can also attempt to slim them down using our gtk-custom-css configuration option. I haven't verified if its possible or how easy it is, but on paper it should be possible.

Copy link
Contributor

@mitchellh mitchellh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small change request but the rest looks good. Feel free to merge at your desire if you feel its stable.

@pluiedev
Copy link
Member Author

I'm still not sure about the never case as it does basically the same (or even exactly the same when libadwaita is disabled) thing as gtk-tabs-location=hidden... Though I'm fine with only merging the always option

@pluiedev pluiedev requested a review from a team as a code owner February 11, 2025 17:18
@lcgix0
Copy link

lcgix0 commented Feb 11, 2025

I'm still not sure about the never case as it does basically the same (or even exactly the same when libadwaita is disabled) thing

Isn't libadwaita going to be hard dependency in the future? That's what I remember from the release notes. It's why I re-enabled it in my 1.1.0 build.

@pluiedev
Copy link
Member Author

Yeah - the difference is that on libadwaita gtk-tabs-location=hidden we display the number of tabs in a tab button, whereas window-tab-bar=never doesn't. I find that kinda silly...

/// overview or by keybind actions.
///
/// Currently only supported on Linux (GTK).
@"window-show-tab-bar": WindowShowTabBar = .auto,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we just remove gtk-tabs-location=hidden?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO probably yeah, but then we need to have a migration mechanism for people who are using that config. (See, I did tell everyone that we might run into more complex config migrations in the future 😅)

Copy link

@lcgix0 lcgix0 Feb 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After trying that out, I must revise my comment above and state that I find hidden tabs less practical than large tabs. Not sure why I thought it wouldn't be fully hidden or maybe auto-hidden. Sorry folks, my bad, thanks for listening to my opinion. I'll experiment with CSS.

@pluiedev pluiedev added this to the 1.2.0 milestone Feb 13, 2025
Copy link
Member

@jcollie jcollie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LGTM except that it needs rebased now that adwaita is required.

@chenzhiwei
Copy link

@pluiedev Hi, could you please rebase this PR?

Also fixes crashes in both vanilla GTK and Adwaita implementations of
`closeTab`, which erroneously close windows twice when there are no
more tabs left (we probably already handle it somewhere else).
@pluiedev pluiedev force-pushed the push-wnzrzpxzsxnk branch from e97a474 to acbca59 Compare March 14, 2025 11:40
@pluiedev
Copy link
Member Author

Rebased and replaced gtk-tabs-location=hidden with window-show-tab-bar=never. This is obviously a breaking change but we can add a migration mechanism in a different PR

@pluiedev pluiedev requested review from mitchellh and jcollie March 14, 2025 12:02
@chenzhiwei
Copy link

aha, conflicts again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feedback-requested Discussion needs feedback before anything can be done. gui GUI or app issue regardless of platform (i.e. Swift, GTK) os/linux
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants