Coder Social home page Coder Social logo

hk's Introduction

hk: Set temporary X11 hotkeys

Overview

hk allows temporary X11 hotkeys to be set. Its usage is:

hk [-w] <hotkey> <command> [<argument> ...]

where <hotkey> is of the form [Modifier1[+Modifier2[+...]]+]<Key>. For example:

hk Ctrl+Shift+F6 notify-send "Hello"

will execute the command notify-send "Hello" when Ctrl+Shift+F6 is pressed. hk exits as soon as the command has executed.

hk passes through stdin unchanged so you can pipe input to commands e.g.:

uname | hk Ctrl+F8 xargs notify-send

By default, hk executes the command as soon as the hotkey sequence is pressed. The -w option makes hk wait until all keys (not just the hotkeys) have been released. This can be useful if the action of the command can be effected by key presses. For example if you use xdotool type to enter text on a hotkey, then having the Ctrl key held down can have surprising effects which -w can alleviate:

uname | hk -w Ctrl+F8 xdotool type --file -

Install

$ autoconf
$ ./configure
$ make install

hk's People

Contributors

ltratt avatar

Stargazers

 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

Forkers

ferhatazak

hk's Issues

Does hk support wayland ?

After your post about debugging ``Debugging A Failing Hotkey´´ I tried to install hk but I got some errors during compilation. I checked the code and I realize that you use X11 lib. Before going further I would like to check if Wayland is supported.

Not compiling

I like the simplicity of this script but I couldn't get this to install on Linux Mint 21.2 which uses X11. I have libx11-dev installed. Also tried added -L/usr/lib... Seems like it should be something I'm missing here?

gcc -Wl,-z,relro,-z,now -lX11 -L/usr/X11/lib -L/usr/lib -o hk hk.o
/usr/bin/ld: hk.o: in function `ignorable_modifiers':
/home/mikob/tools/hk/hk.c:49: undefined reference to `XKeysymToKeycode'
/usr/bin/ld: /home/mikob/tools/hk/hk.c:52: undefined reference to `XGetModifierMapping'
/usr/bin/ld: /home/mikob/tools/hk/hk.c:61: undefined reference to `XFreeModifiermap'
/usr/bin/ld: hk.o: in function `parse_modifier':
/home/mikob/tools/hk/hk.c:100: undefined reference to `XStringToKeysym'
/usr/bin/ld: /home/mikob/tools/hk/hk.c:103: undefined reference to `XKeysymToKeycode'
/usr/bin/ld: /home/mikob/tools/hk/hk.c:104: undefined reference to `XGetModifierMapping'
/usr/bin/ld: /home/mikob/tools/hk/hk.c:115: undefined reference to `XFreeModifiermap'
/usr/bin/ld: hk.o: in function `parse_key':
/home/mikob/tools/hk/hk.c:126: undefined reference to `XStringToKeysym'
/usr/bin/ld: /home/mikob/tools/hk/hk.c:130: undefined reference to `XKeysymToKeycode'
/usr/bin/ld: hk.o: in function `main':
/home/mikob/tools/hk/hk.c:199: undefined reference to `XOpenDisplay'
/usr/bin/ld: /home/mikob/tools/hk/hk.c:208: undefined reference to `XGrabKey'
/usr/bin/ld: /home/mikob/tools/hk/hk.c:211: undefined reference to `XGrabKey'
/usr/bin/ld: /home/mikob/tools/hk/hk.c:215: undefined reference to `XSelectInput'
/usr/bin/ld: /home/mikob/tools/hk/hk.c:218: undefined reference to `XNextEvent'
/usr/bin/ld: /home/mikob/tools/hk/hk.c:277: undefined reference to `XCloseDisplay'
/usr/bin/ld: /home/mikob/tools/hk/hk.c:229: undefined reference to `XQueryKeymap'
/usr/bin/ld: /home/mikob/tools/hk/hk.c:244: undefined reference to `XkbKeycodeToKeysym'
/usr/bin/ld: /home/mikob/tools/hk/hk.c:255: undefined reference to `XKeysymToString'
collect2: error: ld returned 1 exit status
make: *** [Makefile:17: hk] Error 1

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.