I want my system to run with 1366x768 resolution. Note that this resolution is not detected by the open source driver. So I created a bash script as follows :-

xrandr --newmode "1368x768_60.00" 85.25 1368 1440 1576 1784 768 771 781 798 -hsync +vsync xrandr --addmode DVI-0 1368x768_60.00
xrandr --output DisplayPort-0 --off --output DVI-0 --mode 1368x768_60.00 --pos 0x0 --rotate normal --output HDMI-0 --off

and saved it as lightdmxrandr.sh in /usr/bin and also made it executable. In /usr/share/lightdm/lightdm.conf.d/50-ubuntu.conf , I added these lines:-


Now I saved the file and rebooted my PC. My login screen had 1366x768 resolution. So I happily typed in my password and pressed return. But when my desktop starts I dont have 1366x768 resloution! I tried running the script above at runlevel. That didnt work. Infact even the login screen's resolution did'nt change! So I need to know what must be done to make that script run just before the desktop session begins. Thanks in advance.

PS:- I have an ATI radeon 5570 HD graphic card. I am using the AMD REDWOOD open source drivers. I know that I can get the 1368x768 resolution with a AMD proprietary driver from the AMD website. But I prefer to use the Open source drivers. If you have patience, read this question too. The above question was born out of problems arose by that question. Also note that I am using Ubuntu 14.04 but this question is not too '14.04 specific'.

  • 2
    Have you tried adding it into startup applications? Apr 10, 2014 at 11:27
  • @AdityaPatil No. Never struck me! I will try it and get back to you.
    – Venkatesh
    Apr 10, 2014 at 11:28
  • @AdityaPatil That worked! Thanks! Can you add an answer that explains how one can run a bash script on logging in using startup applications? It will be useful for future visitors...
    – Venkatesh
    Apr 10, 2014 at 11:35
  • Ok.I will write. Apr 10, 2014 at 11:37

2 Answers 2


Rather than executing the script before session begins, you can execute it as soon as session begins. For an end user, this does not make difference as scripts would have started executing when you see your session.The steps are as follows.

  1. Create a shell script and provide it necessary permissions.

  2. Open startup applications by searching in dash or your menu, depending on your OS.

  3. Click on Add. enter image description here

  4. Give a name and add the command, which would be location of your script.You may also add a optional comment.
    enter image description here

  5. Click on add, ensure that script is selected and then close the window.

Next time the script would be executed on startup.


You can make a file either in ~/.xprofile or /etc/X11/Xsession.d/

Heads up, you get a popup with the xprofile method if you dont boot with the monitor you specified attached.

You must log in to answer this question.

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