Search code examples
linuxkeyboard-shortcutsawesome-wm

awesome wm - how to bind a key to another key


I'm new to awesome wm and I'm trying to bind a key to another key. e.g.

When I press alt+j, it will act like I just pressed the down key on keyboard.

I don't know whether awesome wm has this function or not?

Any function like this?

awful.key({ altkey }, "j", function () "down"

Solution

  • Finally, I found a not perfect solution. First, install xdotool, I'm using ArchLinux, so:

    yaourt -S xdotool
    

    And edit ~/.config/awesome/rc.lua

    awful.key({ altkey }, "j", function() 
        awful.util.spawn("sh -c 'xdotool sleep 0.1 key --clearmodifiers Down'") end),
    

    But somehow it will just input j, and I don't know why.