Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

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

I have a tablet PC and the graphics driver doesn't support xrandr, so in order to rotate the screen I run a script which changes the Xorg.conf file and then restarts lightdm. I also have a script which uses xsetwacom and xinput to change the rotation of the input devices so that the match the new orientation.

I've learned how to get the script to run when I login, but I'd like it to run before I login, so that I don't have to enable auto-login with lightdm. I do need it to run though, or the input (touch and pen) is rotated with respect to the screen, so that when I touch the screen the input is in a completely different area, making it really difficult to use the onscreen keyboard.

I've looked at other questions on this site. I've tried putting my script in /etc/Xsession.d but that didn't seem to work. I also tried putting it in /etc/rc.local but I think that is the wrong place, nothing seems to happen. I've also tried googling for lightm script hooks, and various other google terms.

Any suggestions?

Edit 1: After doing some research, it seems to me that it might not be that I want to run a script with lightdm, but rather with the lighdm greeter (in this case, I think the unity-greeter?). Are there any script-hooks for the unity-greeter?

share|improve this question
up vote 7 down vote accepted

You might want to try adding pre-start or post-start scripts to


(see for an introduction to upstart that parses this file)

Also /etc/lightdm.conf allows to specify scripts to be loaded. You have a detailed description of all (many) the options that can be used in the configuration file lightdm.conf at /usr/share/doc/lightdm/lightdm.conf.

share|improve this answer
Thanks for the suggestion, but this doesn't seem to be working either. I'm not 100% sure about how lightdm works, but it's my understanding that the lightdm process does not end when you login, but that it restarts the x server when logging in / logging out. Adding a pre-start script to lightdm get's my script to run before lightdm starts, but I think ligthdm starts x after this, so the settings I change via xinput/xsetwacom are not preserved by the time the login screen is displayed. – cheshirekow Nov 2 '11 at 18:02
Well, the answer isn't quite correct but it helped me find the correct answer. I guess the lightdm configuration has some script hooks. In particular I used display-setup-script=/home/cheshirekow/Codes/shell/xorg/ which worked. I found the answer here:… – cheshirekow Nov 2 '11 at 20:32

I would like to add that "display-setup-script=/path/to/some/script" goes into the [SeatDefaults] section of /etc/lightdm/lightdm.conf.

I use the script to setup the correct resolution and screen orientation for the greeter. This looks like:

xrandr --output DVI-0  --mode 1920x1200 --rotate left --primary
xrandr --output HDMI-0 --mode 1920x1080
share|improve this answer
Thank you, also on Debian it is in the wrong [Lightdm] section. – Alex Aug 24 '13 at 11:30
Thanks, also on Arch. – Ben Challenor Feb 22 '14 at 23:37
good answer, his question starts like : "I have a tablet PC and the graphics driver doesn't support xrandr..." , so you explain how do you use xrandr to set your screen. – Tele Mar 25 at 15:36

Try putting the xrandr lines into ~/.xprofile.

Hopefully this will help others with this issue.

share|improve this answer

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.