jogleasonjr / splatmoji

Quickly look up and input emoji and/or emoticons/kaomoji on your GNU/Linux desktop via pop-up menu.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Splatmoji

Quickly look up and input emoji and/or emoticons/kaomoji on your GNU/Linux desktop via pop-up menu (uses rofi, a la dmenu).

(ノ・∀・)ノ 😃

Install

Requirements:

  • Bash
  • rofi
  • xdotool (for typing your selection in for you)
  • xsel (for putting your selection into the clipboard) (xclipboard also works)
# sudo apt-get install rofi xdotool xsel || sudo yum install rofi xdotool xsel
git clone https://github.com/cspeterson/splatmoji.git

Usage

# Call with default emoji and emoticon data files, copy result to clipboard
./splatmoji copy

# Call with default emoji and emoticon data files, type out result
./splatmoji type

# Call with a specific custom data file, copy result to clipboard
./splatmoji copy /path/to/data/file1 /path/to/data/file2

You probably would want to bind this to some key combination in your window manager/desktop enviroment.

i3wm

i3wm is my preferred window manager.

# This would go into your .config/i3/config to bind to Super+slash
bindsym $mod+slash exec "/path/to/the/script type"

Gnome

This Gnome.org help page seems to outline how to do this in the popular Gnome desktop environment.

Configuration

Configuration options can be changed in <project_dir>splatmoji.config or by overriding the in-project config file with ${HOME}/.config/splatmoji/splatmoji.config.

Example config:

# These are the 3 commands you will need for everything to work
# you can modify these commands as shown below in the respective subsections
xsel_command=xsel
xdotool_command=xdotool type
rofi_command=rofi -dmenu -p : -i -monitor -2

Xsel config (copying to clipboard)

You can alter the arguments sent to xsel to change, say, which "selection" your text goes into. By default it will go to the "CLIPBOARD" selection, which is the one you would usually get when doing Ctrl+c/v.

For further options, check the xsel manpage.

# You can also use xclipboard, or (likely) any other clipping tool that you can pipe an echo into to cause selection
# xclipboard example
xsel_command=xclip -selection clipboard

Xdotool config (auto-typing)

You can alter the arguments send to xdotool for typing out your selection, if for instance you need to adjust the timing delays to work more smoothly on your machine.

For options, check the xdotool manpage.

# Example from above
xdotool_command=xdotool type

Rofi config (the pop-up menu)

Examples:

# These default arguments will pop up the menu over the currently active window
rofi_command=rofi -dmenu -p : -i -monitor -2
# Alternatively, it could pop up in the middle of the current monitor with the prompt 'Search:'
rofi_command=rofi -dmenu -p 'Search:' -i -monitor -1
# Or you could specify a theme
rofi_command=rofi -dmenu -p : -i -monitor -2 -theme /path/to/themefile

For many other options, see the rofi manpage.

Updating emoji/emoticons

Most simply, pull from this repo:

cd <install dir>
git pull

You can also update the emoji/emoticon sets from the same source manually if you find that this repo is not keeping up fast enough for you:

#how to pull the sets from the remote files and transform to tsv (requires jq)
curl 'https://raw.githubusercontent.com/muan/emojilib/master/emojis.json' | importers/emojilib2tsv - > data/emoji.tsv
curl 'https://raw.githubusercontent.com/w33ble/emoticon-data/master/emoticons.json' | importers/w33ble2tsv - > data/emoticons.tsv

Custom Configuration and Custom Emoji/Emoticons

This repo uses emoji.json from muan/emojilib for emoji and emoticons.json from w33ble/emoticon-data, but you can use your own files for sure if you find these sets lacking.

The emoji/emoticons should be stored in tsv like so:

emoji<tab>name<tab>keywords etc

And then you can call the utlity with your preferred data files as per Usage above.

Please let me know what better source you wind up using, and maybe the command(s) you use to convert it into the above format, and I'll probably work it into the repo. 🙂

FAQ

  • Why do some of the emoji come out as multiple characters?
  • These are called ZWJ (zero-width joiner) Sequences. Some combinations of multiple different emoji can be combined in sequence with a special zero-width character as a joiner, and if the platform supports it a single meaningful symbol will be displayed. On platforms that don't support it though, no worries: it just displays the seperate emoji in sequence. 🙂

Contributing

Taking pull requests here.

Credits

By Christopher Peterson (@cspete)

License

The MIT License (MIT). Please see LICENSE for more information.

About

Quickly look up and input emoji and/or emoticons/kaomoji on your GNU/Linux desktop via pop-up menu.

License:MIT License


Languages

Language:Shell 100.0%