How can I permanently set the screen resolution?

That resolution's already added, since it's the resolution you're using right now. Not sure if that's causing the error.

Try it without the -r flag... it should attempt to use a resolution that you've set up that's closest to the highest frequency capability of the monitor.

So for instance, say you wanted to set it to 1600x900:
sudo xrandr --output HDMI-0 --mode 1600x900
-- or --
sudo xrandr --output HDMI-0 --mode 1600x900 --rate 60
-- or --
sudo xrandr --output HDMI-0 --mode 1600x900 --refresh 60

I'm not sure if sudo is needed here, but if it's not, it shouldn't be a problem.

The --output flag has several sub-flags:

--output <output>
      --auto
      --mode <mode>
      --preferred
      --pos <x>x<y>
      --rate <rate> or --refresh <rate>
      --reflect normal,x,y,xy
      --rotate normal,inverted,left,right
      --left-of <output>
      --right-of <output>
      --above <output>
      --below <output>
      --same-as <output>
      --set <property> <value>
      --scale <x>x<y>
      --scale-from <w>x<h>
      --transform <a>,<b>,<c>,<d>,<e>,<f>,<g>,<h>,<i>
      --off
      --crtc <crtc>
      --panning <w>x<h>[+<x>+<y>[/<track:w>x<h>+<x>+<y>[/<border:l>/<t>/<r>/<b>]]]
      --gamma <r>:<g>:<b>
      --brightness <value>
      --primary

... so you can set brightness, gamma, positioning, rotation, screen mirroring, etc. as well as the resolution and refresh rate.

So, for instance, say you wanted to mirror HDMI-0 to be the same as your main screen, and let's say eDP is your main screen:
sudo xrandr --output HDMI-0 --mode 1600x900 --refresh 60 --same-as eDP

Or, let's say your HDMI-0 is physically located to the right of your eDP screen, and you wanted different outputs on each screen:
sudo xrandr --output HDMI-0 --mode 1600x900 --refresh 60 --right-of eDP

Now, when you move your mouse cursor off the right-hand edge of eDP, it'll move onto HDMI-0, and when you move it off the left-hand edge of HDMI-0, it'll move onto eDP.

Let's say you've physically rotated HDMI-0 to the left (counter-clockwise) so it's vertically taller and horizontally smaller (photograph mode, rather than landscape mode):
sudo xrandr --output HDMI-0 --mode 1600x900 --refresh 60 --rotate right

Now you'll see your screen properly oriented, but taller than it is wide.

Let's say you've got it all set up the way you want, but the HDMI-0 monitor's looking a little dark:
sudo xrandr --output HDMI-0 --brightness 1.1
1 is default.

1 Like