You can send a CTRL+V with

 root.fake_input("key_press",37);  root.fake_input("key_press",55);  root.
fake_input("key_release",55);  root.fake_input("key_release",37);

where 37 and 55  are the keycodes for "Left CTRL" and "V" respectively. You
can find them with xev utility.

or you can use xdotool as I did in my script (written before I started
using awesome)
https://code.google.com/p/max-repo/source/browse/trunk/awesome/paste_senza_formattazione.s


BTW I think you don't need to change the copy behaviour, but just remove
the formatting with xsel when you paste text with modkey + V



On Sat, Sep 12, 2015 at 4:20 AM, Alexander Tsepkov <[email protected]>
wrote:

> So I was planning to remap my copy/paste keys to be more similar to mac
> for a while, since it doesn't interfere with terminal's ctrl+c command and
> doesn't require the use of shift. Today I finally stopped being lazy and
> slapped something together that I expected to work:
>
>     awful.key({ modkey,           }, "c", function () os.execute('xsel -p
> -o | xsel -i -b') end),
>     awful.key({ modkey,           }, "v", function ()
>         local handle = io.popen('xsel -ob')
>         local result = handle:read('*a')
>         handle:close()
>         return result
>     end),
>
> The copy part works fine, the paste does not. I realize that instead of
> "return"ing the result, I should emit it, insert that text at mouse
> position (or if I could just trigger ctrl+v that would be good enough too).
> I know result contains the text I want, I used naughty.notify to check, but
> I'm clueless about how to emit it. Can someone help?
>
> Thanks
>

Reply via email to