Compare commits

..

22 commits

Author SHA1 Message Date
Ivan Boothe c5d7ab5c94 update inline description with alt+enter
Signed-off-by: Ivan Boothe <git@rootwork.org>
2022-02-23 17:17:09 -08:00
Ivan Boothe e5004252ae update description on preferences pane
Signed-off-by: Ivan Boothe <git@rootwork.org>
2022-02-23 17:10:16 -08:00
Ivan Boothe 27f4af829a add link to Ulauncher extensions page
Signed-off-by: Ivan Boothe <git@rootwork.org>
2022-02-23 17:04:49 -08:00
Ivan Boothe 8a58061603 Improving demo gif
Signed-off-by: Ivan Boothe <ivan@rootwork.org>
2021-10-25 21:05:08 -07:00
Ivan Boothe 8ae84bea29 Updating demo gif
Signed-off-by: Ivan Boothe <ivan@rootwork.org>
2021-10-25 21:00:28 -07:00
Ivan Boothe 28e84f3df2 Updating readme
Signed-off-by: Ivan Boothe <ivan@rootwork.org>
2021-10-25 20:30:02 -07:00
Ivan Boothe 3e31914eae Increase minimum search score to prevent tons of false positives
Signed-off-by: Ivan Boothe <ivan@rootwork.org>
2021-10-25 20:21:13 -07:00
Ivan Boothe d225b02bc9 Hide HTML entity if it doesn't exist
Signed-off-by: Ivan Boothe <ivan@rootwork.org>
2021-10-25 20:20:55 -07:00
Ivan Boothe 2462364d46 Shorten displayed help text
Signed-off-by: Ivan Boothe <ivan@rootwork.org>
2021-10-25 20:12:10 -07:00
Ivan Boothe 6dc1345c97 Updating unicode list
Signed-off-by: Ivan Boothe <ivan@rootwork.org>
2021-10-25 19:52:39 -07:00
Ivan Boothe f00908fd86 Removing accidental double-import
Signed-off-by: Ivan Boothe <ivan@rootwork.org>
2021-10-25 19:50:56 -07:00
Ivan Boothe 6078260659 Adding alt+enter action to copy HTML entity
Signed-off-by: Ivan Boothe <ivan@rootwork.org>
2021-10-25 19:46:27 -07:00
Ivan Boothe 976055c5c7 Adding HTML entity when it exists
Signed-off-by: Ivan Boothe <ivan@rootwork.org>
2021-10-25 19:40:08 -07:00
Ivan Boothe 67bf4bce73 No more ALL CAPS
Signed-off-by: Ivan Boothe <ivan@rootwork.org>
2021-10-25 18:53:28 -07:00
Ivan Boothe b9cfacd9cd Noting dark mode friendly
Signed-off-by: Ivan Boothe <ivan@rootwork.org>
2021-10-25 18:48:57 -07:00
Ivan Boothe d3ddadd81c Adding plain white circle behind symbols to account for dark mode
Signed-off-by: Ivan Boothe <ivan@rootwork.org>
2021-10-25 18:48:18 -07:00
Ivan Boothe 805032d6dd Changing description and image
Signed-off-by: Ivan Boothe <ivan@rootwork.org>
2021-10-25 18:47:57 -07:00
Vangelis Kostalas 0ad36c00a8 Create the icon cache directory when the extension first runs. 2019-07-11 09:53:31 +03:00
Vangelis Kostalas 111bb10339 Small changes to README.rst 2019-07-05 15:38:04 +03:00
Vangelis Kostalas 09db20b256 Added a demo gif 2019-07-05 15:33:21 +03:00
Vangelis Kostalas 01953edfac Added Readme and Licence 2019-07-05 15:32:48 +03:00
Vangelis Kostalas 745185281b manifest.json for API version 2 and versions.json 2019-07-05 10:55:05 +03:00
10 changed files with 1855 additions and 55 deletions

27
README.md Normal file
View file

@ -0,0 +1,27 @@
# ulauncher-symbol
A [Ulauncher](https://ulauncher.io/) extension for searching Unicode and ASCII characters and copying them to the clipboard. Dark mode friendly.
<kbd>Enter</kbd> to copy the symbol itself.
<kbd>Alt+Enter</kbd> to copy the HTML entity (if it exists).
You can search for characters using their name or description, block names or the characters themselves.
## Demonstration
![Demonstration of ulauncher-symbol](ulauncher-symbol-demo.gif)
## Installation
Open Ulauncher, go to `Preferences > Extensions > Add extension` and paste the project's URL: `https://github.com/rootwork/ulauncher-symbol.git`
You can also view this extension on the [Ulauncher Extensions website](https://ext.ulauncher.io/-/github-rootwork-ulauncher-symbol).
## Source
Forked from [zensoup/ulauncher-unicode](https://github.com/zensoup/ulauncher-unicode) to add HTML entities, dark mode theming, fewer false positives in results, and an updated Unicode list.
## License
GPLv3. See [LICENCE](LICENCE).

View file

@ -1,36 +0,0 @@
ulauncher-unicode
-----------------
A `Ulauncher`_ extension for searching unicode characters and copying them to the clipboard.
Demo
====
.. image:: ulauncher-unicode-demo.gif
Installation
============
Open ulauncher, go to ``preferences > extensions > Add extension`` and paste the project's URL: ``https://github.com/zensoup/ulauncher-unicode``
Usage
=====
You can search for characters using their name or description, block names or the characters themselves.
The character list is automatically generated from https://www.unicode.org
Checklist
=========
☐ Add support for character combinations like skin tones, flags and combined emojis using alt+enter.
.. _Ulauncher: https://ulauncher.io/

BIN
images/insertion-symbol.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

31
main.py
View file

@ -3,6 +3,8 @@ import sys
import codecs import codecs
from os.path import join from os.path import join
import subprocess # for pip autoinstallation
from ulauncher.search.SortedList import SortedList from ulauncher.search.SortedList import SortedList
from ulauncher.api.client.Extension import Extension from ulauncher.api.client.Extension import Extension
from ulauncher.api.client.EventListener import EventListener from ulauncher.api.client.EventListener import EventListener
@ -19,11 +21,22 @@ if sys.version_info[0] >= 3:
FILE_PATH = os.path.dirname(sys.argv[0]) FILE_PATH = os.path.dirname(sys.argv[0])
ICON_TEMPLATE = """ ICON_TEMPLATE = """
<svg width="100" height="100"> <svg width="100" height="100" xmlns="http://www.w3.org/2000/svg">
<text x="50" y="50" dy=".35em" text-anchor="middle" font-family="{font}" font-size="80">{symbol}</text> <circle cx="50" cy="50" r="50" fill="white" />
<text x="50" y="50" dy=".35em" text-anchor="middle" font-family="{font}" font-size="60">{symbol}</text>
</svg> </svg>
""" """
# For pip autoinstallation
def ensure_import(package):
try:
return __import__(package)
except ImportError:
subprocess.call([sys.executable, "-m", "pip", "install", "--user", package])
return __import__(package)
# For HTML entity conversion
htmlentities = ensure_import("htmlentities")
class UnicodeChar: class UnicodeChar:
""" Container class for unicode characters """ Container class for unicode characters
@ -66,16 +79,24 @@ class KeywordQueryEventListener(EventListener):
items = [] items = []
arg = event.get_argument() arg = event.get_argument()
if arg: if arg:
result_list = SortedList(arg, min_score=40, limit=10) result_list = SortedList(arg, min_score=99, limit=10)
result_list.extend(extension.character_list) result_list.extend(extension.character_list)
for char in result_list: for char in result_list:
image_path = get_character_icon(char) image_path = get_character_icon(char)
encoded = htmlentities.encode(char.character)
if "&" in encoded:
sep = " - "
html = encoded
else:
sep = ""
html = ""
items.append( items.append(
ExtensionResultItem( ExtensionResultItem(
icon=image_path, icon=image_path,
name=char.name + " - " + char.character, name=char.name.capitalize() + " - " + char.character,
description=char.block + " - " + char.code, description=char.block + " - Alt+Enter: " + html + sep + "Code: U+" + char.code,
on_enter=CopyToClipboardAction(char.character), on_enter=CopyToClipboardAction(char.character),
on_alt_enter=CopyToClipboardAction(html),
) )
) )
return RenderResultListAction(items) return RenderResultListAction(items)

View file

@ -1,20 +1,19 @@
{ {
"api_version": "1", "name": "Symbol search",
"manifest_version": "1", "description": "Search symbols in ASCII and Unicode. Enter to copy the symbol, alt+enter to copy the HTML entity. Dark mode friendly.",
"name": "Unicode extension", "developer_name": "Ivan Boothe",
"description": "Search for Unicode characters and copy them to the clipboard.", "icon": "images/insertion-symbol.png",
"developer_name": "Vangelis Kostalas", "required_api_version": "^2.0.0",
"icon": "images/unicode.png",
"options": { "options": {
"query_debounce": 0.5 "query_debounce": 0.5
}, },
"preferences": [ "preferences": [
{ {
"id": "unicode", "id": "symbol",
"type": "keyword", "type": "keyword",
"name": "Unicode", "name": "Symbol",
"description": "Search for Unicode characters and copy them to the clipboard", "description": "Search symbols in ASCII and Unicode. Enter to copy the symbol, alt+enter to copy the HTML entity. Dark mode friendly.",
"default_value": "uni" "default_value": "sym"
} }
] ]
} }

BIN
ulauncher-symbol-demo.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 122 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 219 KiB

File diff suppressed because it is too large Load diff

4
versions.json Normal file
View file

@ -0,0 +1,4 @@
[
{ "required_api_version": "^1.0.0", "commit": "API_v1" },
{ "required_api_version": "^2.0.0", "commit": "master" }
]