You are not logged in.
Pages: 1
Topic closed
TLDR;
If you have two different DPI screens (for ex: Laptop and external monitor) and you only use one at a time,
use this script https://gist.github.com/itsfarseen/ae2a … 3e34ef2559
--
I have an external 4K 32" monitor and my laptop is 14" 1080P.
I tend to switch between the external monitor and my laptop multiple times during the day.
I would get up from my chair, disconnect the monitor, take my laptop to the bed and work from there for a while.
Because my monitor is further away from me than my laptop screen, I needed a larger font size on my monitor.
I thought in X11, DPI once set can't be changed without restarting the session.
Although there's an xrandr --dpi option, setting it seemed to have no effect.
Then I discovered Xft.dpi setting in Xresources.
I can set it in ~/.Xresources and do `xrdb -merge ~/.Xresources` or run `echo "Xft.dpi: 130" | xrdb -override -` to have it update without editing the file.
But this setting will only be picked up when you restart a Gtk app.
That's when I found out that Gtk apps, and even electron apps listen for an update signal from `gnome-settings-daemon`.
Then I found a lightweight alternative to gsd, `xsettingsd`. Now if I edit the DPI in `~/.xsettingsd` file and call `killall -HUP xsettingsd`,
it will read the new DPI and propagate it to all the running apps
That's what the script is mostly, plus it also adjusts the config file for apps that don't listen to this signal, but will autoreload on the fly if I edit their configs.
For example, alacritty and polybar.
It took me quite some time to figure out all these and I'm quite proud of the results
Thanks for reading,
Farseen
Offline
`echo "Xft.dpi: 130" | xrdb -override -` is a really neat solution! Thanks!
It's not exactly "on-the-fly" as it requires restarting the apps to take effect. Have you found a truly on-the-fly, immediate solution?
Offline
Hi Farseen!
I registered hier only to say you - thanks you That is a very good script and xsettingsd trick should be on HiDPI documentation site
Offline
The OP has not been back since last November, so I am going to consider this thread abandoned and close it.
Offline
Pages: 1
Topic closed