Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I would like Ubuntu to open up a terminal window and apply the following code upon login:

xrandr --newmode "1280x1024_60.00" 109.00 1280 1368 1496 1712 1024 1027 1034 1063 -hsync +vsync
xrandr --addmode VGA1 1280x1024_60.00
xrandr --output VGA1 --mode 1280x1024_60.00

I usually have to copy/paste the xrandr lines into terminal manually, just wondering if there was shortcut.

I'm using 12.10 btw.

thanks in advance!

share|improve this question

2 Answers 2

Create a .sh file and copy paste the contents.

vi file_name.sh

#!/bin/bash
xrandr --newmode "1280x1024_60.00" 109.00 1280 1368 1496 1712 1024 1027 1034 1063 -hsync +vsync
xrandr --addmode VGA1 1280x1024_60.00
xrandr --output VGA1 --mode 1280x1024_60.00

and save the file. Change the permissions.

  chmod +x file_name.sh

Now open dash. Search for "Startup Applications" and open it.

Click "Add" and browse for the file that you created earlier(file_name.sh) and add it.

Check this Q&A for detailed answered about adding a program to Startup Applications

share|improve this answer

You should put this in a script in ~/bin and call it from startup applications.

First make the ~/bin folder if you don't already have one:

mkdir ~/bin

Every time you boot, this folder will be automatically added to your paths

Next, create the new file and start the edit:

gedit ~/bin/setscreen

and past the contents into it:

#!/bin/bash
xrandr --newmode "1280x1024_60.00" 109.00 1280 1368 1496 1712 1024 1027 1034 1063 -hsync +vsync
xrandr --addmode VGA1 1280x1024_60.00
xrandr --output VGA1 --mode 1280x1024_60.00

Then save and exit gedit.

Now you will need to change the file so it is an executable script:

chmode +x ~/bin/setscreen

You can now call the program at any time by opening a terminal or console and typing:

setscreen

You should now open up startup applications and add the file /home/username/setscreen and make sure it is selected for start.

Really though, what you should be doing is adding this mode to the /etc/X11/xorg.conf file so that it is working correctly right from the login screen. This is a different and more complex problem however, and you should probably ask a separate question on how to do this.

share|improve this answer
    
Thanks everyone. I figured it out with your help. Made a "res.sh" file, added the # bash line to the beginning of it. Added the .sh file to my startup programs and it changes the resolution automatically. Thanks again! –  euphoric_anomaly Nov 10 '12 at 17:19

Your Answer

 
discard

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.