23

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?

3 Answers3

13

I would like to add that display-setup-script=/path/to/some/script goes into the [Seat:*] ([SeatDefaults] in older versions) 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
muru
  • 207,228
stig
  • 131
10

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

/etc/init/lightdm.conf

(see http://upstart.ubuntu.com/getting-started.html 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.

user31844
  • 116
6

Try insert your script in ~/.xprofile file, like below

#! /bin/sh
# ~/.xprofile: execute commands at the beginning of the X user
#              session - before the window manager is started.
#
# The xprofile files are natively sourced by the following
# display managers:
#
#     GDM     - /etc/gdm/Xsession
#     LightDM - /etc/lightdm/Xsession
#     LXDM    - /etc/lxdm/Xsession
#     SDDM    - /usr/share/sddm/scripts/Xsession
#
# More in https://wiki.archlinux.org/index.php/Autostarting

/usr/bin/nm-applet &
mja
  • 1,039