Tutorial: Create Shortcuts to Scale Display Up/Down

Using @Kyle_Rankin’s Scale-the-Screen app from the early amber days as a reference, I created the following shortcuts for quickly changing the display resolution on the fly. (I used 1.5 and 2.0 as resolutions.)

The wlr-randr package that Kyle had to build from source is now packaged for PureOS, so that made it easy for me. You’ll have to install wlr-randr before proceeding with the following.

1 - Starting in the home folder, create 1.5_Scale.desktop and paste the following into .local/share/applications:

[Desktop Entry]
Exec=gnome-terminal -x bash -c "wlr-randr --output DSI-1 --scale 1.5"

You can use a different resolution if you prefer; just make sure all occurrences of the name match, for the application, command, and icon.

2 - For an easy return to the default 2.0 resolution, create 2.0_Scale.desktop in .local/share/applications and paste the following:

[Desktop Entry]
Exec=gnome-terminal -x bash -c "wlr-randr --output DSI-1 --scale 2"

3 - For the icons, find some free clipart, or draw your own. Then paste them into .local/share/icons.

I made these:


The launchers will appear on the home screen, probably at the top, since they start with digits. You could also long-press them to add them to the favorites section at the very top.

These makes it easier to select favored resolutions directly, without having to delve into the Settings app.


Launching 1.5_Scale:

Launching 2.0_Scale:


By the way, if you install the latest phosh-mobile-settings package, you can set per-application auto-scaling with a GUI.


Thanks for the script, is squeekboard still scaling as well? Will this last a reboot?

I’m making one to switch off the phone display when plugged to an external monitor, but I’ve got problems when switching it back to normal.

Yes, unfortunately. And no, it does not persist.

That is indeed sweet. Thanks. I’ll post some screenshots.

See screenshots:

@Kyle_Rankin, @guido.gunther, it’s not clear to me how to add a per-app setting. Can you clarify?

1 Like

Launch the app, open phosh-mobile-settings, open the Compositor menu and you should see a list of running applications. Toggle the slider for the application that you want to auto-scale.


Excellent. Thanks.

Changing the settings in phoc.ini doesn’t work either, it doesn’t start phosh for some reason after restarting.

I just noticed that adding my 1.5_Scale app to the startup applications (- I used Tweaks to add it -) causes the phone to switch automatically to 1.5 scale shortly after power on.


I made a script to switch from scale to scale with only one shortcut

Here, the icon I made for it, put it in your pictures folder

Here, the script I made, put it into /home/purism/ChangeScale.sh, or wherever ou want :


[ ! -e /usr/bin/wlr-randr ] && echo -e "\e[31mError\e[0m: wlr-randr is missing\n==> sudo apt install wlr-randr" && exit 1

list_scale="1.25 2 1.75"

current_scale=$(wlr-randr --output "${output}" | grep 'Scale:' | awk '{ print $2 }')

next_scale=${list_scale%% *}
for scale in ${list_scale} ; do
    if [ $flg_found -eq 0 ] ; then
        [ "${scale}" == "${current_scale:0:$len}" ] && flg_found=1

echo "Change to scale : ${next_scale}"
wlr-randr --output "${output}" --scale "${next_scale}"
  • First click change to 125% (1.25), second click to 200% (2) third click to 175% (1.75), fourth click is back to first, but it depends on what is set in the variable list_scale
  • You can change the content of the variable list_scale at the beginning of the script to your wanted scale list loop
    you can have only one scale number set, or as many as you want in the list
  • Don’t forget to add execution right to the file : chmod +x ChangeScale.sh

Here, the shortcut, put in into ~/.local/share/applications/ChangeScale.desktop :

[Desktop Entry]
  • Don’t forget to change the directory of the icon in the last line of the shortcut, or the path of the script in the Exec line if you changed it

Nice! Thanks.

hum… this is annoying
When you have no app launched and you use my icon, it’s “opening” an empty window
It’s probably something to change/add in the .desktop … any idea ?

This tends to happen when a file name used in the .desktop doesn’t exactly match the indicated file name, e.g. capitalization, location, etc.

I’m not qualified to examine… or understand… the script itself, unfortunately.

Pardon my ignorance, but what does this mean?

When you create a file, you usually have read and write permissions/rights
chmod is a tool to modify the permissions on a file
The option +x add execution rights, which means you allow the file to act like an application
If you don’t add right, the script will not do anything, and the system will tell you : permission denied (when executed in a terminal)

1 Like

I get this in the gnome-terminal when I use the shortcut.

EDIT: Obsolete. Disregard

I don’t know what you did there , nor where you put the -x option
There is nothing to do with gtk.css, here…
Every block of code I shared previously are meant to be put inside 2 different files with the extensions ‘.sh’ (for the script file) or ‘.desktop’ (for the shortcut file)
chmod is a tool to be used in the terminal, to set the permission on the script file I proposed previously
And the shortcut file, is suppose to be placed in ~/.local/share/applications/ without any permission modification (I added the file name in my previous post)

I did everything just like you said and that is what shows up for a brief moment in gnome-terminal and the scale does not change.:man_shrugging:

EDIT: I did not do everything you said, I used a different command in the shortcut, But it still does not work after I fixed it.

Ok this is more complex than expected
This topic is about scaling up/down the display scale

So I created an other topic about your problem, go over here to try and solve it: