signal-desktop-bin: update copy-noto-emoji.py and emoji sheets

(cherry picked from commit d569123194)
This commit is contained in:
Gliczy
2025-10-16 14:38:39 +02:00
committed by github-actions[bot]
parent a4b82fa04f
commit de9ce56310
2 changed files with 8 additions and 28 deletions

View File

@@ -18,24 +18,6 @@ import sys
from pathlib import Path
def signal_name_to_emoji(signal_emoji_name: str) -> str:
r"""Return the emoji corresponding to a Signal emoji name.
Signal emoji names are concatenations of UTF16 code units,
represented in lowercase bigendian hex padded to four digits.
>>> signal_name_to_emoji("d83dde36200dd83cdf2bfe0f")
'😶‍🌫️'
>>> b"\xd8\x3d\xde\x36\x20\x0d\xd8\x3c\xdf\x2b\xfe\x0f".decode("utf-16-be")
'😶‍🌫️'
"""
hex_bytes = zip(signal_emoji_name[::2], signal_emoji_name[1::2])
emoji_utf_16_be = bytes(
int("".join(hex_pair), 16) for hex_pair in hex_bytes
)
return emoji_utf_16_be.decode("utf-16-be")
def emoji_to_noto_name(emoji: str) -> str:
r"""Return the Noto emoji name of an emoji.
@@ -68,16 +50,15 @@ def _main() -> None:
for signal_emoji_names in jumbomoji_packs.values():
for signal_emoji_name in signal_emoji_names:
emoji = signal_name_to_emoji(signal_emoji_name)
try:
shutil.copy(
noto_png_path / f"emoji_u{emoji_to_noto_name(emoji)}.png",
out_path / emoji,
noto_png_path / f"emoji_u{emoji_to_noto_name(signal_emoji_name)}.png",
out_path / signal_emoji_name,
)
except FileNotFoundError:
print(
f"Missing Noto emoji: {emoji} {signal_emoji_name}",
f"Missing Noto emoji: {signal_emoji_name}",
file=sys.stderr,
)
continue

View File

@@ -92,12 +92,12 @@ let
});
noto-emoji-sheet-32 = fetchurl {
url = "https://raw.githubusercontent.com/iamcal/emoji-data/refs/tags/v15.1.2/sheet_google_32.png";
hash = "sha256-S03NCTbvB5yeQl62WpLNjNGhjNErtgaOB6tAj/X8vPc=";
url = "https://raw.githubusercontent.com/iamcal/emoji-data/refs/tags/v16.0.0/sheet_google_32.png";
hash = "sha256-tBfp9s1LvBBla7/V4TtumiVFtV5qTPcxLXW+H6qjSVI=";
};
noto-emoji-sheet-64 = fetchurl {
url = "https://raw.githubusercontent.com/iamcal/emoji-data/refs/tags/v15.1.2/sheet_google_64.png";
hash = "sha256-kZYStR5xAuausSpOD6wJZRJZ1K6nPpweE3aYSgWntS4=";
url = "https://raw.githubusercontent.com/iamcal/emoji-data/refs/tags/v16.0.0/sheet_google_64.png";
hash = "sha256-eVoMWY0WLJpKriPyGIxge4ybwZEst9hDgkWfjekaOuE=";
};
in
stdenv.mkDerivation rec {
@@ -263,8 +263,7 @@ stdenv.mkDerivation rec {
# Fix the desktop link
substituteInPlace $out/share/applications/signal-desktop.desktop \
--replace-fail "/${bindir}/signal-desktop" ${meta.mainProgram} \
--replace-fail "StartupWMClass=Signal" "StartupWMClass=signal"
--replace-fail "/${bindir}/signal-desktop" ${meta.mainProgram}
mv $out/share/applications/signal{-desktop,}.desktop