How can I run a script that starts before my login screen?

All the files you tried to change are read after you log in. Furthermore, ~/.xinitrc and ~/.xsession are the full set of commands that run in a session; ~/.xinitrc is read if you run xinit or startx from a text mode prompt, and ~/.xsession is read if you run a “custom session” (the name may vary) from a graphical login prompt.

You need to configure your display manager, the program that shows the login prompt. For kdm, the KDE display manager, add your command to /etc/kde4/kdm/Xsetup (or /etc/kde3/kdm/Xsetup for older versions) (that's the path on Debian, I haven't verified that Kubuntu uses the same path).

For gdm (the Gnome display manager), add your command to /etc/gdm/Init/Default. For xdm (the traditional X display manager), add your command to /etc/X11/xdm/Xsetup.


I suggest that you create your own config file, a simple example:

/usr/lib/X11/xorg.conf.d/20-calibration.conf

Filecontent:

Section "InputClass"
         Identifier "Calibration"
         MatchProduct "3M 3M USB Touchscreen - EX II"
         Option "Calibration" "14410 2146 14574 2115"
EndSection

That should do the trick.