On Wed, 30 Jul 2014 11:23:53 -0400
"Elv1313 ." <[email protected]> wrote:

> Hello,
> 
> Awesome does have a fake_input function somewhere in the API. It might
> do the job for you. You can find examples here
> https://github.com/Elv13/repetitive/blob/master/macro.lua

Thanks a lot! Although the fake_input method didn't work, it set me in the 
right direction to partially solve it.

It seems that for some strange reason awesome "grabs" the input and something 
not intended happens to the intended command, it gets right if the command is 
executed on key release instead of key press, or something along those lines, I 
read it here:

https://www.mail-archive.com/[email protected]/msg06459.html

So I got the play/pause and previous/next song working like this:

in the global keys table:
-- Short-cuts for media play control
awful.key({modkey}, "Insert",  nil, function () os.execute("xdotool key --delay 
0 XF86AudioPlay") end ),
awful.key({modkey}, "Home",  nil, function ()  os.execute("xdotool key --delay 
0 XF86AudioPrev")  end ),
awful.key({modkey}, "End",    nil, function ()  os.execute("xdotool key --delay 
0 XF86AudioNext")  end ),

The mute and volume up/down keys still refuse to work, so I went and just 
assigned the keys in KDE configuration to have kmix control the volume. 

Again, thanks for the tip and I hope this helps someone else looking for some 
media key emulation in a media key-less keyboard :)








 
> On 30 July 2014 05:01, Navi Charlotte <[email protected]> wrote:
> > Hello,
> >
> > I am trying to emulate media keys in my keyboard by assigning a shortcut
> > like Mod4 + a key in the Home block
> >
> > The code its like this
> >
> > awful.key({ modkey,}, "Delete",
> >   function () awful.util.spawn_with_shell("xdotool key XF86AudioMute")  end
> > ),
> >
> > But it didnt work. If I execute the command in a terminal, it works. If I
> > asssign some other function to the same key combination, it works too.
> >
> > I have tried with os.execute() and awful.util.spawn() as well, but no avail.
> >
> > I also tried something like this that I saw in other post that explained
> > that awesome was grabbing the key, so it needed a delay to give me time to
> > release the key before xdotool was executed:
> >
> > awful.key({ modkey,}, "Insert",
> >    function () awful.util.spawn_with_shell("sh -c 'sleep 0.5;xdotool key
> > XF86AudioPlay")  end ),
> >
> > And didnt work either, so I am out of ideas.
> > Any help will be greatly appreciated
> >
> > This is the version of awesome I have
> > awesome v3.5.5 (Kansas City Shuffle)
> >  • Build: Apr 11 2014 09:36:33 for x86_64 by gcc version 4.8.2 (nobody@)
> >  • Compiled against Lua 5.2.3 (running with Lua 5.2)
> >  • D-Bus support: ✔
> >
> >
> >
> > --
> > To unsubscribe, send mail to [email protected].


-- 
Navi Charlotte <[email protected]>

-- 
To unsubscribe, send mail to [email protected].

Reply via email to