Coder Social home page Coder Social logo

thotkeys's Introduction

thotkeys

A "transparent" hotkey implementation for X11 - thotkeys will not consume any keyboard events and they will be passed down to the focused window intact.

Typically, window managers implement a hotkey feature with GrabKey. A big problem with the approach is that activating a hotkey grabs the entire keyboard until the hotkey is released. This makes it impossible to accomplish a common request: "doing something while a hotkey is held down, while allowing applications to process other key input events".

thotkeys instead uses the X Input Device Extension to monitor key events directly from an input device, but not grab it.

Installation

$ autoreconf -i
$ ./configure
$ make
$ make install

Usage

Monitor events:

$ ./thotkeys --monitor
# released key Return
--key Control_L # pressed key Control_L
--key Control_L --key Super_L # pressed key Super_L
--key Control_L --key Super_L --button 1 # pressed button 1
--key Control_L --key Super_L # released button 1
--key Control_L # released key Super_L
# released key Control_L

Register hotkeys:

$ ./thotkeys \
	--hotkey --key Control_L --key Super_L --button 1 \
	--on-press 'while :; do echo LCtrl+LWin+LClick is pressed; sleep 0.1; done'

$ # Registering multiple hotkeys
$ ./thotkeys \
	--hotkey --key Control_L --key m --on-press \
		'while :; do echo Ctrl+M is pressed; sleep 0.1; done' \
	--hotkey --key F11 --on-press \
		'while :; do echo F11 is pressed; sleep 0.1; done'

The program passed to --on-press is executed on a shell. The process will receive SIGTERM once the hotkey is released.

Limitations

  • The hotkey is always global and it is currently not possible to enable or disable hotkeys conditionally.

  • The current KeyCode <-> KeySym conversion is probably erroneous. How does it behave with a different keyboard layout, or when multiple keyboards are connected to the computer?

License

thotkeys is licensed under the MIT license. See also COPYING.

thotkeys's People

Contributors

rhenium avatar

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.