gitahead / gitahead

Understand your Git history!
https://gitahead.com
MIT License
1.84k stars 248 forks source link

GitAhead leaks QT_SCREEN_SCALE_FACTORS to external programs #440

Open ysalmon opened 4 years ago

ysalmon commented 4 years ago

I am using a high-DPI screen with KUbuntu 20.04. GitAhead (v. 2.6.2) has a nice appearance out of the box does not seem to have a nice appearance without setting QT_SCREEN_SCALE_FACTOR .

However, if I run the file browser or an external editor from GitAhead, that program's interface is way too big, because it already takes care of the high-DPI circumstances without needing this quirk.

After investigating, it seems that GitAhead is leaking the environment variable to that program : when run from GitAhead, my Dolphin and the associated console have QT_SCREEN_SCALE_FACTORS=2 whereas if launched directly from the Application menu, QT_SCREEN_SCALE_FACTORS=DVI-I-0=1;DVI-I-1=1;DP-0=1;DP-1=1; (I checked, and no other variable seems affected).

I cannot say when this bug appeared because I only seldomly use these GitAhead features.

exactly-one-kas commented 4 years ago

Do I understand correctly that you're running GitAhead like QT_SCREEN_SCALE_FACTORS=2 GitAhead?

ysalmon commented 4 years ago

Yes. At first I thought I was not, but I had forgotten that I had created an alias that set it silently.

exactly-one-kas commented 4 years ago

Then it's working as intended. Environment variables in UNIX(oids) are inherited by child processes. To (re)set them, they have to be set anew (eg by a wrapper script). I'd recommend using own .desktop files in ~/.local/share/applications. Entries in that folder should override existing ones in /usr/share/applications

ysalmon commented 4 years ago

That will be possible for the console and the external editor but currently not for the "Show in default File Browser" because, as far as I know, what it opens is not configurable.

BTW, setting the external editor command to

unset QT_SCREEN_SCALE_FACTORS ; xdg-open

does not work (GitAhead fails to run this) so one has to create a script or alias specially for use with GitAhead, which is cumbersome.

exactly-one-kas commented 4 years ago

GitAhead uses the default file browser (by calling xdg-open), so you can also override the browser's .desktop file.

With #312 I've added a setting for the file manager command, so you can use sh -c "unset QT_SCREEN_SCALE_FACTORS; xdg-open ""%1""". The external editor command uses the GIT settings, so this approach can't be used.

ysalmon commented 4 years ago

GitAhead uses the default file browser (by calling |xdg-open|), so you can also override the browser's .desktop file.

I do not think I should have to change the global configuration of my DE to accomodate for the hack that is needed to get a readable interface in GitAhead.

exactly-one-kas commented 4 years ago

Fair point. However, that's not an issue of environment variables, but Qt scaling.

My current setup is GDK_DPI_SCALE=1.25 as an env var and calling xrandr --dpi 120x120.