Score:4

How to set the scaling of the display through command line?

us flag

If I use a second monitor on Ubuntu 20.04 and if it has the highes resolution (4K), the 1st screen keeps glitching. I found out after many tries that putting it to 175% of fractional scaling then 200% again will fix this issue, however it returns after the screen sleeps

enter image description here

So, I'd like a way to change to 175% and then 200% from command line so I can automate this into a script

Score:1

You could probably handle this with xrandr, which is a more powerful tool than the Screen Resolution GUI. See, e.g., Monitor scaling does not work properly.

In your case, that would be

xrandr --output <out1> --scale 1.0x1.0 --output <out2> --scale 1.75x1.75
xrandr --output <out1> --scale 1.0x1.0 --output <out2> --scale 2.0x2.0

Note that you may need to tinker with other flags, e.g. --primary, --mode --pos, --fb.

us flag
Is this equivalent to the settings scaling? I tried `xrandr --output <out1> --scale 2.0x2.0 --output <out2> --scale 1.75x1.75` then `xrandr --output <out1> --scale 2.0x2.0 --output <out2> --scale 2.0x2.0` for 200% on first and 175% then 200% on second, but my screen got glitchy and I had to reboot
sancho.s ReinstateMonicaCellio avatar
pl flag
@GuerlandoOCs - Yes, see update. You could check the refresh rate, before and after xrandr.
bd flag
How do I use `xrandr` to get the current scaling factor?
Score:0
jp flag

I found cool script generator for this: HIDPI-Fixer:

This application allows you to create a script that acomplishes the following tasks:

- Allow fractional scaling of your display and its components in X11
- The end result looks nicer and is way less buggy than using Wayland
- The generated script is configured to run everytime you log in
- You can also instruct the application to modify the ~/.profile file to correctly scale Qt-based apps (as KDE does)
- Tested on GNOME, Deepin Desktop and KDE (you need to manualy set the scaling factor to 200% in Deepin and KDE)

It worked for me.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.