3

I want to implement the simplest functionality possible - remap key a to t. In my rc.lua I have following lines:

function myremapp_ress()
  root.fake_input('key_press', "t")
end

function myremap_release()
  root.fake_input('key_release', "t")
end

-- {{{ Key bindings
globalkeys = gears.table.join(    
   awful.key({ }, "a", myremap_press, myremap_release),

Which is not forking, because as I get you need to stop keygrabber to be able to perform fake_input. If I change to this:

function myremapp_ress()
  keygrabber.stop()
  root.fake_input('key_press', "t")
end

Now I can input t instead of a, but myremap_release now not working and t is entered forewer, until other keyword not added. I could stop it by myself, but then when you hold down key, you get only first press key as result:

function myremapp_ress()
  keygrabber.stop()
  root.fake_input('key_press', "t")
  root.fake_input('key_release', "t")
end

I tried that:

function myremapp_ress()
  keygrabber.stop()
  root.fake_input('key_press', "t")
  keygrabber.run()
end

but it simply returns error that I should supply param to keygrabber.run (which is strange, since from documentation both function get the same argument).

So my question is how to make that simple thing? Is there some way to simply pause keygrabber? Is there some keygrabber.active flag that got checked in keygrabber loop? How can I restart keygrabber after I stopped it to run fake_input?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.