1

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!

2 Answers 2

0

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

0

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.

1
  • 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! Nov 10, 2012 at 17:19

You must log in to answer this question.

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