You are not logged in.

#1 2017-02-01 15:18:29

jon.reeve
Member
Registered: 2013-04-29
Posts: 22

Environment variable scope and HiDPI

I'm using the HiDPI fixes from the HiDPI wiki article, namely setting these environment variables in /etc/profile.d/gtk-hidpi.sh: 

export GDK_SCALE=2
export GDK_DPI_SCALE=0.5

and the .Xresources fixes. This mostly works, when I launch a GTK program myself, but when another program launches a GTK program, the scaling is undone, and the program looks illegibly small again. For instance, when I run GNOME Files (nautilus), everything is scaled correctly, but when I open a folder using Synapse, the scaling is half of what it should be. I can run Totem by launching it myself, and everything looks fine, but when I open a video through Nautilus, which launches Totem, everything is tiny again.

I'm assuming that there's some easy fix for this that will make these environment variables available globally, and not just to my own userspace.

Edit: sorry for the miscategorization. I'm aware this isn't an installation issue, but I also don't seem to be able to move this thread to another category.

Last edited by jon.reeve (2017-02-01 15:21:27)

Offline

#2 2017-02-01 17:31:32

mpan
Member
Registered: 2012-08-01
Posts: 1,208
Website

Re: Environment variable scope and HiDPI

Run a terminal then run another terminal from inside of it. Does the issue occur in the second one? If yes, does invocation of env list GDK_SCALE and GDK_DIP_SCALE?

What do you mean by “run it myself”. You never run anything yourself — always some other program does that for you, so you made a shortcut here and it’s not clear what exactly you had on your mind.

I assume that after modifying "/etc/profile.d" you have restarted your DE.


Sometimes I seem a bit harsh — don’t get offended too easily!

Offline

#3 2017-02-02 02:48:23

jon.reeve
Member
Registered: 2013-04-29
Posts: 22

Re: Environment variable scope and HiDPI

I don't quite know how to run a terminal from within another terminal, but I launched xfce4-terminal, and then typed the command gnome-terminal, and then typed env | grep GDK, and I see those two environment variables I listed above.

What I mean by "run it myself" is that I launch a program by typing the program's name into a terminal, or into dmenu. In those cases, the scaling is fine, but when a program I launch then launches another program, like nautilus launching totem, the secondary program is not scaled correctly.

One thing I just tried is launching Nautilus, right-clicking and selecting "open in terminal," and sure enough, the GDK environment variables are missing. Somehow I have more than one environment variable profile: one that's in my userspace, and one that's in my programs' userspace.

Offline

#4 2017-02-02 02:53:20

jon.reeve
Member
Registered: 2013-04-29
Posts: 22

Re: Environment variable scope and HiDPI

Oops, accidentally double-posted.

Last edited by jon.reeve (2017-02-02 02:53:53)

Offline

#5 2017-02-02 11:50:22

x33a
Forum Fellow
Registered: 2009-08-15
Posts: 4,587

Re: Environment variable scope and HiDPI

Moving thread to "Applications and Desktop Environments".

@jon.reeve, in future, you can use the "Report" button under a post to contact the mods for moving threads or deleting double posts wink

Offline

#6 2017-02-02 13:16:44

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,534
Website

Re: Environment variable scope and HiDPI

Environment variables are never "global".  In fact, that is a bit of an oxymoron.  Environment variables are set within a particular environment.  That environment is the process that sets the variable and any child processes.

Normally when a process launches a new child process, the child inherits the parent's environment variables.  Ocassionally some processes screw this up - but more often when the variables are apparently lost it's actually because the process that doesn't have them set does not have any ancestors in which the variables were set.

The fact that these GDK variables were exported in the /etc/profile* means there could be one of two problems:

1) This file is not sourced by your gnome session or any of it's ancestors.  This is likely if you use a display manager.  If, in contrast, you log in to a tty then use xinit/startx this is much less likely.  Loging in to a tty triggers the sourcing of /etc/profile* so those variables would be set and exported and thus inherited by the gnome process(es) including your file manager.  You do see these variables set in a terminal emulator, but that does not rule out this option.  Even if the gnome session processes didn't have these variables set, when the terminal emulator starts it also sources /etc/profile* and sets those variables for itself and it's descendents (if it is a login shell, this is a toggleable option in some emulators).

2) The variables are set and inherited by your gnome session processes including your file manager.  But for some reason the file manager clears the environment before spawning new processes.  I find this less likely, but I don't use gnome - there are a lot of things it does by design that I can't make any sense out of.  So I'd not completely rule this out.

Either of the above would explain your symptoms.  The first one is easy to test: if you use a DM, disable it, and log in to a tty and run startx directly.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

Board footer

Powered by FluxBB