Browse Source

use clipboard and Control+v to insert emojis

tags/3.0.0
Vyacheslav Konovalov 4 months ago
parent
commit
5f150c90d4
1 changed files with 7 additions and 8 deletions
  1. 7
    8
      rofimoji.py

+ 7
- 8
rofimoji.py View File

@@ -1806,18 +1806,17 @@ else:
emojis += emoji

if rofi.returncode == 0:
# HACK: using primary selection and middle mouse button
# to make emojis insertion work in Firefox and Telegram
xsel = Popen(args=['xsel', '-op'], stdout=PIPE)
primary_selection = xsel.communicate()[0].decode("utf-8")
# HACK: using clipboard and Control+v to insert emojis in Firefox and Telegram
xsel = Popen(args=['xsel', '-ob'], stdout=PIPE)
clipboard = xsel.communicate()[0].decode("utf-8")

xsel = Popen(args=['xsel', '-ip'], stdin=PIPE)
xsel = Popen(args=['xsel', '-ib'], stdin=PIPE)
xsel.communicate(input=emojis.encode('utf-8'))

Popen(args=['xdotool', 'click', '--window', active_window, '2']).wait()
Popen(args=['xdotool', 'key', '--clearmodifiers', '--window', active_window, 'Control+v']).wait()

xsel = Popen(args=['xsel', '-ip'], stdin=PIPE)
xsel.communicate(input=primary_selection.encode('utf-8'))
xsel = Popen(args=['xsel', '-ib'], stdin=PIPE)
xsel.communicate(input=clipboard.encode('utf-8'))
elif rofi.returncode == 10:
xsel = Popen(
args=[

Loading…
Cancel
Save