Skip to main content

Look up emojis by text and copy them to the clipboard.

Project description

Pybites Emoji Searcher

I have been googling emojis and manually copying them to my clipboard.

Except for Slack + GitHub, there the : + autocomplete works great. For other tools, for example Facebook or plain blog / email writing, I needed a better way.

So here is a tool to look up emojis by text from the command line and automatically copy matching ones to the clipboard (using the awesome pyperclip tool).

By default it takes the first match in case there are multiple matching emojis. However if you append a dot (.) to a word you get to choose which emoji gets copied. You can also use a .preferences file to store overriding emojis or ones this tool does not provide.

I hope you enjoy this tool and don't hesitate to reach out to me by email: bob@pybit.es or just open an issue / open a PR if you see any opportunity for improvements.

How to install and run it

$ git clone git@github.com:bbelderbos/emojisearcher.git
$ cd emojisearcher
$ python3.10 -m venv venv
$ source venv/bin/activate
(venv) $ pip install -r requirements.txt

# or in one command
$ make setup

# search from cli
(venv) $ python -m emojisearcher.script bicep
Copied ๐Ÿ’ช to clipboard

(venv) $ python -m emojisearcher.script snake
Copied ๐Ÿ to clipboard

(venv) $ python -m emojisearcher.script tada
Copied ๐ŸŽ‰ to clipboard

# search interactively (specially useful if there are multiple matches, you can choose)

(venv) $ python -m emojisearcher.script


------------------------------------------------------------------------------------
Type one or more emoji related words ...
End a word with a . if you want to select an emoji if there are multiple
matches, otherwise the first match will be picked. Type 'q' to exit.
> snake
Copied ๐Ÿ to clipboard

------------------------------------------------------------------------------------
Type one or more emoji related words ...
End a word with a . if you want to select an emoji if there are multiple
matches, otherwise the first match will be picked. Type 'q' to exit.
> grin
Copied ๐Ÿ˜บ to clipboard

------------------------------------------------------------------------------------
Type one or more emoji related words ...
End a word with a . if you want to select an emoji if there are multiple
matches, otherwise the first match will be picked. Type 'q' to exit.
> grin.
1 ๐Ÿ˜บ
2 ๐Ÿ˜ธ
3 ๐Ÿ˜€
4 ๐Ÿ˜ƒ
5 ๐Ÿ˜„
6 ๐Ÿ˜…
7 ๐Ÿ˜†
8 ๐Ÿ˜€
9 ๐Ÿ˜
Select the number of the emoji you want: 4
Copied ๐Ÿ˜ƒ to clipboard

------------------------------------------------------------------------------------
Type one or more emoji related words ...
End a word with a . if you want to select an emoji if there are multiple
matches, otherwise the first match will be picked. Type 'q' to exit.
> q
Bye

Ease of use: make a shell alias

Using a shell alias can be really convenient for this (assuming you have the project cloned in ~/code):

# .zshrc
function emo {
    # subshell so you don't stay in the virtual env after running it
    (cd $HOME/code/emojisearcher && source venv/bin/activate && python -m emojisearcher.script "$@")
}

$ source ~/.zshrc
$ emo snake
Copied ๐Ÿ to clipboard

# or get multiple emojis at once
$ emo snake bicep tada heart fire
Copied ๐Ÿ ๐Ÿ’ช ๐ŸŽ‰ ๐Ÿ’“ ๐Ÿ”ฅ to clipboard

After sourcing your .zshrc you can now get emojis copied to your clipboard fast using emo bicep, emo tada etc.

Preferred emojis

This section uses the shell alias I created in the previous step.

Sometimes you don't get a match:

$ emo ninja
No matches for ninja

Or you get way too many:

$ emo heart.
1 ๐Ÿ’“
2 ๐Ÿ–ค
...
...
35 ๐Ÿ˜ป
36 ๐Ÿ˜
Select the number of the emoji you want: 36
Copied ๐Ÿ˜ to clipboard

And some don't work (not sure why yet ...):

$ emo question
Copied  to clipboard

Since 0.6.0 you can create a .preferences file to create a mapping of missing / preferred emojis which will take precedence.

You can create this file in the root folder of the project or use the EMOJI_PREFERENCES environment variable to store it somewhere else:

$ export EMOJI_PREFERENCES=/Users/bbelderbos/.emoji_preferences

Let's look at this in action. Normally the tool would work like this:

$ emo heart
Copied ๐Ÿ’“ to clipboard
$ emo cool
Copied ๐Ÿ†’ to clipboard

Say you added a preferences file like this:

$ cat .preferences
ninja:๐Ÿฅท  # missing (and much needed)
# overrides
eyes:๐Ÿ˜  # replaces default ๐Ÿ˜
heart:โค๏ธ   # replaces default ๐Ÿ’“
hearts:๐Ÿ’•  # replaces default ๐Ÿ’ž
# easier to remember
idea:๐Ÿ’ก  # also matches "bulb"
# trying to fix non-matching emojis
bliksem:โšก๏ธ  # this is Dutch
faster:๐Ÿƒ

Note that you can use (inline) comments.

Now with the preferences in place your shiny new emojis kick in first ๐ŸŽ‰

$ emo heart
Copied โค๏ธ to clipboard

(no more ๐Ÿ’“)

$ emo cool
Copied ๐Ÿ˜Ž to clipboard

(no more ๐Ÿ†’)

Enjoy!

Running the tests and other tools

(venv) $ pytest
# or
(venv) $ make cov

# run flake8 and mypy
(venv) $ make lint
(venv) $ make typing

Rich

Originally Around 0.0.5 we started using rich to retrieve a list of emojis, it seems a bit more accurate (e.g. our beloved tada ๐ŸŽ‰ emoji was missing!)

OS alternatives

While sharing this On Twitter I learned about other ways to get emojis (thanks Matt Harrison):

  • Windows: Windows logo key + . (period)

  • Mac: CTRL + CMD + Space

Trying this on Mac, this does require the mouse though and it does not copy the emoji to your clipboard.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

emojisearcher-0.6.0.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

emojisearcher-0.6.0-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file emojisearcher-0.6.0.tar.gz.

File metadata

  • Download URL: emojisearcher-0.6.0.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.15

File hashes

Hashes for emojisearcher-0.6.0.tar.gz
Algorithm Hash digest
SHA256 03f4f2027c7fac6e3c3ddd17c342149c0570256cc65798690ec39d3f690a1bb1
MD5 844da966a5bdc94d81f48a9c159fb052
BLAKE2b-256 b7858e94a4445c68f377a456bc48de46794eab0dc073750ac2888e1d28e78ffc

See more details on using hashes here.

File details

Details for the file emojisearcher-0.6.0-py3-none-any.whl.

File metadata

File hashes

Hashes for emojisearcher-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c8dce87da9ae80f9b0da89b4f3af138ba1c9943146454f2fcdf469ad0855581f
MD5 ac2d82b0410774a8c78b0f649e3dd5ef
BLAKE2b-256 8451c89866fe36f28ceedb3b028100a2309ca0131eebdec17abfcf0e7ef81a6e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page