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:-
greeter-session=unity-greeter
display-setup-script=/usr/bin/lightdmxrandr.sh
session-setup-script=/usr/bin/lightdmxrandr.sh
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'.
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.
Create a shell script and provide it necessary permissions.
Open
startup applications
by searching in dash or your menu, depending on your OS.Click on Add.
Give a name and add the command, which would be location of your script.You may also add a optional comment.
Click on add, ensure that script is selected and then close the window.
Next time the script would be executed on startup.