You are not logged in.

#1 2021-04-08 15:31:37

salamanderjuice
Member
Registered: 2021-04-08
Posts: 4

Configure GDK_SCALE per X screen on X11 startup?

So I have a mixed DPI setup on X11 with separate X screens for each display so they can have independent DPIs. This works and will adjust the text in say Emacs to be the appropriate size on each monitor. However GTK UI stuff (and text in Firefox) doesn't seem to scale at all regardless of what I set Xft.dpi in .Xresources on each screen to be, what the X org config DPI is for the screen is etc. I can change it by doing

export GDK_SCALE=2

before launching a program like Firefox  in a terminal but obviously that gets old fast. When I try to do something like

DISPLAY=:0.1 export GDK_SCALE=2

in my .xinitrc this ends applied to all my monitors regardless. Is there some correct way to set an environment variable like this to apply on a per X screen basis on X11's startup?

Last edited by salamanderjuice (2021-04-08 15:32:19)

Offline

#2 2021-04-08 16:04:13

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,527

Re: Configure GDK_SCALE per X screen on X11 startup?

Environment variables are not per screen, but per shell.
So you want to *test* for the $DISPLAY and export the GDK_SCALE to whatever you use to launch off everything else accordingly.
(in doubt post your xinitrc)

Offline

#3 2021-04-08 16:35:28

salamanderjuice
Member
Registered: 2021-04-08
Posts: 4

Re: Configure GDK_SCALE per X screen on X11 startup?

Okay that makes sense. I did try

if [ $DISPLAY = ":0.1" ]
then
    export GDK_SCALE=2
fi

in my .xinitrc but that doesn't work either. The entirety of my .xinitrc right now is just

 [[ -f ~/.Xresources ]] && xrdb -merge -I$HOME ~/.Xresources
DISPLAY=:0.1 export GDK_SCALE=2
exec stumpwm

I guess I could make stumpwm check when I create an xterm or launch a shell command but I was hoping for something that'd let me be lazy I guess.

Offline

#4 2021-04-08 16:53:52

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,527

Re: Configure GDK_SCALE per X screen on X11 startup?

Your xinitrc is broken, last link in my signature.

How do you launch processes on :0.1 to begin with?
You don't run a WM or any shell there, but just "DISPLAY=:0.1 emacs"??

Offline

#5 2021-04-08 17:36:45

salamanderjuice
Member
Registered: 2021-04-08
Posts: 4

Re: Configure GDK_SCALE per X screen on X11 startup?

Stumpwm handles it I guess. It's launched across all 3 screens and I can switch between them. But nothing in their documentation that I could see explains how it handles that.

Thanks for the tip on my broken xinitrc. Doesn't seem to have resolved the issue though.

Offline

#6 2021-04-08 20:25:06

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,527

Re: Configure GDK_SCALE per X screen on X11 startup?

The xinitrc link is indeed unrelated and just to guarantee that you've a sane session.

StumpWM indeed seems to handle mutliple screens fine, but I've no experience w/ the WM.
Who exactly do you get from "exec stumpwm" to "missized GTK client"? Do you launch them w/ a shortcut or do you just trigger an xterm and launch stuff from there? Or do you use an external runner like dwm, rofi etc?
In any event, this is where you want to intercept, thest the DISPLAY and set GDK_SCALE accordingly.

Offline

#7 2021-04-09 12:00:58

salamanderjuice
Member
Registered: 2021-04-08
Posts: 4

Re: Configure GDK_SCALE per X screen on X11 startup?

Shortcut/xterm. I think I should be able to configure all them to do that as it's all customizable in lisp, just wish I didn't need to! Thanks.

Offline

Board footer

Powered by FluxBB