Find the answer to your Linux question:
Results 1 to 2 of 2
Hi all, How to get the idle time of keyboard and mouse in linux?? Thanks in advance!! -g.phanibabu...
  1. #1
    Just Joined!
    Join Date
    Jul 2008
    Location
    Hyderabad,India.
    Posts
    20

    Unhappy Keyboard & Mouse Idle times

    Hi all,

    How to get the idle time of keyboard and mouse in linux??

    Thanks in advance!!

    -g.phanibabu
    Last edited by g.phanibabu; 05-20-2011 at 10:43 AM.

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,974
    Write X11 code that traps keyboard and mouse events, and when it sees such will start a timer. You could then send a message to the application and it could return the idle time information to you. However, this communication would have to be from either another computer, or an application that is running without need for keyboard/mouse input.

    FWIW, there are a lot of tools running on your system that do this already, such as the screen saver or applications such as Pidgin and Skype that will change your status to "away" after some period of keyboard/mouse idle time. Pidgin is open source (skype is not), so you can get the source code for that to find out how to do what you want.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...