Change the display scaling on the fly
Solution 1
You have to take a look at xrandr. I say it's the tool of choice.
Edit: xrandr --output "output_name" --scale 0.9x0.9
See more examples with: man xrandr
Solution 2
This answer of @rubo77 provides great solution of a similar question. I will elaborate it within the final part to achieve this result.
You can find out where the setting is changed if you open a terminal:
gsettings list-recursively > /tmp/before echo 'Now unity-control-center should open. Please change the scaling in "Displays" and close.' unity-control-center gsettings list-recursively > /tmp/after diff /tmp/before /tmp/after | grep '[>|<]'
Copy and paste the above lines into a terminal. These command will create two temp files - before and after the change of the scale factor. Press Enter after you close Unity Control Center to execute the last line, that will compare these two temp files.
In my system when I change the scale factor from 1 to 1.5 the output of the above is:
< org.gnome.desktop.interface text-scaling-factor 1.0
> org.gnome.desktop.interface text-scaling-factor 1.5
< org.gnome.desktop.interface cursor-size 24
> org.gnome.desktop.interface cursor-size 36
< com.ubuntu.user-interface scale-factor {'VGA-1': 8, 'HDMI-0': 8, 'HDMI-1': 8}
> com.ubuntu.user-interface scale-factor {'VGA-1': 8, 'HDMI-0': 8, 'HDMI-1': 12}
So the new values are:
> org.gnome.desktop.interface text-scaling-factor 1.5
> org.gnome.desktop.interface cursor-size 36
> com.ubuntu.user-interface scale-factor {'VGA-1': 8, 'HDMI-0': 8, 'HDMI-1': 12}
I've recorded the values when the scaling factor is 1
, 1.25
and 1.5
.
These values can be changed through the command line by the command gsettings set
. So, according to the original answer, I've created a script, called setscalefactor
and placed in /usr/local/bin/
, thus it will be available as shell command:
sudo touch /usr/local/bin/setscalefactor
sudo chmod +x /usr/local/bin/setscalefactor
sudo nano /usr/local/bin/setscalefactor
The content of my script is:
#!/bin/bash
if [ -z "${1}" ] || [ "$1" == "1" ] || [ "$1" == "1.0" ]; then
# set scaling to 1.0
gsettings set org.gnome.desktop.interface text-scaling-factor 1.0
gsettings set org.gnome.desktop.interface cursor-size 24
gsettings set com.ubuntu.user-interface scale-factor "{'VGA-1': 8, 'HDMI-0': 8, 'HDMI-1': 8}"
echo "Set Scale factor: 1.0"; notify-send "Scale Factor" "1.0"
elif [ "$1" == "1.25" ]; then
# set scaling to 1.25
gsettings set org.gnome.desktop.interface text-scaling-factor 1.25
gsettings set org.gnome.desktop.interface cursor-size 30
gsettings set com.ubuntu.user-interface scale-factor "{'VGA-1': 8, 'HDMI-0': 8, 'HDMI-1': 10}"
echo "Set Scale factor: 1.25"; notify-send "Scale Factor" "1.25"
elif [ "$1" == "1.5" ]; then
# set scaling to 1.5
gsettings set org.gnome.desktop.interface text-scaling-factor 1.5
gsettings set org.gnome.desktop.interface cursor-size 36
gsettings set com.ubuntu.user-interface scale-factor "{'VGA-1': 8, 'HDMI-0': 8, 'HDMI-1': 12}"
echo "Set Scale factor: 1.5"; notify-send "Scale Factor" "1.5"
else
echo "ERROR: Something went wrong!"; notify-send "Scale Factor" "ERROR: Something went wrong!"
fi
exit
- Copy the above content and use in
nano
: Shift+Insert for paste; Ctrl+O and Enter for save; Ctrl+X for exit. - Replace the content after
gsettings set
with the values from your system! - Please note the quote marks:
"{'VGA-1': ...}"
.
Now setscalefactor
is available as shell command and can handle 1.0
, 1.25
and 1.5
as arguments, also when it is executed without an argument it will sale to 1. The script will print and some status messages.
Next step is to create this scrip accessible via shortcut key combination. Go to: Unity Control Center (System Settings) > Keyboard > Shortcuts > Custom Shortcuts. Then create your custom shortcuts, like as the image:
Solution 3
Use below command to check the display Pannel interface name :
xrandr
Then to scale :
xrandr --output HDMI-1-1 --scale 1x1
here HDMI-1-1 is my display pannel interface as i am connected with my second display through a hdmi port.
Related videos on Youtube
Qeebrato
Updated on September 18, 2022Comments
-
Qeebrato over 1 year
I'm looking for a keyboard shortcut or a CLI instruction to change the display scale on the fly. Seems there's nothing in compiz-config manager to handle this?
-
Rinzwind over 6 yearsSame askubuntu.com/questions/878023/… but no answer yet. I'll pm Jacob ;-)
-
Jacob Vlijm over 6 years@Rinzwind done :) will polish the answer, I am in a hurry :)
-
Jacob Vlijm over 6 years@Rinzwind ooops, wrong scaling, he meant display. Will edit later, no time atm...
-
-
Soren A over 6 years@pa4080
xrandr --output DP-2 --scale 0.9x0.9
scales your screenj output ... -
Eliah Kagan over 6 years@SorenA Can you post an answer about that? This answer really doesn't say how to solve the problem, your comment isn't all that visible right now to people who may benefit from it, and I suspect this answer may end up being deleted because it's extremely vague and doesn't really give a solution.
-
Qeebrato over 6 yearsSometimes I get "X Error of failed request: BadMatch (invalid parameter attributes)", and only a section of the display is illuminated. But setting a different scale flushes that error.
-
pa4080 about 6 yearsJust want to keep this reference here: askubuntu.com/a/875291/566421
-
user2364305 about 4 yearsGreat idea... issue, nothing changes... i did a sha1sum on the files, before and after are the same when changing from 100% to 300% :/
-
user2364305 about 4 yearsThis... makes everything blurry! this is not the modern way to do things
-
Ulrich-Lorenz Schlüter about 4 yearsThis may be well outdated. @Ray Foss could you please tell us the modern way to do things.
-
user2364305 about 4 years~/.config/monitors.xml, gsettings, the gitlab code and gnome-shell's
r
... you can also enable fractional scaling... but its a battery hog to go to 2x than down to 1.75x, it's also blurrier