Skip to main content

An X11 utility that hides the mouse pointer after a specified interval of time

Project description

A utility that hides the mouse after a specified interval of time has elapsed without activity.

What is this?

This is a small utility for linux desktops that hides the mouse during periods of inactivity. When the user does need to use the mouse again, the mouse pointer will be unhidden so that normal use can resume. Some users tend to get distracted when reading or working with a mouse pointer that sits over the content. This is very similar to programs like hhp, hhpc, unclutter, etc.

The process flow of mousetrap is as follows:

  1. There is no activity for user-specified amount of time (i.e. 6 seconds)

  2. Mouse is hidden

  3. Mouse is used, and subsequently unhidden

  4. Go back to step 1

If there is activity (i.e. click or movement) before the amount of time has elapsed in step 1, then the timer is reset and control remains in step 1.

What’s wrong with the others?

The other programs I’ve encountered had one or more of the following issues:

  • Resets the timer on motion, but not on button presses

  • Resets the timer on button presses, but not on motion

  • Reactivates mouse on click, but does not register the click on the window

  • Program predictably fails after a short amount of time

  • Does not work on tiling window managers like mine (Xmonad WM)

  • Works on tiling window managers, but fails to hide when sitting in between windows

The mere presence of any of the above issues is sufficient for me not to use such a program.

How do I install this?

Do you have Arch Linux? Great, if so you can skip the rest of the instructions at the bottom and install it directly from the AUR: https://aur.archlinux.org/packages/mousetrap/

Otherwise, In order to build this application you need to install Python >= 3.0 (https://www.python.org)

After the installation, you may proceed to the first step below.

First, install with:

$ python setup.py install

Then, assuming that the path you installed mousetrap to is in your $PATH:

$ mousetrap -t 10

The -t flag specifies your preferred idle time, in seconds. All flag options are _absolutely_ mandatory.

Issues

Some users have reported seeing an error of the form:

Xlib.error.DisplayConnectionError: Can't connect to display ":0": b'Invalid MIT-MAGIC-COOKIE-1 key'

@deepakshantilalshah claims that the example command below is a workaround for such issues:

DISPLAY=:0 mousetrap -t 10

See https://github.com/eazar001/mousetrap/issues/5 for more information.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mousetrap-3.0.5.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

mousetrap-3.0.5-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file mousetrap-3.0.5.tar.gz.

File metadata

  • Download URL: mousetrap-3.0.5.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.7.0

File hashes

Hashes for mousetrap-3.0.5.tar.gz
Algorithm Hash digest
SHA256 e219ba65bf591532ed0538c7a88b5504620a40158f3dbe78fc4acb051922cdc3
MD5 cbe79798041cc61f97913b5ce9957280
BLAKE2b-256 d267f34df77383c0cd551c8a791ae3f6171c6189217a9bcb8d0f4ebd6e99d32d

See more details on using hashes here.

File details

Details for the file mousetrap-3.0.5-py3-none-any.whl.

File metadata

  • Download URL: mousetrap-3.0.5-py3-none-any.whl
  • Upload date:
  • Size: 4.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.7.0

File hashes

Hashes for mousetrap-3.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 ed4f023e34b62f765c86ec95b4323088a968ad21246c2392dd3193ae7ed8058a
MD5 f161e78224e6ba8a3397a3f9768f9966
BLAKE2b-256 60a1b0a92d22e8d88e373c6711369ed82d47e0c30062c8afec7941340627667a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page