Skip to content

Commit eda3837

Browse files
committed
fix: adapt emojipedia icon size
1 parent caa8620 commit eda3837

File tree

6 files changed

+18
-4
lines changed

6 files changed

+18
-4
lines changed

src/api.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import os
22
import sys
33
import subprocess
4-
from utils import api_file_path, data_folder_path, icons_folder_path, display_notification, language, padding
4+
from utils import api_file_path, data_folder_path, icons_folder_path, assets_folder_path, display_notification, language, padding
55
def get_homebrew_prefix():
66
try:
77
prefix = subprocess.check_output(['brew', '--prefix'])
@@ -41,7 +41,7 @@ def get_homebrew_prefix():
4141
check_e_type = ['flag:', 'keycap:']
4242

4343
def convert_emoji_to_png(emoji, name):
44-
image_size = (64+padding, 64+padding) # set image size
44+
image_size = (64 + padding, 64 + padding) # set image size
4545
image = Image.new("RGBA", image_size, (0, 0, 0, 0)) # Set transparent background
4646
font_size = 64 # Adjusted font size
4747
font_path = "/System/Library/Fonts/Apple Color Emoji.ttc"
@@ -100,6 +100,17 @@ def convert_emoji_to_png(emoji, name):
100100
with open(api_file_path, 'w', encoding='utf-8') as file:
101101
json.dump({'info': info, 'items': items}, file, ensure_ascii=False, indent=4)
102102

103+
assets = [f for f in os.listdir(assets_folder_path)]
104+
105+
for i in assets:
106+
image_path = os.path.join(assets_folder_path, i)
107+
image = Image.open(image_path)
108+
width, height = image.size
109+
new_image = Image.new("RGBA", (width + padding, height + padding), (0, 0, 0, 0))
110+
new_image.paste(image, (int(padding / 2), int(padding / 2)))
111+
output_path = os.path.join(icons_folder_path, i)
112+
new_image.save(output_path)
113+
103114
display_notification('✅ Success !', 'Data updated. You can search emojis')
104115
except:
105116
display_notification('🚨 Error !', 'Something went wrong, check your internet connexion or create a GitHub issue')

src/icons/assets/emojipedia.png

13 KB
Loading

src/icons/emojipedia.webp

-6.96 KB
Binary file not shown.

src/info.plist

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1209,8 +1209,10 @@ note: not all emojis are available in all languages.</string>
12091209
<string>sound</string>
12101210
</dict>
12111211
</array>
1212+
<key>variablesdontexport</key>
1213+
<array/>
12121214
<key>version</key>
1213-
<string>1.2.4</string>
1215+
<string>1.2.5</string>
12141216
<key>webaddress</key>
12151217
<string>https://github.com/BenjaminOddou/alfred-emoji-wine</string>
12161218
</dict>

src/utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
padding = 10
1010
cache_folder_path = os.environ['alfred_workflow_cache'] # ~/Library/Caches/com.runningwithcrayons.Alfred/Workflow Data/com.benjamino.emoji_wine
1111
data_folder_path = os.environ['alfred_workflow_data'] # ~/Library/Application Support/Alfred/Workflow Data/com.benjamino.emoji_wine
12+
assets_folder_path = f'{os.getcwd()}/icons/assets'
1213
api_file_path = f'{cache_folder_path}/api.json'
1314
tags_file_path = f'{data_folder_path}/tags-{language}.json'
1415
icons_folder_path = f'{cache_folder_path}/icons'

src/wine.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
'subtitle': 'Find the emoji in emojipedia',
6565
'arg': f'_web;{country}/{url}',
6666
'icon': {
67-
'path': 'icons/emojipedia.webp',
67+
'path': f'{icons_folder_path}/emojipedia.png',
6868
},
6969
}
7070
})

0 commit comments

Comments
 (0)