Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Whenever I login, the screen resolution is always set to 1024 x 768. With a 1366 x 768 monitor, I end up with two large black bars on the sides of the screen, and I have to manually set the resolution back to 1366 x 768 via system settings. This does not affect the Ubuntu login screen; it occurs only after I log in. How can I make my computer automatically start up at the correct resolution?

share|improve this question
Which drivers are you using? Proprietary Nvidia/ATI or the open source ones? – MiJyn Feb 15 '12 at 0:36
Intel Core intergrated graphics controller – TreefrogInc Feb 15 '12 at 1:04
I tried adding 'xrandr -s 1366x768' to "Startup Applications", but that doesn't seem to work. – TreefrogInc Feb 25 '12 at 19:32
up vote 2 down vote accepted

You can make a script:
Run gedit ~/.screenmod and paste

gnome-terminal -e "bash -c \"xrandr -s 1366x768; exit; exec bash\""
exit 0


Make it executable: chmod +x ~/.screenmod

And then put it at startup applications:
enter image description here

We first create a file then change it to allow it to run as a script.

The script says:
1) Open the gnome-terminal and then
2) Invoke bash to
3) Run xrandr -s 1366x768 which will change the screen resolution, and
4) Close after that (exit),
5) Execute the commands (exec bash see here),
6) Close the script without error messages (exit 0).

In the first answer I think the problem was that we invoke the start up script with a shortcut ~/ instead of the the absolute path /home/[username]. Besides that, to be sure everything works, I decide to also change the script to first open a terminal and then execute what we want instead of just executing xrandr -s 1366x768.

share|improve this answer
Nope... still at 1024x768 on login. Which makes me suspect the screen is being set at that resolution after the startup programs are run. – TreefrogInc Feb 26 '12 at 15:37
If you run xrandr -s 1366x768 at terminal does it work? – desgua Feb 26 '12 at 17:34
I've updated the answer, I think it works now ;-) – desgua Feb 26 '12 at 19:43
Hey, it works! The screen still starts up at 1024x768, but after about a second, a terminal pops up and the screen flashes back to 1366x768.. Good enough for me, but it would be totally great if it were able to just start at 1366x768 ;D – TreefrogInc Feb 26 '12 at 21:49
@treefroginc ya its a hack... here its another one… – H_7 Feb 26 '12 at 22:16

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.