You are not logged in.

#1 2020-02-09 18:39:15

Yann
Member
Registered: 2017-11-23
Posts: 175

[SOLVED] GTK different settings regarding application

Hi everyone,

I am on archlinux with i3wm (updated). Most of my applications are GTK graphical interface.
I observed that if I set the size font in the ~/.config/gtk-3.0/settings.ini file, then it is good for some applications such as brave but tiny for others such as pcmanfm (vice and versa).

My first question is: Is it possible to have custom confs per applications?
I already use the  "-fn xft:DejaVuSansMono:size=" command for the ones that support it. It looks that there are several ways to manage the GUI size for GTK applications (such as resetting the XDG_CONFIG_HOME before launching) but not a global standard way.

Also, I have a dual monitor with a 4K external monitor, is it possible to have a custom conf regarding the monitor the app is opened in?

Thanks for your time.

Last edited by Yann (2020-02-23 13:19:08)


all different - all equal

Offline

#2 2020-02-18 23:13:06

ChaManO
Member
From: Pozuelo de Alarcón
Registered: 2015-09-22
Posts: 29

Re: [SOLVED] GTK different settings regarding application

Hi Yann,
In most systems three or more versions of GTK coexist, kinda like python. There even are several versions of GTK3, as far as I know. The two applications that I use to manage the two or more versions of GTK are lxappearance which has no dependencies and is a package of the same name, and gtk-chtheme.
If you set your settings in both it should work for almost all GTK applications.

Edit: Sorry, looks like I misread your question. I'm unsure if you can have different settings per application.

Last edited by ChaManO (2020-02-18 23:17:45)

Offline

#3 2020-02-20 15:00:25

seth
Member
Registered: 2012-09-03
Posts: 13,725

Re: [SOLVED] GTK different settings regarding application

I assume the actual issue is

I have a dual monitor with a 4K external monitor, is it possible to have a custom conf regarding the monitor the app is opened in?

and the answer is no.

The clients can detect which output they reside on, what the physical resolution is and scale accordingly, but afaik only Qt5 does this atm.

Do you use pcmanfm or pcmanfm-gtk3?

Offline

#4 2020-02-20 15:42:49

Yann
Member
Registered: 2017-11-23
Posts: 175

Re: [SOLVED] GTK different settings regarding application

Thanks for your time both,

I did some digging and understood that I am facing two different issues.

The first one is the ability of an application to manage text interface and scale interface when playing with the gtk settings. In general without any external monitor.
I understood that brave  doesn't adapt the scale interface, only the text interface when changing gtk-font-name= in settings.ini.
To modify the scale interface I need to use the --force-device-scale-factor= argument parameter.
But it seems that pcmanfm-gtk3 manages both, the text and the scale interface.

The second problem is the ability to manage these scales regarding the monitor and its resolution.
It seems that, neither brave nor pcmanfm-gtk3 have the ability to manage that.

I have seen this article and I understand that depending of the app, some of these features are supported or not.

So, what is my solution, pass all my application to qt5? Is it only possible?
Is it possible to set properly different settings regarding the graphical application I want to start?

Thanks for your time.


all different - all equal

Offline

#5 2020-02-20 16:13:47

seth
Member
Registered: 2012-09-03
Posts: 13,725

Re: [SOLVED] GTK different settings regarding application

Offline

#6 2020-02-20 16:18:17

Yann
Member
Registered: 2017-11-23
Posts: 175

Re: [SOLVED] GTK different settings regarding application

Done several times.

Also, at the application section, it says

wiki wrote:

As a general rule, applications can be launched with a custom scaling value, e.g. $ atom --force-device-scale-factor=2.

Could you confirm me that this is not the case for pcmanfm-gtk3?


all different - all equal

Offline

#7 2020-02-20 16:49:47

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 8,713

Re: [SOLVED] GTK different settings regarding application

Those are for electron applications. So that specific line should work for brave (or rather the chromium example should be adaptable to brave)

For GTK3 see: https://wiki.archlinux.org/index.php/Hi … _3_(GTK_3) (for that you don't necessarily need to export globally, starting a single application with only that variable overriden is also possible with GDK_SCALE=2 $application)

Last edited by V1del (2020-02-20 16:52:17)

Online

#8 2020-02-20 18:33:51

Yann
Member
Registered: 2017-11-23
Posts: 175

Re: [SOLVED] GTK different settings regarding application

Thanks for the reply,

The GDK_SCALE=2 $application is something to know.
However, I noticed 2 others issues:

  • GTK apps and electron apps look both at the gtk-3.0/settings.ini conf
    however, they are not calibrated the same way, the gtk-font-name parameter define the font size. When the font size is ok for electron's apps it is not anymore for the GTK's ones.
    the only way I see is creating a wrapper to launch the apps with a step changing the gtk-font-name line in the gtk-3.0/settings.ini conf file before launching the app. But this looks bad, isn't it another way?

  • the GDK_SCALE parameter must be integer and make lose lots of flexibility


all different - all equal

Offline

#9 2020-02-20 21:43:11

seth
Member
Registered: 2012-09-03
Posts: 13,725

Re: [SOLVED] GTK different settings regarding application

https://wiki.archlinux.org/index.php/Hi … _3_(GTK_3)

Text scaling (also) relies on "GDK_DPI_SCALE" which can be floating point.
Chromium/electron has a tendency to ignore the freetype behavior which might/will lead to differences if the physical and logical resolution fall apart ("xrandr -q; xdpyinfo | grep resolution") and I'm not at hand sure whether and how the xft.dpi X11 resource is considered.

Offline

#10 2020-02-21 19:44:37

Yann
Member
Registered: 2017-11-23
Posts: 175

Re: [SOLVED] GTK different settings regarding application

GTK apps and electron apps look both at the gtk-3.0/settings.ini conf
However, on my system, they are not calibrated the same way, the gtk-font-name parameter defines the font size. When the font size is ok for electron's apps it is not anymore for the GTK's ones.
The only way I see is creating a wrapper to launch the apps with a step changing the gtk-font-name line in the gtk-3.0/settings.ini conf file before launching the app.
But this looks terrible to me, do you see another way?


all different - all equal

Offline

#11 2020-02-21 20:13:39

seth
Member
Registered: 2012-09-03
Posts: 13,725

Re: [SOLVED] GTK different settings regarding application

When the font size is ok for electron's apps it is not anymore for the GTK's ones.

How exactly is the relation?
Did you try the GDK_DPI_SCALE variable to impact either text?

Offline

#12 2020-02-22 11:45:14

Yann
Member
Registered: 2017-11-23
Posts: 175

Re: [SOLVED] GTK different settings regarding application

Sorry, I said a mistake.
I am just comparing two applications, brave and pcmanfm-gtk3.

settings:

$ cat gtk-3.0/settings.ini
gtk-font-name=Ubuntu 11

The two applications have the same text size.
In this case, the size of the font in the text in the tabs of brave is good. And if I add --force-device-scale-factor=X (depending of the monitor I want to open it in) to brave, I am still good, the proportions remain good.

However, in pcmanfm-gtk3, as we can't see the size of the buttons (delimiters are transparents), only the text size affect the global user experience, moreover the only options I have for it is GDK_SCALE (integer) and GDK_DPI_SCALE.
With this config and GDK_SCALE=1, the user interface is too small for my both monitors and if I set GDK_SCALE=2 the interface is too big with this gtk-font-name=Ubuntu 11 settings (buttons too).
But if I set gtk-font-name=Ubuntu 16 before opening pcmanfm-gtk3 the user interface is good for my laptop monitor (FHD) and I almost ok for my UHD external monitor (gtk-font-name=Ubuntu 16 is better)

So, I observe that I can not have corresponding settings for these 2 applications. The solution would be to have GDK_SCALE capable of being a float (1.7 e.g.), I am surprised that the gtk project doesn't furnish such thing.

To simplify, just with my FHD monitor laptop, the 2 applications are too tiny if run without parameters. But with the --force-device-scale-factor=1.2 argument, brave UI is good, moreover with gtk-font-name=Ubuntu 11. But I can not have good settings for the pcmanfm-gtk3 UI in this situation, GDK_SCALE=1 is too small and GDK_SCALE=2 is too large.
The only possibility I see is to play with the gtk-font-name=Ubuntu X setting before running the app, but this seems terrible.

Last edited by Yann (2020-02-22 11:49:43)


all different - all equal

Offline

#13 2020-02-22 15:11:54

seth
Member
Registered: 2012-09-03
Posts: 13,725

Re: [SOLVED] GTK different settings regarding application

as we can't see the size of the buttons (delimiters are transparents)

What buttons and what delimiters??

only the text size affect the global user experience

So did you try

GDK_DPI_SCALE=1.45 pcmanfm-gtk3

(which is, and only, affecting the font scale)?

Offline

#14 2020-02-22 20:22:46

Yann
Member
Registered: 2017-11-23
Posts: 175

Re: [SOLVED] GTK different settings regarding application

I was talking about the buttons at the top in the UI, "File", "Edit", etc.

You are right, GDK_SCALE=2 makes buttons too big and rough. But letting it GDK_SCALE=1 and playing then with GDK_DPI_SCALE=1.X makes the UI much better.
Seems to be the best solution. Thanks.

Does it exist a way to move an application between monitors (with different dpi) and get an auto scale of the application?
I guess, this is the responsibility of the GUI framework. Can Qt do that? Is it, in your opinion, a framework that is going to get a better support for this kind of thing in the future?

Thanks for your time.


all different - all equal

Offline

#15 2020-02-22 21:40:05

seth
Member
Registered: 2012-09-03
Posts: 13,725

Re: [SOLVED] GTK different settings regarding application

Does it exist a way to move an application between monitors (with different dpi) and get an auto scale of the application?

Not if the client doesn't adapt automatically (but it's possibly in theory)

Looking into my magic orb, the problem is the existance of outputs with drastically different physical DPIs that are used at the same time, typically your 4K 13" notebook and your FullHD 55" Tv or something.
Assuming this is a transitional issue (and outputs align at some higher DPI standard) and there're weird problems with such setup anyway (notably if the window covers both outputs) I'm less than hopeful that this will ever become better.

A possible general solution to this is to scale the entire output (ie. drive the HiDPI output at a lower resolution or scale up the "normal" DPI output, eg. w/ "xrandr … --scale …" and several wayland implementations do this as well) - the downside of the latter is a somwhat blurry image (because the physical reosolution doesn't magically become better)

Offline

#16 2020-02-23 13:18:48

Yann
Member
Registered: 2017-11-23
Posts: 175

Re: [SOLVED] GTK different settings regarding application

Ok for all the explanations. That makes sens to me.
Thanks for your time.


all different - all equal

Offline

Board footer

Powered by FluxBB