I'm new to awesome wm and I'm trying to bind a key to another key. eg
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"
I think I may be misunderstanding your question.
Interpretation 1:
Just copy the code from that other key binding.
In the default config, mod+j
is:
awful.key({ modkey, }, "j",
function ()
awful.client.focus.byidx( 1)
if client.focus then client.focus:raise() end
end),
Copy that part and change the key:
awful.key({ }, "Down",
function ()
awful.client.focus.byidx( 1)
if client.focus then client.focus:raise() end
end),
Interpretation 2:
awful.key({ modkey, }, "j",
function ()
root.fake_input("key_press", "Down")
root.fake_input("key_release", "Down")
end),
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.
这对我来说适用于gtk2应用程序:
awful.key({ "Control", }, "n", function (c) awful.util.spawn_with_shell("xdotool getactivewindow key --window %1 Down") end)
As their documentation says, there is a config file located in
$XDG_CONFIG_HOME/awesome/rc.lua.
I do not have awesome vm installed to tell you exactly what to change inside but you will figure it out easily. Also, to completely change the path of the config file use :
-c, --config FILE
Use an alternate configuration file instead of $XDG_CONFIG_HOME/awesome/rc.lua.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.