Bug 420870 - Long tabs get too much of the space in tab bar
Summary: Long tabs get too much of the space in tab bar
Status: RESOLVED FIXED
Alias: None
Product: dolphin
Classification: Applications
Component: bars: location (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Dolphin Bug Assignee
URL:
Keywords: usability
Depends on:
Blocks:
 
Reported: 2020-05-01 19:04 UTC by sdfjsfjaei-hans
Modified: 2023-08-17 07:22 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
window with multiple tabs open (thin window) (84.47 KB, image/png)
2020-05-01 19:04 UTC, sdfjsfjaei-hans
Details
window with multiple tabs open (wide window) (107.62 KB, image/png)
2020-05-01 19:05 UTC, sdfjsfjaei-hans
Details
Python program to illustrate how the size could be calculated (1.33 KB, text/x-python)
2020-05-01 19:06 UTC, sdfjsfjaei-hans
Details
Python program to illustrate how the size could be calculated (bug fixed) (1.13 KB, text/x-python)
2020-05-01 20:23 UTC, sdfjsfjaei-hans
Details

Note You need to log in before you can comment on or make changes to this bug.
Description sdfjsfjaei-hans 2020-05-01 19:04:17 UTC
Created attachment 128072 [details]
window with multiple tabs open (thin window)

SUMMARY
While it totally makes sense that tabs with a lot of text get a lot of the space, there should be some limit, because the shorter the tab text, the more important each letter is for recognizing which folder that tab corresponds to.


STEPS TO REPRODUCE
1. on command line: cd /tmp && mkdir test && cd test && mkdir "2019 - normal folder name" && mkdir "relatively short folder name" && mkdir "this is a very long folder name that dominates all other tabs which seems a bit suboptimal since the user probably would be okay with just the beginning"

This is what the directory tree looks like:

/tmp/test
├── 2019 - normal folder name
├── relatively short folder name
└── this is a very long folder name that dominates all other tabs which seems a bit suboptimal since the user probably would be okay with just the beginning


2. Enter /tmp/test in Dolphin and open the tabs in Dolphin


OBSERVED RESULT
The tab for the folder with the very long name takes almost all the space of the tab bar. Resizing the window gives the tab that's already pretty long even more space. (See attachments.)


EXPECTED RESULT
For the tabs with little text to get enough space to make them (more) readable. I actually had the problem where a long folder name was making it hard to discern what the other tabs contain.

I've attached a Python file to illustrate how that algorithm could work. (Basically it adds the length of each tab text to a list. Then it brings each length in that list nearer to the average of said list.)


This is the output:


# length   name

    25:    2019 - normal folder name
    28:    relatively short folder name
   152:    this is a very long folder name that dominates all other tabs which seems a bit suboptimal since the user probably would be okay with just the beginning

average tab length: 68.33333333333333

 43.78:    2019 - normal folder name
 44.27:    relatively short folder name
 82.00:    this is a very long folder name that dominates all other tabs which seems a bit suboptimal since the user probably would be okay with just the beginning


Simulate tab bar (I know it's a lot more complex in reality)
------------------------------------------------------------

| 2019 - normal fold… | relatively short f… | this is a very long folder name t… | 



SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Kubuntu 18.04
KDE Plasma Version: 5.12.9 
KDE Frameworks Version: 5.47.0
Qt Version: 5.9.5

It would be cool if someone could test if this is still an issue in the latest version. (following the above steps to reproduce).


Thanks for KDE =)
Comment 1 sdfjsfjaei-hans 2020-05-01 19:05:12 UTC
Created attachment 128073 [details]
window with multiple tabs open (wide window)
Comment 2 sdfjsfjaei-hans 2020-05-01 19:06:25 UTC
Created attachment 128074 [details]
Python program to illustrate how the size could be calculated
Comment 3 Nate Graham 2020-05-01 19:35:28 UTC
Yeah I agree this could use a bit of polishing to make sure that tabs with long text can't infinitely expand. One solution could be to make all tabs auto-expand so they're all the same width. I'm sure there are other options.
Comment 4 sdfjsfjaei-hans 2020-05-01 20:23:29 UTC
Created attachment 128079 [details]
Python program to illustrate how the size could be calculated (bug fixed)

removed the default complex part that was actually buggy for very very long tab names. Now all it does is append 'current + (average - current)*0.65' to a list, and then use that list as weights for the tab size.
Comment 5 sdfjsfjaei-hans 2020-05-01 20:37:56 UTC
Thanks for the quick response Nate! 

Is this actually a general Plasma thing that could be addressed? (So that all KDE apps could benefit from such a change. If that would be reasonable..) I wondered about that after having written the bug report, but wasn't sure which project to choose besides Dolphin for the report.
Comment 6 Christoph Feck 2020-05-01 20:41:18 UTC
Default tab widths for KDE applications are computed in QTabBar from QtWidgets library.
Comment 7 Bug Janitor Service 2023-08-15 00:37:04 UTC
A possibly relevant merge request was started @ https://invent.kde.org/system/dolphin/-/merge_requests/592
Comment 8 Méven Car 2023-08-17 07:22:52 UTC
Git commit 1165a1bc52cdeb2f6538a47c74b34bf283543ba7 by Méven Car, on behalf of K. Cottonears.
Committed on 17/08/2023 at 09:22.
Pushed by meven into branch 'master'.

Set Maximum Tab Width for folders to Tab bar

There is no limit to the width of tabs with the tab bar of the main window. If the directory name is too long, tabs can take up a lot of space and can lead to inconsistent tab widths.

To alleviate this, set a maximum tab bar text width of 40 characters for each folder.

M  +2    -1    src/dolphintabwidget.cpp

https://invent.kde.org/system/dolphin/-/commit/1165a1bc52cdeb2f6538a47c74b34bf283543ba7