On Thu, Nov 4, 2010 at 9:33 PM, J. Bakshi <j.bakshi@xxxxxxxxxxxxxxxxx> wrote: > > Â Any clue please ?? > > > On Thu, 4 Nov 2010 14:15:01 +0530 > "J. Bakshi" <j.bakshi@xxxxxxxxxxxxxxxxx> wrote: > >> On Thu, 4 Nov 2010 10:07:41 +0530 >> "J. Bakshi" <j.bakshi@xxxxxxxxxxxxxxxxx> wrote: >> >> > >> > Hello list, >> > >> > Here is my udev rules which disable touchpad when I plug my usb external mouse, and enable it again, when removing the mouse >> > >> > ``````````````````` >> > ACTION=="add", SUBSYSTEM=="input", ENV{ID_CLASS}="mouse", ENV{DISPLAY}=":0.0", ENV{XAUTHORITY}="/home/user1/.Xauthority" ÂRUN+="/usr/bin/synclient TouchpadOff=1", RUN+="/bin/su user1 -c 'DISPLAY=:0.0 notify-send %k ' " >> > >> > ACTION=="remove", SUBSYSTEM=="input", ENV{ID_CLASS}=="mouse" ÂRUN+="/usr/bin/synclient TouchpadOff=0", RUN+="/bin/su user1 -c 'DISPLAY=:0.0 notify-send %k ' " >> > `````````````````````````````` >> > >> > The rules is running well within X. But only when I start my WM with startx , then the rules behaves opposite. With no mouse attached , the touchpad is still inactive. Though by pluging/unpluging the mouse, the rules start working normally. I don't understand why startx makes the rules behave so. Could anyone give me any clue please ? >> > >> > Thanks >> > -- >> >> I wonder, if there is any alternative to disable/enable the touchpad, irrespective of DISPLAY ( i.e. ENV{DISPLAY}=":0.0", ENV{XAUTHORITY}="/home/user1/.Xauthority" ). Hence the rules will work well whenever it detects the mouse, in X and in console. I think the issue is that your display manager probably isn't using ~/.Xauthority and you're DISPLAY may not be :0. I think the only "correct" way to implement this is to have a process running in your session that listens to udev events and runs synclient/notify-send when it finds the ones it wants. Otherwise, the hacky way to do it is to figure out all the current X sessions, where the xauth files are and run the commands in each session. You'd probably want a script for that. -- Dan -- To unsubscribe from this list: send the line "unsubscribe linux-hotplug" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html