I would like to change the screen scaling (sometimes called fractional scaling) in Fedora Linux 42 Workstation from 100% to 175% using a keyboard shortcut. If the screen scaling is set to 175%, it should be reset to 100% using a keyboard shortcut (same as before). In other words, a toggle function.
I have created a bash script that only scales the font size. However, the scaling of image elements and dock is also desired.
#!/bin/bash
#Toggle scaling between 100% and 175%
current_scale=$(gsettings get org.gnome.desktop.interface text-scaling-factor)
if (( $(echo "$current_scale == 1.0" | bc -l) )); then
# Aktuelle Skalierung ist 100%, wechsle zu 175%
gsettings set org.gnome.desktop.interface text-scaling-factor 1.75
notify-send "Bildschirm-Skalierung" "Auf 175% gesetzt" -i display
else
# Aktuelle Skalierung ist nicht 100%, wechsle zu 100%
gsettings set org.gnome.desktop.interface text-scaling-factor 1.0
notify-send "Bildschirm-Skalierung" "Auf 100% gesetzt" -i display
fi
The GNOME version is 48, the window manager is Wayland.
It seems that the scaling is not stored in the dconf database, but rather configured via dbus. You might be able to use some xrandr commands in your script for this purpose.
Indeed, I came to the same conclusion. A trick for you to see that: run dconf watch /. Then perform the change in Settings, and you see that no keys are updated. Now, we need a trick to find out which dbus command may effectuate the setting… xrandr most linkely will not work, because we are on Wayland here…