Skip to content

Commit

Permalink
Show modified emoji when asking for skin tone
Browse files Browse the repository at this point in the history
Instead of just showing the skin tones in the second selection step, why
not show the complete emoji with modifiers? This is a lot friendlier
than just showing the modification all alone.
  • Loading branch information
fdw committed Dec 29, 2018
1 parent 45fa065 commit 96dcd6b
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions rofimoji.py
Original file line number Diff line number Diff line change
Expand Up @@ -1661,16 +1661,22 @@
'🦵', '👇', '🕺', '🦹', '🧗', '👩', '🕵', '💆', '🦶', '🤰', '🤘',
'🤦', '🤷', '👉', '👳', '🎅', '🤙'}

fitzpatrick_modifiers = """ neutral
🏻 light skin
🏼 medium-light skin
🏽 moderate skin
🏾 dark brown skin
🏿 black skin
"""
fitzpatrick_modifiers = {
'': 'neutral',
'🏻': 'light skin',
'🏼': 'medium-light skin',
'🏽': 'moderate skin',
'🏾': 'dark brown skin',
'🏿': 'black skin'
}


def select_skin_tone(selected_emoji: chr):
modified_emojis = '\n'.join(map(
lambda modifier: selected_emoji + modifier + " " + fitzpatrick_modifiers[modifier],
fitzpatrick_modifiers.keys()
))

rofi_skin = Popen(
args=[
'rofi',
Expand All @@ -1686,7 +1692,7 @@ def select_skin_tone(selected_emoji: chr):
stdout=PIPE
)

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

if rofi_skin.returncode == 1:
return ''
Expand Down Expand Up @@ -1717,7 +1723,7 @@ def select_skin_tone(selected_emoji: chr):
emoji = line.split()[0].decode('utf-8')

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

if rofi.returncode == 0:
time.sleep(0.1)
Expand Down

0 comments on commit 96dcd6b

Please sign in to comment.