Add an Emoji Picker as a launcher mode with a searchable grid
The launcher gains an emoji mode like Clipboard History: >emoji switches in place without closing or animating, and glassmxrph emoji toggles it. Emoji show as a grid instead of named rows; the selected or hovered emoji's name is the section label. Search requires every term and ranks name matches before keyword matches; Enter copies with wl-copy. assets/emoji.tsv comes from Unicode 17 emoji-test.txt without skin-tone variants, with keywords from the rofi emopicker list (scripts/emoji-data). The test driver caps snapshot results, since IPC replies have a size limit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
29dd64572a
commit
b3076a4cde
13 files changed
+2220
-29
No files matched your search
Executable
+34
@@ -0,0 +1,34 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Regenerates quickshell/assets/emoji.tsv for the launcher's Emoji Picker.
|
||||
Usage: scripts/emoji-data EMOJI_TEST_TXT [KEYWORDS] > quickshell/assets/emoji.tsv
|
||||
EMOJI_TEST_TXT is Unicode's emoji-test.txt (nixpkgs#unicode-emoji). KEYWORDS is an
|
||||
optional "<emoji> <name and keywords>" list such as the rofi emopicker's ~/.config/.emoji.
|
||||
Output: emoji, name, search keywords; tab-separated, in Unicode order, skin tones omitted."""
|
||||
import re
|
||||
import sys
|
||||
|
||||
LINE = re.compile(r'^([0-9A-F ]+?)\s*; fully-qualified\s*# (\S+) E[\d.]+ (.+)$')
|
||||
TONES = {0x1F3FB, 0x1F3FC, 0x1F3FD, 0x1F3FE, 0x1F3FF}
|
||||
|
||||
extra = {}
|
||||
if len(sys.argv) > 2:
|
||||
for line in open(sys.argv[2], encoding='utf-8'):
|
||||
emoji, _, words = line.strip().partition(' ')
|
||||
extra[emoji.replace('️', '')] = words.lower().split()
|
||||
|
||||
subgroup = ''
|
||||
for line in open(sys.argv[1], encoding='utf-8'):
|
||||
if line.startswith('# subgroup:'):
|
||||
subgroup = line.split(':', 1)[1].strip()
|
||||
continue
|
||||
match = LINE.match(line.strip())
|
||||
if not match or TONES & {int(c, 16) for c in match[1].split()}:
|
||||
continue
|
||||
emoji, name = match[2], match[3].replace('\t', ' ')
|
||||
seen = set(re.split(r'[\s:,]+', name.lower()))
|
||||
words = []
|
||||
for word in extra.get(emoji.replace('️', ''), []) + subgroup.split('-'):
|
||||
if word not in seen:
|
||||
seen.add(word)
|
||||
words.append(word)
|
||||
print(f'{emoji}\t{name}\t{" ".join(words)}')
|
||||
Reference in new issue
Block a user