Re: How to Run a Command on Screensaver Activation, Only After User Interaction that Session?
- To: debian-user@lists.debian.org
- Subject: Re: How to Run a Command on Screensaver Activation, Only After User Interaction that Session?
- From: Felix Dietrich <felix.dietrich@sperrhaken.name>
- Date: Thu, 04 May 2017 09:27:11 +0200
- Message-id: <[🔎] 87h911m69c.fsf@sperrhaken.name>
- References: <CAByJ6DE=U+GSpGBX8=G-BRjJ8ZcxY9fzooS7wukAu8KkrmnAxA@mail.gmail.com> <CAByJ6DHP146u5x1Hiffvj-wyDmQok-AkxjSXyTU_XUVvQAu79g@mail.gmail.com> <87tw596zbl.fsf@sperrhaken.name> <CAByJ6DEf9jowsrmsvVL0NZ0Jmf98aOs9OWsUQjN294XTGS-BLg@mail.gmail.com>
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
Reply to: