Code Monkey home page Code Monkey logo

xbanish's Introduction

xbanish

xbanish hides the mouse cursor when you start typing, and shows it again when the mouse cursor moves or a mouse button is pressed. This is similar to xterm's pointerMode setting, but xbanish works globally in the X11 session.

unclutter's -keystroke mode is supposed to do this, but it's broken. I looked into fixing it, but unclutter was abandoned so I wrote xbanish.

The name comes from ratpoison's "banish" command that sends the cursor to the corner of the screen.

Implementation

If the XInput extension is supported, xbanish uses it to request input from all attached keyboards and mice. If XInput 2.2 is supported, raw mouse movement and button press inputs are requested which helps detect cursor movement while in certain applications such as Chromium.

If Xinput is not available, xbanish recurses through the list of windows starting at the root, and calls XSelectInput() on each window to receive notification of mouse motion, button presses, and key presses.

In response to any available keyboard input events, the cursor is hidden. On mouse movement or button events, the cursor is shown.

xbanish initially hid the cursor by calling XGrabPointer() with a blank cursor image, similar to unclutter's -grab mode, but this had problematic interactions with certain X applications. For example, xlock could not grab the pointer and sometimes didn't lock, xwininfo wouldn't work at all, Firefox would quickly hide the Awesome Bar dropdown as soon as a key was pressed, and xterm required two middle-clicks to paste the clipboard contents.

To avoid these problems and simplify the implementation, xbanish now uses the modern Xfixes extension to easily hide and show the cursor with XFixesHideCursor() and XFixesShowCursor().

xbanish's People

Contributors

bahamas10 avatar ckath avatar grahamgower avatar harveyhunt avatar jcs avatar johnhill avatar jvvv avatar malex984 avatar mmitch avatar n-r-k avatar nickers avatar pushcx avatar r3v2d0g avatar toluschr avatar winny- avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.