Browse Source

Add second skin color step to the emoji picker

Holy fuck, this is cool ๐Ÿ‘๐Ÿป
tags/2.0.0
Fabian Winter 1 year ago
parent
commit
ab768cf7c0
1 changed files with 50 additions and 4 deletions
  1. 50
    4
      rofimoji.py

+ 50
- 4
rofimoji.py View File

@@ -3,7 +3,7 @@

from subprocess import Popen, PIPE

emojis="""๐Ÿ˜€ grinning face
emojis = """๐Ÿ˜€ grinning face
๐Ÿ˜ƒ grinning face with big eyes
๐Ÿ˜„ grinning face with smiling eyes
๐Ÿ˜ beaming face with smiling eyes
@@ -1649,6 +1649,48 @@ emojis="""๐Ÿ˜€ grinning face
๐Ÿด๓ ง๓ ข๓ ท๓ ฌ๓ ณ๓ ฟ flag: Wales
"""

skin_tone_selectable_emojis = {'๐Ÿ„', '๐Ÿ‘ผ', '๐Ÿ’‚', 'โœŒ', '๐Ÿ‘ƒ', '๐Ÿง™', '๐Ÿ–', '๐Ÿ•ด', '๐Ÿ––', '๐Ÿ‘', '๐Ÿ‘ฑ', '๐Ÿ‘‹', '๐Ÿง', '๐Ÿ‘ฐ', '๐Ÿง›',
'๐Ÿค›', '๐Ÿ‘Œ', '๐Ÿ‘‚', 'โœ', '๐ŸคŸ', '๐Ÿ™Ž', '๐Ÿšถ', '๐Ÿคด', '๐Ÿ‘', '๐Ÿ™', '๐Ÿง“', '๐Ÿšฃ', '๐Ÿ‘ฎ', '๐Ÿ™Œ', '๐Ÿ‘ง',
'โœ‹', '๐Ÿ‹', '๐Ÿ™‡', '๐Ÿง–', '๐Ÿ‘ท', '๐Ÿšต', '๐Ÿ›€', '๐Ÿคถ', '๐Ÿ‘Š', '๐Ÿ‘ฆ', '๐Ÿ‘ธ', '๐Ÿ’ช', '๐Ÿ™†', '๐Ÿคฑ', '๐Ÿคธ',
'๐Ÿคž', '๐Ÿ–•', 'โ›น', '๐Ÿ‘ฒ', '๐Ÿง‘', '๐Ÿ’', '๐Ÿง˜', '๐Ÿ™‹', 'โ˜', '๐Ÿง•', '๐Ÿ‘ต', '๐Ÿšด', '๐Ÿ‡', '๐Ÿคณ', '๐Ÿ™',
'๐Ÿง’', '๐Ÿ‘ถ', '๐Ÿฆธ', '๐Ÿ‘จ', '๐Ÿ‘†', '๐Ÿ’ƒ', '๐Ÿคพ', '๐Ÿ‚', '๐Ÿ›Œ', '๐Ÿคน', '๐Ÿ‘ˆ', 'โœŠ', '๐Ÿงš', '๐Ÿ’…', '๐Ÿคฝ',
'๐Ÿ™…', '๐Ÿง”', '๐Ÿคฒ', '๐Ÿ‘Ž', '๐Ÿ‘ด', '๐ŸŒ', '๐Ÿงœ', '๐Ÿ‘', '๐Ÿคš', '๐Ÿคต', '๐Ÿ’‡', '๐Ÿƒ', '๐ŸŠ', '๐Ÿคœ', '๐Ÿฆต',
'๐Ÿ‘‡', '๐Ÿ•บ', '๐Ÿฆน', '๐Ÿง—', '๐Ÿ‘ฉ', '๐Ÿ•ต', '๐Ÿ’†', '๐Ÿฆถ', '๐Ÿคฐ', '๐Ÿค˜', '๐Ÿคฆ', '๐Ÿคท', '๐Ÿ‘‰', '๐Ÿ‘ณ', '๐ŸŽ…',
'๐Ÿค™'}

fitzpatrick_modifiers = """ neutral
๐Ÿป light skin
๐Ÿผ medium-light skin
๐Ÿฝ moderate skin
๐Ÿพ dark brown skin
๐Ÿฟ black skin
"""


def select_skin_tone(emoji: chr):
rofi_skin = Popen(
args=[
'rofi',
'-dmenu',
'-i',
'-multi-select',
'-p',
emoji + ' ',
'-kb-custom-1',
'Alt+c'
],
stdin=PIPE,
stdout=PIPE
)

(stdout_skin, stderr_skin) = rofi_skin.communicate(input=fitzpatrick_modifiers.encode('utf-8'))

if rofi_skin.returncode == 1:
return ''
else:
return stdout_skin.split()[0].decode('utf-8')


rofi = Popen(
args=[
'rofi',
@@ -1669,14 +1711,18 @@ if rofi.returncode == 1:
exit()
else:
for line in stdout.splitlines():
emoji = line.split()[0]
emoji = line.split()[0].decode('utf-8')

if emoji in skin_tone_selectable_emojis:
emoji = emoji + select_skin_tone(emoji)

if rofi.returncode == 0:
Popen(
args=[
'xdotool',
'type',
'--clearmodifiers',
emoji.decode('utf-8')
emoji
]
)
elif rofi.returncode == 10:
@@ -1688,4 +1734,4 @@ else:
],
stdin=PIPE
)
xsel.communicate(input=emoji)
xsel.communicate(input=emoji.encode('utf-8'))

Loadingโ€ฆ
Cancel
Save