prati0100 / git-gui

Tcl/Tk based UI for Git. I am currently acting as the project's maintainer.
160 stars 87 forks source link

Too small on Linux (HiDPI problem) #29

Open ctrlcctrlv opened 4 years ago

ctrlcctrlv commented 4 years ago

Even increasing font sizes isn't enough, as some fonts aren't included in that.

There should be a way to increase the scale of the entire application. It doesn't seem to respect GDK_SCALE, QT_AUTO_SCREEN_SCALE_FACTOR, et cetera.

prati0100 commented 4 years ago

Hi @ctrlcctrlv,

Could you be more specific about what the problem is? What exactly is wrong with increasing font size? Does it stop increasing in size after a certain point (IOW, does it hit a size cap)? Is this a problem with the entire UI or just some specific UI elements?

As for git-gui not respecting GDK_SCALE and QT_AUTO_SCREEN_SCALE_FACTOR, it is because git-gui is not based on GTK or QT, but on Tcl/Tk.

ThijsBroersen commented 4 years ago

I also noticed this problem. I am sure the scaling was fine a few days ago and now it suddenly ignores the scaling and everything is too small to read. I have no idea what has changed.

vn971 commented 4 years ago

Indeed this issue clearly needs more details. So here's the actual problem. This is how git gui currently looks like if you double the default font size: 2020 06 01_15:26:06

Another example: 2020 06 01_15:26:16

If you use a lower DPI monitor, like 1080p on 24", this might look more or less innocent (only the bigger font might seem too big). With a higher DPI, however, the bigger text becomes normal, and the smaller one becomes barely visible (or not visible at all).

In contrast, if I change all fonts in gitk, all or almost all UI elements change their scale. This includes window menus, commit tree, text, file list, preferences etc.

Is it possible for git gui to also scale all UI elements together with its "Main Font"?

vn971 commented 4 years ago

To test this situation, double the Main Font and Console Font (e.g. set to 18). Then look at the commit message, and move further away from monitor until the commit message font becomes "normal". Now look at other UI elements... They will seem way too small / unreadable.

barbogast commented 4 years ago

Would be great if this could be fixed, git gui is not usable in it's current form on a 4k laptop monitor. And I reeeaaally like it :cry:

Another screenshot for reference, with open github page for comparison:

image

Doubling the only makes a portion of the UI bigger. Also, the font in the right column has weird spacing issues. Not sure if that is also about HDPI.

prati0100 commented 4 years ago

I'll take a look at it in the next couple weeks but I can't promise anything because I have very limited free time available and I don't have a 4k monitor so I don't know how I can even test it.

vn971 commented 4 years ago

@prati0100 note that you can test it as I explain in my comment: https://github.com/prati0100/git-gui/issues/29#issuecomment-636868376

barbogast commented 4 years ago

Maybe good to know: On a Macbook with Retina display it works perfectly fine. I didn't even have to change the font-sizes.

@prati0100 Limited time and not having a monitor is an issue, I totally get it. Thanks in any case!

Edit: This sounds promising: https://wiki.tcl-lang.org/page/tk+scaling

ctrlcctrlv commented 4 years ago

You don't need a 4k monitor to use GDK display scaling.

Plenty of people with vision problems scale up their 1080p monitors with GDK/QT display scaling. GDK/QT won't reject the env vars simply because they detect output isn't 4k.

last-partizan commented 4 years ago

You can add Xft.dpi: ... to your Xresources file, and it will scale just fine.

https://wiki.archlinux.org/index.php/HiDPI#X_Resources

vn971 commented 4 years ago

@last-partizan Note that DPI is not scaling: it will only scale text-s, and it will break other apps. E.g. if you have an app with both pictures and text, text will be scaled with DPI, but pictures will remain the same.

Therefore, setting a global DPI would solve the issue for apps that only have text, but it would at the same time break other apps who could otherwise correctly scale via scaling factor.

last-partizan commented 4 years ago

I had tried to understand what's going on with this scaling.

On my desktop i'm using 27" monitor with 3840x2160 resolution.

I'm using gnome, with "Fonts/Scaling Factor = 1.6" set using gnome-tweaks. And apparently git-gui respects this setting. My fonts looks absolutely fine. When i check tk scaling, it is set to 1.3. Increasing it decreases font size for labels and buttons. Decreasing it, increases font sizes. On 13" laptop with 1080x1920 resolution tk scaling is also 1.3, font sizes is fine, and behaviur is the same.

When i boot into windows on my desktop and check tk scaling, it is set to 2.0, and fonts in git-gui have normal size. When i set it to 1 font size is halved. So, decreasing it decreases font size.

On 13" macbook with 2560x1600 resolution tk scaling is 1.0, and modifying it has no effect. Fonts looks fine.

mattip commented 3 years ago

For me (old eyes need bigger fonts) the problem is that the UI elements like button labels and labels in the configuration panel do not respect font_ui. So even if you double font_ui, some elements remain the same size.

rotty3000 commented 2 years ago

I don't know if this issue was resolved but I never suffered these issues until I used brew. When I install git and it's dependencies by building it from source, with Ubuntu's tcl-tk bundles, everything is rendered with appropriate scaling. In fact even after uninstalling git and git-gui from brew my original locally built git was still broken. Then I realized that brew had installed tcl-tk and that is where the issue was. Once I removed that, my original git was scaled correctly again.

So, on Ubuntu (at least) maybe installing git-gui by excluding tcl-tk dependency might solve it for someone. For me, I just returned to using git compiled from source.

ctrlcctrlv commented 2 years ago

This issue has not been resolved @rotty3000, but I will try your workaround next time I have a chance, and perhaps make a recommendation to the Arch maintainer if indeed that solves it, to exclude Tcl/Tk.

rotty3000 commented 2 years ago

Sounds good, and apologies for not sounding thankful for the hard work that goes into this project. I help maintain many open source projects so I know how tough it is. So thanks again for everyone's efforts. Keep it going!

ahmadsamir commented 2 years ago

Hello. I had the same issue, looking around in /usr/libexec/git/git-gui (probably installed in a different location in other distros), I don't know much about tck/tk, but in that file I saw gui.usettk which is a config option, looks like it sets whether to use platform "native" UI? I tried setting it to 0 in ~/.config/git/config: [gui] usettk = 0

and that seems to have worked, it made the "main font" config affect the whole UI.

From @aspiers post, this command does the job:

git config --global gui.usettk 0
aspiers commented 1 year ago

git config --global gui.usettk 0 worked for me too! With it set to 1, or unset, I see this horrible mix of font sizes:

image

ahmadsamir commented 1 year ago

Here is a patch to the git-gui man page (I looked at the contributing guidelines for git, and it is way too many steps to setup something I'll probably ever use once (I don't know Perl nor C)): 0001-git-gui-add-note-about-gui.usettk-setting-in-the-man.patch.txt

joshhansen commented 1 year ago

Hi, git config --global gui.usettk 0 helped a lot in making all fonts in git gui readable; however, the scrollbars are still extremely thin. As I use git gui constantly I'm just wondering if there's any way to adjust this as well. Here's what it looks like:

image

Here's my full configuration, git config -l:


user.email=...
color.diff=auto
color.status=auto
color.branch=auto
alias.st=status
giggle.main-window-maximized=false
giggle.main-window-geometry=700x550+210+25
giggle.main-window-view=FileView
http.proxy=
gui.fontui=-family "Liberation Sans" -size 14 -weight normal -slant roman -underline 0 -overstrike 0
gui.fontdiff=-family "Liberation Mono" -size 12 -weight normal -slant roman -underline 0 -overstrike 0
gui.usettk=0
cola.spellcheck=false
init.defaultbranch=master
filter.lfs.clean=git-lfs clean -- %f
filter.lfs.smudge=git-lfs smudge -- %f
filter.lfs.process=git-lfs filter-process
filter.lfs.required=true
merge.conflictstyle=diff3
merge.tool=meld
checkout.defaultremote=origin
core.bare=false
core.filemode=true
core.logallrefupdates=true
core.repositoryformatversion=0
gui.wmstate=normal
gui.geometry=3072x1535+0+0 1079 1125
gui.spellingdictionary=none
remote.origin.url=gh:joshhansen/Umpire.git
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
branch.feature/tarpcInClient.remote=origin
branch.feature/tarpcInClient.merge=refs/heads/master
branch.master.remote=origin
branch.master.merge=refs/heads/master```
ctrlcctrlv commented 1 year ago

This needs a real fix not font fuckery, indeed.