Skip to content

Commit

Permalink
- Fixed setup to work with new version
Browse files Browse the repository at this point in the history
- Updated README.md
- Added highlighting for search results
  • Loading branch information
Tomas Ravinskas committed Apr 20, 2017
1 parent c24dc2a commit 53926ad
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 30 deletions.
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
include LICENSE README.md emoji-keyboard.desktop
include LICENSE README.md
recursive-include lib/data *
42 changes: 33 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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.
24 changes: 22 additions & 2 deletions lib/emoji_gtk.py
Original file line number Diff line number Diff line change
Expand Up @@ -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, '<b>{0}</b>'.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, '<b>{0}</b>'.format(key))
renderer.props.markup = string


class Keyboard(Gtk.Window):

Expand Down Expand Up @@ -359,15 +373,21 @@ 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()
self.short_completer.set_model(shared.emoji.sorted_short)
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)
Expand Down
29 changes: 12 additions & 17 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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',
Expand All @@ -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']
)
2 changes: 1 addition & 1 deletion stdeb.cfg
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 53926ad

Please sign in to comment.