arp242 / uni

Query the Unicode database from the commandline, with good support for emojis
MIT License
790 stars 19 forks source link

allow search to return all #24

Closed quite closed 3 years ago

quite commented 3 years ago

I'd prefer to use search for listing emojis, as it includes, just for example what I was missing now: '☐' U+2610 9744 e2 98 90 ☐ BALLOT BOX (Other_Symbol). emoji does not include this, because it is not deemed an emoji, not in certain emoji codepoint blocks, or so?

arp242 commented 3 years ago

The search command searches for codepoints; the emojis that are a single codepoint are returned by this, but those that consist of multiple aren't.

For example:

$ uni -q s flag
'⚐'  U+2690  9872   e2 9a 90    ⚐   WHITE FLAG (Other_Symbol)
'⚑'  U+2691  9873   e2 9a 91    ⚑   BLACK FLAG (Other_Symbol)

But the pirate flag emoji consists of multiple emojis:

$ uni e -qf '%(emoji) %(cpoint) %(name)' 'pirate flag'
🏴☠ U+1F3F4 U+200D U+2620 U+FE0F pirate flag

There is all sorts of special handling for emojis; I don't think combing them is a good idea.

As for your ballot box icon:

$ uni s ballot
     cpoint  dec    utf8        html       name (cat)
'☐'  U+2610  9744   e2 98 90    ☐   BALLOT BOX (Other_Symbol)
'☑'  U+2611  9745   e2 98 91    ☑   BALLOT BOX WITH CHECK (Other_Symbol)
'☒'  U+2612  9746   e2 98 92    ☒   BALLOT BOX WITH X (Other_Symbol)
'✗'  U+2717  10007  e2 9c 97    ✗    BALLOT X (Other_Symbol)
'✘'  U+2718  10008  e2 9c 98    ✘   HEAVY BALLOT X (Other_Symbol)
'⮽'  U+2BBD  11197  e2 ae bd    ⮽   BALLOT BOX WITH LIGHT X (Other_Symbol)
'🗳'  U+1F5F3 128499 f0 9f 97 b3 🗳  BALLOT BOX WITH BALLOT (Other_Symbol)
'🗴'  U+1F5F4 128500 f0 9f 97 b4 🗴  BALLOT SCRIPT X (Other_Symbol)
'🗵'  U+1F5F5 128501 f0 9f 97 b5 🗵  BALLOT BOX WITH SCRIPT X (Other_Symbol)
'🗶'  U+1F5F6 128502 f0 9f 97 b6 🗶  BALLOT BOLD SCRIPT X (Other_Symbol)
'🗷'  U+1F5F7 128503 f0 9f 97 b7 🗷  BALLOT BOX WITH BOLD SCRIPT X (Other_Symbol)
'🗹'  U+1F5F9 128505 f0 9f 97 b9 🗹  BALLOT BOX WITH BOLD CHECK (Other_Symbol)

That seems to work as expected, as it's a single codepoint? There is no special handling in print/search at all based on the character type, outside of formatting the control characters and combining characters. So I'm not sure what went wrong there?

quite commented 3 years ago

Sorry, I left out some information. What I really want is indeed to use uni to output all emojis, codepoints etc. Including names, so that I can pipe it all to bemenu (a dmenu for X/Wayland) and search incrementally...

quite commented 3 years ago

And yes, ballot was found by search all along :)

arp242 commented 3 years ago

I don't know; maybe it could be unified, but there's a lot of special handling involved, and there are probably a few UX issues that will crop up.

Considering that this is a tool I wrote for my own purposes and that overall I'm pretty happy with it as a user, the chance that I will work on this is very close to zero. I'm always happy to accommodate people's use cases, but there's a limit to the amount of work I'm willing to spend on that. Just want to be clear about expectations here 😅

I might consider merging patches, but that will depend a bit on whether I like the UI. Considering it would be a significant rewrite this actually might be better off as a fork (the amount of work is the same).

As a workaround, you can create a simple wrapper script which calls uni and pipe the output of that to bemenu.

quite commented 3 years ago

I realized that I can do something like that, yes. Combining output of uni -q emoji all and uni -q print all. Sry for taking your time.