0

After every restart, I have to manually set the resolution of my second monitor with:

sudo xrandr --newmode "1600x900_60.00"  118.25  1600 1696 1856 2112  900 903 908 934 -hsync +vsync
sudo xrandr --addmode VGA-0 "1600x900_60.00"

Unity never picks up the resolution automatically, so is there a way to set this permanently so I don't need to do it every time?

1
  • why do you use sudo? Feb 7, 2015 at 14:07

1 Answer 1

2

I don't think you need to use sudo here, in fact you shouldn't if it is unnecessary.

Simply create a small script:

#!/bin/bash

xrandr --newmode "1600x900_60.00"  118.25  1600 1696 1856 2112  900 903 908 934 -hsync +vsync
xrandr --addmode VGA-0 "1600x900_60.00"
  • Copy it into an empty file, save it as set_resolution.sh
  • Add it to your startup applications: Dash > Startup Applications > Add the command:

    /bin/bash /path/to/set_resolution.sh
    

NB

You might have to add a small break to wait for the desktop to be fully loaded, e.g.:

#!/bin/bash

sleep 10
xrandr --newmode "1600x900_60.00"  118.25  1600 1696 1856 2112  900 903 908 934 -hsync +vsync
xrandr --addmode VGA-0 "1600x900_60.00"
4
  • @Roman does it work? Did you run into problems? Please let me know. Feb 8, 2015 at 20:55
  • Jacob, you should know by now that a bunch of Rep1 users, post their question and never come back after they've got an answer! :P ;-) (upvote BTW: I would have said exactly the same)
    – Fabby
    Feb 10, 2015 at 13:37
  • @JacobVlijm, sorry for only coming back to you now... never saw your message. It didnt't work for me, what I ended up doing is creating a script resolution.py and running the commands using os.system('xrandr --newmode ...ect') and executing that script on startup.
    – Roman
    May 7, 2015 at 10:23
  • @Roman Wheter you do it from python or bash should do exactly the same. If you do it with python, I'd strongly suggest using subprocess.Popen instead of os.system() May 7, 2015 at 10:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .