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

improvement: cut down the space wasted in sidebar #1711

Open
mckaygerhard opened this issue Dec 7, 2017 · 17 comments
Open

improvement: cut down the space wasted in sidebar #1711

mckaygerhard opened this issue Dec 7, 2017 · 17 comments

Comments

@mckaygerhard
Copy link

the geany sidebar are arrange by tabas.. but cannot be reordened and

if there more thant 3 tabs the vision are limited of thems due labels of each are too large

and if the sidebar are in vertical/horizontal there a waste of space

my suggestion its to optionally only show 3 firts letters or icon only like does with normal tool bar

i'm particular want to know how to only load 3 firts letters to cheap the space in small screen

geanywastedspace
geanywastedspacetabs

@codebrainz
Copy link
Member

"Markdown Preview" is an especially bad offender, I might have to change that to just "Preview" some day.

@elextr
Copy link
Member

elextr commented Dec 8, 2017

@codebrainz or just "MP" 😁

@elextr
Copy link
Member

elextr commented Dec 8, 2017

Well, apart from "Symbols" and "Documents" which we could abbreviate "Sym" and "Doc", all the tabs are from plugins, which have separate authors, and they may not be as agreeable as @codebrainz to cut their titles.

@mckaygerhard
Copy link
Author

umm so the changes must be done in each plugin? ok but must be an api and base to geany display that names, i think in that base of code just take the label and cut done to only 3 letters or only initials..

well so for a while i know where to start to adapt my installation/packages.. its a great community thanks

@codebrainz
Copy link
Member

ok but must be an api and base to geany display that names, i think in that base of code just take the label and cut done to only 3 letters or only initials

Geany core could iterate the tabs and if they contain label widgets, truncate/ellipsize their label text to a preset width. It wouldn't be very hard.

@elextr
Copy link
Member

elextr commented Dec 8, 2017

It would need to be a setting of number of, erm, bytes?, code points?, glyphs?, ems?, pixels?, mm? and of course a setting to leave the damn things alone. And translations?

@mckaygerhard
Copy link
Author

@elextr may have right, translations could be a problem, but if @codebrainz are in right direction and as i suspect, translation will be cut down

i cannot find where can be that, @codebrainz you said that dont be hard.. i'm not expert in GTK but i know something C, some started point?

@elextr
Copy link
Member

elextr commented Dec 8, 2017

@mckaygerhard the point of the long list of how to determine the length on tabs is that once you move beyond ASCII into other languages none of those simple methods work. Translations mean you don't know what the tab is called.

A fixed number of bytes is no good, it might fall in the middle of a multi-byte code point in some non-english language. Even a fixed number of code points won't work due to combining characters which mean two code points is one glyph, and not all glyphs are the same size so a fixed number of them may not work for some languages.

So you are left with physical sizes, although you can cut glyphs off so its not as nice, and fixed number of pixels means you are prey to monitor resolutions, and won't change with font sizes or zooming. Using mm avoids the monitor resolution issues but not font sizes or zoom, ems helps that further, but its all now becoming awfully complicated, and who knows if the GTK tab widgets can be controlled in that way, they do not seem to have a max-width CSS AFAICT.

@mckaygerhard
Copy link
Author

@elextr so then thanks to you clarifications, "for now" i can hardcoded my ide's compilations cutting that letters while i waith for this issue feature resolution, avoiting load tranlations (in my environment only russian and english are apart of spanish, no right to left langs are used)

@codebrainz
Copy link
Member

codebrainz commented Dec 8, 2017

By not very hard I meant something like this:

gint n = gtk_notebook_get_n_pages(nb);
for (gint i=0; i < n; n++)
{
  GtkWidget *wid = gtk_notebook_get_tab_label(nb,
    gtk_notebook_get_nth_page(i));
  if (GTK_IS_LABEL(wid))
  {
    gtk_label_set_ellipsize(GTK_LABEL(wid), PANGO_ELLIPSIZE_END);
    gtk_label_set_width_chars(GTK_LABEL(wid),
      interface_prefs.sidebar_tab_label_width);
  }
}

It should work fine with the normal (UTF-8) text that's in the tab labels, and has no impact on translations. It might need to switch PANGO_ELLIPSIZE_END to _START if the UI is in right-to-left mode, if GTK+ doesn't already handle this itself, but otherwise it should "just work" It's already direction agnostic.

@codebrainz
Copy link
Member

i cannot find where can be that, @codebrainz you said that dont be hard.. i'm not expert in GTK but i know something C, some started point?

I would think you could connect a callback function to the sidebar notebook's page-added signal and in that function, set the tab label's width (as above) for any tabs added. You might need a loop like above for startup because I think the sidebar notebook and a couple of Geany's built-in tabs are done in Glade, so you need to get them fixed up initially, but the page-added signal should do the trick for all plugins or other code adding tabs into the sidebar.

@codebrainz
Copy link
Member

It would need to be a setting of number of, erm, bytes?, code points?, glyphs?, ems?, pixels?, mm? and of course a setting to leave the damn things alone.

IMO, just a setting that is the number of chars to truncate at (as defined by Pango), and if set to zero (default), no truncation occurs.

@elextr
Copy link
Member

elextr commented Dec 9, 2017

@codebrainz yeah, if pango is doing the elipsizing then it might be ok, since its aware of all the language issues.

@mckaygerhard
Copy link
Author

hello friends @codebrainz and @elextr , what its the progress on that issue, and how i can made it manully for normal direction languajes, i just only cut down to 4 leterrs those tabas in some older versions that used GTK 2.18 and GLIB 2.24 i tried the code proposed by @elextr but no sucess and get many errors..

@elextr
Copy link
Member

elextr commented Apr 26, 2018

the code proposed by @elextr but no sucess and get many errors..

the code proposed by @codebrainz I think you mean.

what its the progress on that issue

AFAIK nobody is working on it, somebody who is interested needs to provide a pull request.

@vegnuli
Copy link

vegnuli commented Jan 19, 2021

hi! i'm interesting in this for my own purposes.. i want just a simple patch.. just cut down first 3 letters.. in witch part of code must be done? @elextr ? @codebrainz ? @mckaygerhard ? i'm not xpert in c! help!

@mckaygerhard
Copy link
Author

hi! i'm interesting in this for my own purposes.. i want just a simple patch.. just cut down first 3 letters.. in witch part of code must be done? @elextr ? @codebrainz ? @mckaygerhard ? i'm not xpert in c! help!

i guess: search at the code geany->main_widgets->sidebar_notebook and when you see gtk_notebook_append_page change the gtk_label_new string or cut off to 3 lettters

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

No branches or pull requests

4 participants