Compare commits
5 commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
3903daa398 | ||
![]() |
6d652063ee | ||
![]() |
bd4ebd1dde | ||
![]() |
cc079f0afc | ||
![]() |
04d0191e86 |
27
README.md
27
README.md
|
@ -1,27 +0,0 @@
|
||||||
# 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
Normal file
36
README.rst
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
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/
|
Binary file not shown.
Before Width: | Height: | Size: 1 KiB |
BIN
images/unicode.png
Normal file
BIN
images/unicode.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.9 KiB |
31
main.py
31
main.py
|
@ -3,8 +3,6 @@ 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
|
||||||
|
@ -21,22 +19,11 @@ 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" xmlns="http://www.w3.org/2000/svg">
|
<svg width="100" height="100">
|
||||||
<circle cx="50" cy="50" r="50" fill="white" />
|
<text x="50" y="50" dy=".35em" text-anchor="middle" font-family="{font}" font-size="80">{symbol}</text>
|
||||||
<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
|
||||||
|
@ -79,24 +66,16 @@ class KeywordQueryEventListener(EventListener):
|
||||||
items = []
|
items = []
|
||||||
arg = event.get_argument()
|
arg = event.get_argument()
|
||||||
if arg:
|
if arg:
|
||||||
result_list = SortedList(arg, min_score=99, limit=10)
|
result_list = SortedList(arg, min_score=40, 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.capitalize() + " - " + char.character,
|
name=char.name + " - " + char.character,
|
||||||
description=char.block + " - Alt+Enter: " + html + sep + "Code: U+" + char.code,
|
description=char.block + " - " + char.code,
|
||||||
on_enter=CopyToClipboardAction(char.character),
|
on_enter=CopyToClipboardAction(char.character),
|
||||||
on_alt_enter=CopyToClipboardAction(html),
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
return RenderResultListAction(items)
|
return RenderResultListAction(items)
|
||||||
|
|
|
@ -1,19 +1,20 @@
|
||||||
{
|
{
|
||||||
"name": "Symbol search",
|
"api_version": "1",
|
||||||
"description": "Search symbols in ASCII and Unicode. Enter to copy the symbol, alt+enter to copy the HTML entity. Dark mode friendly.",
|
"manifest_version": "1",
|
||||||
"developer_name": "Ivan Boothe",
|
"name": "Unicode extension",
|
||||||
"icon": "images/insertion-symbol.png",
|
"description": "Search for Unicode characters and copy them to the clipboard.",
|
||||||
"required_api_version": "^2.0.0",
|
"developer_name": "Vangelis Kostalas",
|
||||||
|
"icon": "images/unicode.png",
|
||||||
"options": {
|
"options": {
|
||||||
"query_debounce": 0.5
|
"query_debounce": 0.5
|
||||||
},
|
},
|
||||||
"preferences": [
|
"preferences": [
|
||||||
{
|
{
|
||||||
"id": "symbol",
|
"id": "unicode",
|
||||||
"type": "keyword",
|
"type": "keyword",
|
||||||
"name": "Symbol",
|
"name": "Unicode",
|
||||||
"description": "Search symbols in ASCII and Unicode. Enter to copy the symbol, alt+enter to copy the HTML entity. Dark mode friendly.",
|
"description": "Search for Unicode characters and copy them to the clipboard",
|
||||||
"default_value": "sym"
|
"default_value": "uni"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 122 KiB |
BIN
ulauncher-unicode-demo.gif
Normal file
BIN
ulauncher-unicode-demo.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 219 KiB |
1793
unicode_list.txt
1793
unicode_list.txt
File diff suppressed because it is too large
Load diff
|
@ -1,4 +0,0 @@
|
||||||
[
|
|
||||||
{ "required_api_version": "^1.0.0", "commit": "API_v1" },
|
|
||||||
{ "required_api_version": "^2.0.0", "commit": "master" }
|
|
||||||
]
|
|
Loading…
Reference in a new issue