Kent West <westk@acu.edu> writes:
> On Thu, Apr 27, 2017 at 9:27 PM, Felix Dietrich
> <felix.dietrich@sperrhaken.name > wrote:
>
> Kent West <westk@acu.edu> writes:
>
> What I needed (and have since solved - below) was help working out the
> syntax of determining human interaction with X.
>
> You may also want to consider that a user probably should not be
> able to
> edit the initialisation script (xinitrc)
>
> In my current setup, the current user can do either of these things,
> but not permanently; his changes are lost upon a restart of X, so the
> changing of .xinitrc is a non-issue.
If the user chooses to overwrite the .xinitrc file the rsync command you
use to reset the home directory at the beginning of that script (as part
of wipe_profile.sh) will not be run. Maybe you should reset the home
directory at the end of the session (and also as part of the
initialisation during boot in case of a sudden power loss).
wipe_profile.sh also appears to be writeable by the user?
> The problem is that xinput reports several EVENTs on startup of the
> utility, so I had to figure out a way to do finer-grained testing. My
> solution is below.
>
> xinput test-xi2 --root | egrep -q "EVENT type 2|EVENT type 6"
Event 2 is the KeyPress event, Event 6 is the MotionNotify event. Maybe
you should check for the ButtonPress event 4 as well to handle mouse
clicks? I found the events listed in "/usr/include/X11/X.h", which you
can find as part of the x11proto-core-dev package.
I like the usage of grep's "-q" switch; I had forgotten about it.
--
Felix Dietrich