Compare commits
22 commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
c5d7ab5c94 | ||
![]() |
e5004252ae | ||
![]() |
27f4af829a | ||
![]() |
8a58061603 | ||
![]() |
8ae84bea29 | ||
![]() |
28e84f3df2 | ||
![]() |
3e31914eae | ||
![]() |
d225b02bc9 | ||
![]() |
2462364d46 | ||
![]() |
6dc1345c97 | ||
![]() |
f00908fd86 | ||
![]() |
6078260659 | ||
![]() |
976055c5c7 | ||
![]() |
67bf4bce73 | ||
![]() |
b9cfacd9cd | ||
![]() |
d3ddadd81c | ||
![]() |
805032d6dd | ||
![]() |
0ad36c00a8 | ||
![]() |
111bb10339 | ||
![]() |
09db20b256 | ||
![]() |
01953edfac | ||
![]() |
745185281b |
27
README.md
Normal file
27
README.md
Normal 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
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
## 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).
|
36
README.rst
36
README.rst
|
@ -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
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
31
main.py
|
@ -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)
|
||||||
|
|
|
@ -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
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 |
1793
unicode_list.txt
1793
unicode_list.txt
File diff suppressed because it is too large
Load diff
4
versions.json
Normal file
4
versions.json
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
[
|
||||||
|
{ "required_api_version": "^1.0.0", "commit": "API_v1" },
|
||||||
|
{ "required_api_version": "^2.0.0", "commit": "master" }
|
||||||
|
]
|
Loading…
Reference in a new issue