diff options
-rw-r--r-- | .SRCINFO | 18 | ||||
-rw-r--r-- | PKGBUILD | 68 | ||||
-rw-r--r-- | fix-skin-tone-static-path.patch | 722 | ||||
-rw-r--r-- | setup.py | 21 |
4 files changed, 47 insertions, 782 deletions
@@ -1,7 +1,7 @@ pkgbase = emote pkgdesc = Emoji Picker for Linux written in GTK3 - pkgver = 3.1.0 - pkgrel = 2 + pkgver = 4.0.1 + pkgrel = 1 url = https://github.com/tom-james-watson/Emote arch = any license = GPL3 @@ -12,14 +12,14 @@ pkgbase = emote depends = python-gobject depends = python-manimpango depends = libkeybinder3 + depends = python-setproctitle + depends = dbus-python + depends = hicolor-icon-theme + depends = emoji-font depends = xdotool - source = https://github.com/tom-james-watson/Emote/archive/1539e91d02c93e1438a2912940f687ce40dc2bfe.tar.gz - source = https://raw.githubusercontent.com/hfg-gmuend/openmoji/90c4aa28c902212d7e784f388ff5d1c15fcac617/data/openmoji.csv + source = https://github.com/tom-james-watson/Emote/archive/refs/tags/v4.0.1.tar.gz source = setup.py - source = fix-skin-tone-static-path.patch - sha512sums = SKIP - sha512sums = b726a0e89142da3bb0b67ca2b7fd1d7002832e01569eeb2de4a64abfd14cb3d7da315b086d171fe8dce11e9064c6c7922aa33863bff77b9073e505e91fe7e6b7 - sha512sums = ef8caea8ad9e9bc0487dd8c816561027adda743c1e8e2779a64e7ae99fb227c820f31ef9c87fb910bae7a8ffc623e5e2e1a53a8c69ce0a35ad96557e97a5a949 - sha512sums = 76e5a84646dafb37b6ee83e564aefd5ccaca619d47802d2ea4e4190ec2af5a0c485aa6d9a2f8969732ca7156c458fd18105614b6826ade834943a8c19c3d8e3f + sha256sums = 29814ec5dc5cef61f99a8c651fccefb8de7a034325a5b97a921f4b852509d3ca + sha256sums = fd547230882ef6ad500579afab912b0567e7ba061f36283c84b8504a78356d59 pkgname = emote @@ -1,57 +1,45 @@ # Maintainer: Luke Arms <luke@arms.to> pkgname=emote -pkgver=3.1.0 -_pkgref=1539e91d02c93e1438a2912940f687ce40dc2bfe -_openmojiref=90c4aa28c902212d7e784f388ff5d1c15fcac617 -pkgrel=2 +pkgver=4.0.1 +pkgrel=1 url="https://github.com/tom-james-watson/Emote" pkgdesc="Emoji Picker for Linux written in GTK3" arch=('any') license=('GPL3') -depends=('python' 'gtk3' 'python-gobject' 'python-manimpango' 'libkeybinder3' 'xdotool') +depends=('python' 'gtk3' 'python-gobject' 'python-manimpango' 'libkeybinder3' 'python-setproctitle' 'dbus-python' 'hicolor-icon-theme' 'emoji-font' 'xdotool') makedepends=('python-setuptools' 'python-pipenv') -source=( - "https://github.com/tom-james-watson/Emote/archive/${_pkgref}.tar.gz" - "https://raw.githubusercontent.com/hfg-gmuend/openmoji/${_openmojiref}/data/openmoji.csv" - 'setup.py' - 'fix-skin-tone-static-path.patch' -) -sha512sums=( - 'SKIP' - 'b726a0e89142da3bb0b67ca2b7fd1d7002832e01569eeb2de4a64abfd14cb3d7da315b086d171fe8dce11e9064c6c7922aa33863bff77b9073e505e91fe7e6b7' - 'ef8caea8ad9e9bc0487dd8c816561027adda743c1e8e2779a64e7ae99fb227c820f31ef9c87fb910bae7a8ffc623e5e2e1a53a8c69ce0a35ad96557e97a5a949' - '76e5a84646dafb37b6ee83e564aefd5ccaca619d47802d2ea4e4190ec2af5a0c485aa6d9a2f8969732ca7156c458fd18105614b6826ade834943a8c19c3d8e3f' -) +source=("https://github.com/tom-james-watson/Emote/archive/refs/tags/v${pkgver}.tar.gz" + 'setup.py') +sha256sums=('29814ec5dc5cef61f99a8c651fccefb8de7a034325a5b97a921f4b852509d3ca' + 'fd547230882ef6ad500579afab912b0567e7ba061f36283c84b8504a78356d59') prepare() { - # Replace setup.py - mv -f "$srcdir/setup.py" "$srcdir/Emote-$_pkgref/setup.py" - # Fix skin tone and `static/` path issues when not running as a snap - patch -d "$srcdir/Emote-$_pkgref" -p1 <"$srcdir/fix-skin-tone-static-path.patch" - cd "$srcdir/Emote-$_pkgref" - ./update-emojis "$srcdir/openmoji.csv" + local staticdir=$srcdir/Emote-$pkgver/static rootdir + # Remove "X-Flatpak=..." and replace "Icon=..." while copying + # com.tomjwatson.Emote.desktop to emote.desktop + sed -E '/^X-Flatpak=/d; s/^(Icon)=.*/\1=emote/' \ + "$staticdir/com.tomjwatson.Emote.desktop" | + install -Dm 644 /dev/stdin "$staticdir/emote.desktop" + # Duplicate logo.svg as emote.svg to save renaming it later + install -Dm 644 "$staticdir/logo.svg" "$staticdir/emote.svg" + # Add static files Emote needs at runtime to the emote package + install -Dm 644 -t "$srcdir/Emote-$pkgver/emote/static/" "$staticdir"/{emojis.csv,logo.svg,style.css} + # Replace setup.py with one that installs the assets above + install -Dm 644 "$srcdir/setup.py" "$srcdir/Emote-$pkgver/setup.py" + # And replace relative references to "static/" + rootdir=$(python -c 'import sysconfig as _; print(_.get_paths()["purelib"])')/emote + rootdir=${rootdir//\\/\\\\} + rootdir=${rootdir//\//\\\/} + sed -Ei "s/([^/])(static\\/)/\\1${rootdir}\\/\\2/" "$srcdir/Emote-$pkgver"/emote/*.py } build() { - # Move static files into the library - mv -T "$srcdir/Emote-$_pkgref/static" "$srcdir/Emote-$_pkgref/emote/static" - # Fix .desktop file - sed -Ei 's/\$\{SNAP\}//' "$srcdir/Emote-$_pkgref/snap/gui/emote.desktop" - # Fix version number - sed -Ei \ - "s/os\\.environ\\.get\\(\"SNAP_VERSION\", \"dev build\"\\)/\"$pkgver\"/" \ - "$srcdir/Emote-$_pkgref/emote/picker.py" - cd "$srcdir/Emote-$_pkgref" - EMOTE_VERSION="$pkgver" \ - python setup.py build + cd "$srcdir/Emote-$pkgver" + python setup.py build } package() { - cd "$srcdir/Emote-$_pkgref" - EMOTE_VERSION="$pkgver" \ - python setup.py install --root="$pkgdir" --optimize=1 --skip-build - install -d -m 0755 "$pkgdir/etc/xdg/autostart" - install -m 0644 "$pkgdir/usr/share/applications/emote.desktop" \ - "$pkgdir/etc/xdg/autostart/emote.desktop" + cd "$srcdir/Emote-$pkgver" + python setup.py install --root="$pkgdir" --optimize=1 --skip-build } diff --git a/fix-skin-tone-static-path.patch b/fix-skin-tone-static-path.patch deleted file mode 100644 index 1cd8e5b5a420..000000000000 --- a/fix-skin-tone-static-path.patch +++ /dev/null @@ -1,722 +0,0 @@ -diff --git a/emote/__init__.py b/emote/__init__.py -index e841a26..dc94802 100644 ---- a/emote/__init__.py -+++ b/emote/__init__.py -@@ -9,10 +9,7 @@ from gi.repository import Gtk, Keybinder - from emote import picker, css, emojis, user_data, config, debouncer - - # Register updated emoji font --if config.is_snap: -- manimpango.register_font(f"{config.snap_root}/static/NotoColorEmoji.ttf") --else: -- manimpango.register_font("static/NotoColorEmoji.ttf") -+manimpango.register_font(f"{config.static_root}/NotoColorEmoji.ttf") - - settings = Gtk.Settings.get_default() - -diff --git a/emote/config.py b/emote/config.py -index fa443b3..51bfffe 100644 ---- a/emote/config.py -+++ b/emote/config.py -@@ -6,3 +6,13 @@ is_dev = os.environ.get("ENV") == "dev" - is_snap = os.environ.get("SNAP") is not None - snap_root = os.environ.get("SNAP") - is_wayland = os.environ.get("XDG_SESSION_TYPE", "").lower() == "wayland" -+ -+if is_snap: -+ static_root = f"{snap_root}/static" -+elif is_dev: -+ static_root = os.path.dirname(os.path.dirname(__file__)) + "/static" -+else: -+ static_root = os.path.dirname(__file__) + "/static" -+ -+if not os.path.exists(static_root): -+ raise Exception(f"Directory not found: {static_root}") -diff --git a/emote/css.py b/emote/css.py -index bb305d8..707f4b1 100644 ---- a/emote/css.py -+++ b/emote/css.py -@@ -11,11 +11,7 @@ def load_css(): - Load associated CSS for the window. - """ - css_provider = Gtk.CssProvider() -- -- if config.is_snap: -- css_provider.load_from_path(f"{config.snap_root}/static/style.css") -- else: -- css_provider.load_from_path("static/style.css") -+ css_provider.load_from_path(f"{config.static_root}/style.css") - - screen = Gdk.Screen.get_default() - styleContext = Gtk.StyleContext() -diff --git a/emote/emojis.py b/emote/emojis.py -index d63c27a..07093af 100644 ---- a/emote/emojis.py -+++ b/emote/emojis.py -@@ -4,227 +4,232 @@ from collections import defaultdict - from emote import user_data, config - - --# These are emojis that support skintone sequences but that are not yet --# supported on the core18 snap base and as such would render as two separate --# emojis. --SKINTONE_SEQUENCE_BLOCKLIST = [ -- "hand_with_fingers_splayed", -- "victory_hand", -- "backhand_index_pointing_left", -- "backhand_index_pointing_right", -- "backhand_index_pointing_up", -- "backhand_index_pointing_down", -- "index_pointing_up", -- "thumbs_up", -- "thumbs_down", -- "writing_hand", -- "ear", -- "man_beard", -- "woman_beard", -- "woman_blond_hair", -- "man_blond_hair", -- "man_frowning", -- "woman_frowning", -- "man_pouting", -- "woman_pouting", -- "man_gesturing_no", -- "woman_gesturing_no", -- "man_gesturing_ok", -- "woman_gesturing_ok", -- "man_tipping_hand", -- "woman_tipping_hand", -- "man_raising_hand", -- "woman_raising_hand", -- "man_bowing", -- "woman_bowing", -- "man_facepalming", -- "woman_facepalming", -- "man_shrugging", -- "woman_shrugging", -- "health_worker", -- "man_health_worker", -- "woman_health_worker", -- "student", -- "man_student", -- "woman_student", -- "teacher", -- "man_teacher", -- "woman_teacher", -- "judge", -- "man_judge", -- "woman_judge", -- "farmer", -- "man_farmer", -- "woman_farmer", -- "cook", -- "man_cook", -- "woman_cook", -- "mechanic", -- "man_mechanic", -- "woman_mechanic", -- "factory_worker", -- "man_factory_worker", -- "woman_factory_worker", -- "office_worker", -- "man_office_worker", -- "woman_office_worker", -- "scientist", -- "man_scientist", -- "woman_scientist", -- "technologist", -- "man_technologist", -- "woman_technologist", -- "singer", -- "man_singer", -- "woman_singer", -- "artist", -- "man_artist", -- "woman_artist", -- "pilot", -- "man_pilot", -- "woman_pilot", -- "astronaut", -- "man_astronaut", -- "woman_astronaut", -- "firefighter", -- "man_firefighter", -- "woman_firefighter", -- "man_police_officer", -- "woman_police_officer", -- "detective", -- "man_detective", -- "woman_detective", -- "man_guard", -- "woman_guard", -- "man_construction_worker", -- "woman_construction_worker", -- "man_wearing_turban", -- "woman_wearing_turban", -- "man_in_tuxedo", -- "woman_in_tuxedo", -- "man_with_veil", -- "woman_with_veil", -- "woman_feeding_baby", -- "man_feeding_baby", -- "person_feeding_baby", -- "mx_claus", -- "man_mage", -- "woman_mage", -- "man_fairy", -- "woman_fairy", -- "man_vampire", -- "woman_vampire", -- "merman", -- "mermaid", -- "man_elf", -- "woman_elf", -- "man_getting_massage", -- "woman_getting_massage", -- "man_getting_haircut", -- "woman_getting_haircut", -- "man_walking", -- "woman_walking", -- "man_running", -- "woman_running", -- "person_in_suit_levitating", -- "man_in_steamy_room", -- "woman_in_steamy_room", -- "man_climbing", -- "woman_climbing", -- "snowboarder", -- "person_golfing", -- "man_golfing", -- "woman_golfing", -- "person_surfing", -- "man_surfing", -- "woman_surfing", -- "man_rowing_boat", -- "woman_rowing_boat", -- "person_swimming", -- "man_swimming", -- "woman_swimming", -- "person_bouncing_ball", -- "man_bouncing_ball", -- "woman_bouncing_ball", -- "person_lifting_weights", -- "man_lifting_weights", -- "woman_lifting_weights", -- "man_biking", -- "woman_biking", -- "man_mountain_biking", -- "woman_mountain_biking", -- "man_cartwheeling", -- "woman_cartwheeling", -- "man_playing_water_polo", -- "woman_playing_water_polo", -- "man_playing_handball", -- "woman_playing_handball", -- "man_juggling", -- "woman_juggling", -- "man_in_lotus_position", -- "woman_in_lotus_position", -- "people_holding_hands", -- "kiss_woman_man", -- "kiss_man_man", -- "kiss_woman_woman", -- "couple_with_heart_woman_man", -- "couple_with_heart_man_man", -- "couple_with_heart_woman_woman", -- "pinched_fingers", -- "pinching_hand", -- "leg", -- "foot", -- "ear_with_hearing_aid", -- "deaf_person", -- "ninja", -- "superhero", -- "supervillain", -- "person_standing", -- "person_kneeling", --] --# These are emojis that are not supported on core18 snap base and as such --# render as two separate emojis. The app itself bundles a recent version of the --# NotoColorEmoji font and so can display recent single char emojis, however any --# emojis that are sequences also require a recent version of pango for the OS --# to recognise and combine the sequences. Upgrading to core20 should let us --# include more recent unicode sequences: --# https://github.com/tom-james-watson/Emote/issues/48. --SEQUENCE_BLOCKLIST = [ -- "man_red_hair", -- "man_curly_hair", -- "man_white_hair", -- "man_bald", -- "woman_red_hair", -- "person_red_hair", -- "woman_curly_hair", -- "person_curly_hair", -- "woman_white_hair", -- "person_white_hair", -- "woman_bald", -- "person_bald", -- "deaf_man", -- "deaf_woman", -- "man_superhero", -- "woman_superhero", -- "man_supervillain", -- "woman_supervillain", -- "man_standing", -- "woman_standing", -- "man_kneeling", -- "woman_kneeling", -- "person_with_white_cane", -- "man_with_white_cane", -- "woman_with_white_cane", -- "person_in_motorized_wheelchair", -- "man_in_motorized_wheelchair", -- "woman_in_motorized_wheelchair", -- "person_in_manual_wheelchair", -- "man_in_manual_wheelchair", -- "woman_in_manual_wheelchair", -- "service_dog", -- "transgender_flag", -- "mending_heart", --] -+if config.is_snap: -+ # These are emojis that support skintone sequences but that are not yet -+ # supported on the core18 snap base and as such would render as two separate -+ # emojis. -+ SKINTONE_SEQUENCE_BLOCKLIST = [ -+ "hand_with_fingers_splayed", -+ "victory_hand", -+ "backhand_index_pointing_left", -+ "backhand_index_pointing_right", -+ "backhand_index_pointing_up", -+ "backhand_index_pointing_down", -+ "index_pointing_up", -+ "thumbs_up", -+ "thumbs_down", -+ "writing_hand", -+ "ear", -+ "man_beard", -+ "woman_beard", -+ "woman_blond_hair", -+ "man_blond_hair", -+ "man_frowning", -+ "woman_frowning", -+ "man_pouting", -+ "woman_pouting", -+ "man_gesturing_no", -+ "woman_gesturing_no", -+ "man_gesturing_ok", -+ "woman_gesturing_ok", -+ "man_tipping_hand", -+ "woman_tipping_hand", -+ "man_raising_hand", -+ "woman_raising_hand", -+ "man_bowing", -+ "woman_bowing", -+ "man_facepalming", -+ "woman_facepalming", -+ "man_shrugging", -+ "woman_shrugging", -+ "health_worker", -+ "man_health_worker", -+ "woman_health_worker", -+ "student", -+ "man_student", -+ "woman_student", -+ "teacher", -+ "man_teacher", -+ "woman_teacher", -+ "judge", -+ "man_judge", -+ "woman_judge", -+ "farmer", -+ "man_farmer", -+ "woman_farmer", -+ "cook", -+ "man_cook", -+ "woman_cook", -+ "mechanic", -+ "man_mechanic", -+ "woman_mechanic", -+ "factory_worker", -+ "man_factory_worker", -+ "woman_factory_worker", -+ "office_worker", -+ "man_office_worker", -+ "woman_office_worker", -+ "scientist", -+ "man_scientist", -+ "woman_scientist", -+ "technologist", -+ "man_technologist", -+ "woman_technologist", -+ "singer", -+ "man_singer", -+ "woman_singer", -+ "artist", -+ "man_artist", -+ "woman_artist", -+ "pilot", -+ "man_pilot", -+ "woman_pilot", -+ "astronaut", -+ "man_astronaut", -+ "woman_astronaut", -+ "firefighter", -+ "man_firefighter", -+ "woman_firefighter", -+ "man_police_officer", -+ "woman_police_officer", -+ "detective", -+ "man_detective", -+ "woman_detective", -+ "man_guard", -+ "woman_guard", -+ "man_construction_worker", -+ "woman_construction_worker", -+ "man_wearing_turban", -+ "woman_wearing_turban", -+ "man_in_tuxedo", -+ "woman_in_tuxedo", -+ "man_with_veil", -+ "woman_with_veil", -+ "woman_feeding_baby", -+ "man_feeding_baby", -+ "person_feeding_baby", -+ "mx_claus", -+ "man_mage", -+ "woman_mage", -+ "man_fairy", -+ "woman_fairy", -+ "man_vampire", -+ "woman_vampire", -+ "merman", -+ "mermaid", -+ "man_elf", -+ "woman_elf", -+ "man_getting_massage", -+ "woman_getting_massage", -+ "man_getting_haircut", -+ "woman_getting_haircut", -+ "man_walking", -+ "woman_walking", -+ "man_running", -+ "woman_running", -+ "person_in_suit_levitating", -+ "man_in_steamy_room", -+ "woman_in_steamy_room", -+ "man_climbing", -+ "woman_climbing", -+ "snowboarder", -+ "person_golfing", -+ "man_golfing", -+ "woman_golfing", -+ "person_surfing", -+ "man_surfing", -+ "woman_surfing", -+ "man_rowing_boat", -+ "woman_rowing_boat", -+ "person_swimming", -+ "man_swimming", -+ "woman_swimming", -+ "person_bouncing_ball", -+ "man_bouncing_ball", -+ "woman_bouncing_ball", -+ "person_lifting_weights", -+ "man_lifting_weights", -+ "woman_lifting_weights", -+ "man_biking", -+ "woman_biking", -+ "man_mountain_biking", -+ "woman_mountain_biking", -+ "man_cartwheeling", -+ "woman_cartwheeling", -+ "man_playing_water_polo", -+ "woman_playing_water_polo", -+ "man_playing_handball", -+ "woman_playing_handball", -+ "man_juggling", -+ "woman_juggling", -+ "man_in_lotus_position", -+ "woman_in_lotus_position", -+ "people_holding_hands", -+ "kiss_woman_man", -+ "kiss_man_man", -+ "kiss_woman_woman", -+ "couple_with_heart_woman_man", -+ "couple_with_heart_man_man", -+ "couple_with_heart_woman_woman", -+ "pinched_fingers", -+ "pinching_hand", -+ "leg", -+ "foot", -+ "ear_with_hearing_aid", -+ "deaf_person", -+ "ninja", -+ "superhero", -+ "supervillain", -+ "person_standing", -+ "person_kneeling", -+ ] -+ # These are emojis that are not supported on core18 snap base and as such -+ # render as two separate emojis. The app itself bundles a recent version of -+ # the NotoColorEmoji font and so can display recent single char emojis, -+ # however any emojis that are sequences also require a recent version of -+ # pango for the OS to recognise and combine the sequences. Upgrading to -+ # core20 should let us include more recent unicode sequences: -+ # https://github.com/tom-james-watson/Emote/issues/48. -+ SEQUENCE_BLOCKLIST = [ -+ "man_red_hair", -+ "man_curly_hair", -+ "man_white_hair", -+ "man_bald", -+ "woman_red_hair", -+ "person_red_hair", -+ "woman_curly_hair", -+ "person_curly_hair", -+ "woman_white_hair", -+ "person_white_hair", -+ "woman_bald", -+ "person_bald", -+ "deaf_man", -+ "deaf_woman", -+ "man_superhero", -+ "woman_superhero", -+ "man_supervillain", -+ "woman_supervillain", -+ "man_standing", -+ "woman_standing", -+ "man_kneeling", -+ "woman_kneeling", -+ "person_with_white_cane", -+ "man_with_white_cane", -+ "woman_with_white_cane", -+ "person_in_motorized_wheelchair", -+ "man_in_motorized_wheelchair", -+ "woman_in_motorized_wheelchair", -+ "person_in_manual_wheelchair", -+ "man_in_manual_wheelchair", -+ "woman_in_manual_wheelchair", -+ "service_dog", -+ "transgender_flag", -+ "mending_heart", -+ ] -+else: -+ SKINTONE_SEQUENCE_BLOCKLIST = [] -+ SEQUENCE_BLOCKLIST = [] -+ - EMOJI_CATEGORY_BLOCKLIST = ["component", "extras-openmoji", "extras-unicode"] - - -@@ -236,14 +241,9 @@ def init(): - global all_emojis - global emojis_by_category - -- filename = ( -- f"{config.snap_root}/static/emojis.csv" -- if config.is_snap -- else "static/emojis.csv" -- ) -- -- with open(filename, newline="") as csvfile: -+ with open(f"{config.static_root}/emojis.csv", newline="") as csvfile: - reader = csv.DictReader(csvfile) -+ skintone_templates = {} - - for row in reader: - category = row["group"] -@@ -255,6 +255,16 @@ def init(): - if category in ["smileys-emotion", "people-body"]: - category = "smileys-people" - -+ # Skin tone code points can appear anywhere in an emoji sequence -+ # (sometimes more than once), so we create a template from the first -+ # variant. -+ if row["skintone_combination"] == "single" and row["skintone"] == "1": -+ base_emoji = row["skintone_base_emoji"] -+ if base_emoji != "": -+ template = row["emoji"].replace(user_data.SKINTONES[1], "{}") -+ if "{}" in template: -+ skintone_templates[base_emoji] = template -+ - # Ignore emojis that are skintone combinations of other emojis. We - # will handle this ourselves in the app. - if row["skintone"] != "": -@@ -271,27 +281,44 @@ def init(): - "char": row["emoji"], - "name": row["annotation"].capitalize(), - "shortcode": shortcode, -- "skintone": row["skintone_combination"] == "single" -- and shortcode not in SKINTONE_SEQUENCE_BLOCKLIST, -+ "skintone": row["skintone_combination"] == "single" and -+ shortcode not in SKINTONE_SEQUENCE_BLOCKLIST, - } - emojis_by_category[category].append(emoji) - all_emojis.append(emoji) - -+ # Copy skin tone templates to emojis -+ for emoji in all_emojis: -+ if emoji["skintone"] and emoji["char"] in skintone_templates: -+ emoji["skintone_template"] = skintone_templates[emoji["char"]] -+ else: -+ emoji["skintone"] = False -+ - update_recent_category() - - - def strip_char_skintone(char): -- for skintone in user_data.SKINTONES: -- char = char.replace(skintone, "") -+ try: -+ emoji = get_emoji_by_char(char) -+ except Exception: -+ return char -+ -+ return emoji["char"] -+ -+ -+def get_skintone_template(char): -+ for skintone in user_data.SKINTONES[1:]: -+ char = char.replace(skintone, "{}") - - return char - - - def get_emoji_by_char(char): -- char = strip_char_skintone(char) -+ template = get_skintone_template(char) - - for emoji in all_emojis: -- if emoji["char"] == char: -+ if emoji["char"] == char or ( -+ "skintone_template" in emoji and emoji["skintone_template"] == template): - return emoji - - raise Exception(f"Couldn't find emoji by char {char}") -@@ -303,7 +330,7 @@ def update_recent_category(): - for char in user_data.load_recent_emojis(): - try: - emoji = get_emoji_by_char(char) -- except: -+ except Exception: - continue - emojis_by_category["recent"].append(emoji) - -diff --git a/emote/picker.py b/emote/picker.py -index 5788f1e..c4f5957 100644 ---- a/emote/picker.py -+++ b/emote/picker.py -@@ -133,19 +133,19 @@ class EmojiPicker(Gtk.Window): - return menu_button - - def init_skintone_button(self): -- skintone_combo = Gtk.ComboBoxText() -+ skintone_combo = Gtk.ComboBoxText(name="skintone_combo") - skintone_combo.set_entry_text_column(0) - skintone_combo.connect("changed", self.on_skintone_combo_changed) - - for skintone in user_data.SKINTONES: -- skintone_combo.append_text(skintone) -+ skintone_combo.append_text("👋" + skintone) - - skintone_combo.set_active(user_data.SKINTONES.index(user_data.load_skintone())) - - return skintone_combo - - def on_skintone_combo_changed(self, combo): -- skintone = combo.get_active_text() -+ skintone = combo.get_active_text().replace("👋", "") - - if skintone is not None: - user_data.update_skintone(skintone) -@@ -247,7 +247,7 @@ class EmojiPicker(Gtk.Window): - if skintone == user_data.DEFAULT_SKINTONE: - return char - -- return char + skintone -+ return emoji["skintone_template"].replace("{}", skintone) - - def show_emoji_preview(self, char): - emoji = emojis.get_emoji_by_char(char) -@@ -326,12 +326,7 @@ class EmojiPicker(Gtk.Window): - guide_window.connect("destroy", self.on_close_dialog) - - def open_about(self): -- logo_path = ( -- f"{config.snap_root}/static/logo.svg" -- if config.is_snap -- else "static/logo.svg" -- ) -- logo = Pixbuf.new_from_file(logo_path) -+ logo = Pixbuf.new_from_file(f"{config.static_root}/logo.svg") - - about_dialog = Gtk.AboutDialog( - transient_for=self, -diff --git a/emote/user_data.py b/emote/user_data.py -index 7095a5f..08e20a7 100644 ---- a/emote/user_data.py -+++ b/emote/user_data.py -@@ -62,9 +62,8 @@ THEMES = [ - ] - - SKINTONE = "skintone" --DEFAULT_SKINTONE = "🟨" --SKINTONES = ["🟨", "🏻", "🏼", "🏽", "🏾", "🏿"] -- -+DEFAULT_SKINTONE = "" -+SKINTONES = ["", "\U0001f3fb", "\U0001f3fc", "\U0001f3fd", "\U0001f3fe", "\U0001f3ff"] - - # Ensure the data dir exists - os.makedirs(DATA_DIR, exist_ok=True) -diff --git a/static/style.css b/static/style.css -index 7b36c1c..9ae2533 100644 ---- a/static/style.css -+++ b/static/style.css -@@ -1,3 +1,7 @@ -+#skintone_combo window { -+ font-size: 24px; -+} -+ - #category_selector_button { - font-size: 20px; - padding-top: 5px; -diff --git a/update-emojis b/update-emojis -new file mode 100755 -index 0000000..08ad8a7 ---- /dev/null -+++ b/update-emojis -@@ -0,0 +1,35 @@ -+#!/bin/sh -+ -+set -eu -+ -+export LC_ALL=en_US.UTF-8 -+ -+URL=https://raw.githubusercontent.com/hfg-gmuend/openmoji/master/data/openmoji.csv -+CSV=${0%/*}/static/emojis.csv -+TEMP=${1-} -+ -+if [ -z "$TEMP" ]; then -+ TEMP=$(mktemp) -+ curl -fL "$URL" >"$TEMP" -+fi -+ -+# Replace the emoji in columns 1 and 12 (NF - 3) by encoding the UTF-16 code -+# points in columns 2 and 13 (NF - 2) respectively. -+awk -F, -v OFS=, ' -+function get_emoji(hexcode, _a, _i, _s) { -+ split(hexcode, _a, "-") -+ for (_i in _a) { -+ _s = _s sprintf("%c", strtonum("0x" _a[_i])) -+ } -+ return _s -+} -+ -+{ -+ if (NR > 1) { -+ $1 = get_emoji($2) -+ if ($(NF - 2)) { -+ $(NF - 3) = get_emoji($(NF - 2)) -+ } -+ } -+ print -+}' "$TEMP" >"$CSV" @@ -1,10 +1,8 @@ -import os from setuptools import setup setup( name="Emote", - version=os.environ.get("EMOTE_VERSION"), packages=["emote"], setup_requires=["setuptools"], entry_points={ @@ -13,14 +11,15 @@ setup( ] }, install_requires=[ - "pygobject", - "manimpango" + "manimpango", + "setproctitle", + "dbus-python", + ], + # This is relative to the emote package + package_data={"emote": ["static/*"]}, + # Unlike these, which are relative to setup.py + data_files=[ + ("share/applications", ["static/emote.desktop"]), + ("share/icons/hicolor/scalable/apps", ["static/emote.svg"]), ], - package_data={ - "emote": [ - "static/*" - ] - }, - data_files=[("share/applications", ["snap/gui/emote.desktop"]), - ("share/icons", ["snap/gui/emote.svg"])] ) |