diff --git a/MANIFEST.in b/MANIFEST.in index 643d3c2c9..071905c1f 100755 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,2 +1,2 @@ -include LICENSE README.md emoji-keyboard.desktop +include LICENSE README.md recursive-include lib/data * diff --git a/README.md b/README.md index 58dbfd8a5..e5ad3c642 100755 --- a/README.md +++ b/README.md @@ -2,7 +2,8 @@ Virtual keyboard-like emoji picker for linux. -This project uses artwork and data from the excellent [EmojiOne project](http://emojione.com/). +This project uses artwork and data from the excellent +[EmojiOne project](http://emojione.com/). ## Installation @@ -11,27 +12,50 @@ This project uses artwork and data from the excellent [EmojiOne project](http:// You'll need Python 3 GObject bindings and python3-xlib package. If you're on a debian based distro you can install them with -`sudo apt install python3-gi gir1.2-gtk-3.0 gir1.2-glib-2.0 gir1.2-appindicator3-0.1 python3-xlib` +`sudo apt install python3-gi gir1.2-gtk-3.0 gir1.2-glib-2.0 +gir1.2-appindicator3-0.1 python3-xlib` ### App There are several ways to install the app, you can install from deb you can -find on [releases page](https://github.com/OzymandiasTheGreat/emoji-keyboard/releases). +find on +[releases page](https://github.com/OzymandiasTheGreat/emoji-keyboard/releases). You can install with pip -`sudo pip3 install https://github.com/OzymandiasTheGreat/emoji-keyboard/archive/master.zip` +`sudo pip3 install +https://github.com/OzymandiasTheGreat/emoji-keyboard/archive/master.zip` -Or you can download the tarball, extract and run +There's also ppa, courtesy of [atareao](https://github.com/atareao) +Note that this ppa is NOT maintained by me, so I can't guarantee latest versions. -`sudo setup.py install` +`sudo add-apt-repository ppa:atareao/atareao` + +`sudo apt update` + +`sudo apt install emoji-keyboard` ## Usage +### Keyboard + Selecting `Show Keyboard` from the app indicator menu or, if your desktop environment supports it, middle-clicking app indicator will toggle the visibility -of the picker. When the picker is visible simply clicking on emoji will type it +of the keyboard. When the picker is visible simply clicking on emoji will type it into focused application. -If you want to toggle the visibility of the picker with a hotkey, use your -desktop environment's native hotkey utility to assign a hotkey to `emoji-keyboard`. +### Search + +You can search by oficial unicode name or by :shortname:. +Pressing `enter` will select and type the first result. + +### Hotkeys + +`emoji-keyboard` can be controlled from the command line. Use your desktop's +native hotkey utility to assign hotkeys to + +`emoji-keyboard -k` to toggle visibility of the keyboard, + +`emoji-keyboard -s` to toggle visibility of the search window. + +Run `emoji-keyboard -h` in the terminal to get full list of commands. diff --git a/lib/emoji_gtk.py b/lib/emoji_gtk.py index 3f7e09a48..af21749e6 100755 --- a/lib/emoji_gtk.py +++ b/lib/emoji_gtk.py @@ -232,6 +232,20 @@ def sort_full(self, model, a_iter, b_iter, udata_key): else: return 0 + def full_highlighter(self, completion, renderer, model, tree_iter, udata): + + keys = completion.get_entry().get_text() + string = model[tree_iter][4] + for key in keys.split(): + string = string.replace(key, '{0}'.format(key)) + renderer.props.markup = string + + def short_highlighter(self, completion, renderer, model, tree_iter, udata): + + key = completion.get_entry().get_text() + string = model[tree_iter][1].replace(key, '{0}'.format(key)) + renderer.props.markup = string + class Keyboard(Gtk.Window): @@ -359,7 +373,10 @@ def __init__(self): full_pixbuf_cell = Gtk.CellRendererPixbuf() self.full_completer.pack_start(full_pixbuf_cell, False) self.full_completer.add_attribute(full_pixbuf_cell, 'pixbuf', 0) - self.full_completer.set_text_column(4) + full_text_cell = Gtk.CellRendererText() + self.full_completer.pack_start(full_text_cell, True) + self.full_completer.set_cell_data_func( + full_text_cell, shared.emoji.full_highlighter, None) self.full_completer.set_match_func(shared.emoji.match_full, None) self.short_completer = Gtk.EntryCompletion() @@ -367,7 +384,10 @@ def __init__(self): short_pixbuf_cell = Gtk.CellRendererPixbuf() self.short_completer.pack_start(short_pixbuf_cell, False) self.short_completer.add_attribute(short_pixbuf_cell, 'pixbuf', 0) - self.short_completer.set_text_column(1) + short_text_cell = Gtk.CellRendererText() + self.short_completer.pack_start(short_text_cell, True) + self.short_completer.set_cell_data_func( + short_text_cell, shared.emoji.short_highlighter, None) self.short_completer.set_match_func(shared.emoji.match_short, None) self.entry.connect('changed', self.set_model) diff --git a/setup.py b/setup.py index e1f5f4c82..be4572cbb 100755 --- a/setup.py +++ b/setup.py @@ -3,9 +3,9 @@ import os from setuptools import setup -src_dir = os.path.abspath(os.path.dirname(__file__)) -with open(os.path.join(src_dir, 'README.md')) as readme: - long_description = readme.read() +src_dir = os.path.dirname(__file__) +with open(os.path.join(src_dir, 'README.md')) as fd: + long_description = fd.read() classifiers = [ 'Development Status :: 5 - Production/Stable', @@ -18,22 +18,15 @@ 'Programming Language :: Python :: 3 :: Only', 'Topic :: Utilities'] -data_files = [ - ('share/applications', [ - 'emoji-keyboard.desktop'])] +data_files = [('share/applications', ['lib/data/emoji-keyboard.desktop'])] if os.geteuid() == 0: - data_files.append(('/etc/xdg/autostart', [ - 'emoji-keyboard.desktop'])) -#~ else: - #~ data_files.append((os.path.expanduser('~/.config/autostart'), [ - #~ 'emoji-keyboard.desktop'])) -# The above bit should set app to autostart on user installs but absolute path -# is treated like relative with --user option + data_files.append( + ('/etc/xdg/autostart', ['lib/data/emoji-keyboard.desktop'])) setup( name='emoji-keyboard', - version='1.0.0', + version='2.0.0', description='Virtual keyboard-like emoji picker', long_description=long_description, url='https://github.com/OzymandiasTheGreat/emoji-keyboard', @@ -44,9 +37,11 @@ package_dir={'emoji_keyboard': 'lib'}, packages=['emoji_keyboard'], package_data={'emoji_keyboard': [ - 'data/*.json', 'data/png/*.png', 'data/category_icons/*.png']}, + 'data/*.json', + 'data/svg/*.svg', + 'data/category_icons/*.svg', + 'data/emoji-keyboard.desktop']}, data_files=data_files, scripts=['emoji-keyboard'], - # Causes unsatisfiable dependencies in the deb - # install_requires=['python3-xlib'], + install_requires=['python3-xlib'] ) diff --git a/stdeb.cfg b/stdeb.cfg index ec258ec6e..f6998969a 100755 --- a/stdeb.cfg +++ b/stdeb.cfg @@ -1,5 +1,5 @@ [DEFAULT] -Suite: trusty +Suite: yakkety Debian-Version: 1 Depends3: python3-gi,gir1.2-gtk-3.0,gir1.2-glib-2.0,gir1.2-appindicator3-0.1,python3-xlib Copyright-File: copyright