Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.os.linux.development.apps > #430

Re: Keyboard lock applet?

From Patrick <patrick2000@a2s46.webhop.net>
Newsgroups comp.os.linux.development.apps
Subject Re: Keyboard lock applet?
Date 2012-02-17 22:42 +0100
Organization TornevallNET - http://news.tornevall.net
Message-ID <jhmi3v$osj$1@tornado.tornevall.net> (permalink)
References <jhlufe$716$1@rumours.uwaterloo.ca>

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

On 17.02.2012 17:15, Carlos Moreno wrote:
> Hi,
>
> I wonder if something like this exists? Like a lockscreen,
> except that it doesn't completely lock the system --- I want
> the screen to be visible and the mouse active, just with the
> keyboard disabled.
>
> If not available, would this be something easy to develop?
> What sort of information / documentation would I need to look
> up? (is it desktop environment specific? I mean, is it
> something that one would have to do specifically for, say,
> GNOME, and specifically for GNOME2 and separately for GNOME3?)
>
> BTW, in case you're wondering, there's a 1.5-year old wandering
> around the computers around here --- when I'm away, I lock screen;
> but when the little one is around and I'm, say, watching something,
> or using some application that can be used exclusively with mouse,
> I'd like a solution more practical than a hardware solution such
> as having to unplug the keyboard!
>
> Thanks for any tips,
>
> Carlos
> --

There is the linux input subsystem available.

Documentation is here: 
http://lxr.linux.no/#linux+v3.2.6/Documentation/input/

It shouldn't be too hard to develop an "applet" to do the job.

In fact I've just hacked up a little python script for you.

Just for fun. :-) I remembered this because I used the input system 
myself once to remap one of my laptops keys.

So this is not yet an applet, but works, like this:

  1. save the file in your home directory as "grabdev.py"
  2. start a terminal (on ubuntu, just press ctrl-alt-t)
  3. type "python grabdev.py" [Enter]
  4. it should display a list of +10 devices
  5. choose one that sounds like "keyboard" / "...kbd"
  6. type "python grabdev.py device-number"
  7. check if you picked the right device *1)
  8. if yes, figure out a way to stop the program *2)
  9. type "python grabdev.py --forever device-number"


*1) The script will "grab" the device's events,
     so your keyboard should be "disabled", as desired.
     Without the --forever arg, it will release the
     device again after 5 seconds.

*2) I have an external keyboard on mylaptop and
     so I could always stop the script using
     ctrl-c, but if you don't have that,
     watch out! :-)

     It seems it will stop if you close the
     terminal window with the mouse, so you could
     actually just create a launcher for this, that
     runs the script in a terminal. I've attached on
     .desktop file, so you see what I mean.
     - Save it in your home directory as "grabdev.desktop".
     - Make sure the file have "execute" permissions set
       ("$ chmod 755 grabdev.py", or Right Click->etc..)
     - Now you should be able to start it with a double-click.
     - You can drag-drop the desktop file to the unity launcher
     - If you want to save the 2 files somewhere else, you
       have to mention the file path in the desktop file
     - If you don't like to type the password every time,
       ... :-) I have no good solution yet. As scripts can't
       be installed suidCreate a binary and install suid root ??
       Create a dbus system service, set up permissions, ... ??
       Ideas welcome!

     If you have another idea about how
     the script should be stopped or would like some
     kind of gui, just tell me. But I'm not too familiar with gnome.
     In any case, you could of course tackle
     the issue at the X server / gui / gnome level
     as well. Try "$ xinput list" / "$ xinput help".

Back to comp.os.linux.development.apps | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Keyboard lock applet? Carlos Moreno <moreno_news@mailinator.com> - 2012-02-17 11:15 -0500
  Re: Keyboard lock applet? Patrick <patrick2000@a2s46.webhop.net> - 2012-02-17 22:42 +0100
  Re: Keyboard lock applet? Patrick <patrick2000@a2s46.webhop.net> - 2012-02-19 00:00 +0100
    Re: Keyboard lock applet? Carlos Moreno <moreno_news@mailinator.com> - 2012-02-19 18:56 -0500

csiph-web