Code Monkey home page Code Monkey logo

control-freak's Introduction

Control Freak

Control Freak is a utility to control other programs with your joystick or other input devices.

This version is demo code that the authors passed around privately to discuss basic design and implementation. It is released because it may be useful to some people in this very simple, but working, form.

Here’s a quick discussion of the implementation of this version:

Everything is hardcoded here, but that means there aren't a lot of hidden moving parts. On my joystick, it will send a Shift-V when you press the joystick's A button.

The dispatch table is the “chained if” (which only has one condition right now) in handle_js.

To ensure that chords are handled properly, it will send everything but the last button, then 10ms later send the last button, then 10ms after that release them all. (It's actually telling the X server to queue all those key events with those times, but sends the event stream all at the same time.)

This uses the XTEST extension to send these as “global” keyboard events, rather than sending synthetic events to a particular window. See “SENDEVENT NOTES” in the xdotool manpage. If you want it to send events to a particular window, you’ll need to change some stuff.

This version doesn’t react well to things like a disconnected joystick.

If the KeyRelease events don’t get sent, then you might be stuck with a modifier held down; in that case, you can just tap the keys on your keyboard to make sure they’re seen as released. (I have to do that a lot when I alt-tab to and from a VNC session, since the alt down will be seen by VNC but not the alt up.)

control-freak's People

Watchers

 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.