-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Type Numerical Action #213
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,3 +9,4 @@ rofimoji.egg-info | |
dist | ||
build | ||
src/picker/data/copyme.py | ||
venv/ |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -174,6 +174,15 @@ def __parse_arguments(only_known: bool) -> argparse.Namespace: | |
default="Alt+i", | ||
help="Choose the keyboard shortcut to copy the character's unicode codepoint to the clipboard", | ||
) | ||
parser.add_argument( | ||
"--keybinding-type-numerical", | ||
dest="keybinding_type_numerical", | ||
action="store", | ||
type=str, | ||
default="Alt+n", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you think this is used often enough to warrant a default keybinding? |
||
help="Choose the keyboard shortcut to directly type the character's unicode codepoint numerically " | ||
"with Ctrl+Shift+U<codepoint>", | ||
) | ||
|
||
if only_known: | ||
parsed_args = parser.parse_args() | ||
|
@@ -191,6 +200,7 @@ def __parse_arguments(only_known: bool) -> argparse.Namespace: | |
Action.CLIPBOARD: parsed_args.keybinding_clipboard, | ||
Action.UNICODE: parsed_args.keybinding_unicode, | ||
Action.COPY_UNICODE: parsed_args.keybinding_copy_unicode, | ||
Action.TYPE_NUMERICAL: parsed_args.keybinding_type_numerical, | ||
} | ||
|
||
return parsed_args |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
from subprocess import run | ||
|
||
from ..abstractionhelper import is_installed, is_wayland | ||
from ..action import __get_codepoints as get_codepoints | ||
from .typer import Typer | ||
|
||
|
||
|
@@ -35,3 +36,21 @@ def insert_from_clipboard(self, active_window: str) -> None: | |
"0.05", | ||
] | ||
) | ||
|
||
def type_numerical(self, characters: str, active_window: str) -> None: | ||
unicode_codepoint = get_codepoints(characters) | ||
unicode_codepoint = unicode_codepoint.split("-") | ||
for codepoint in unicode_codepoint: | ||
run( | ||
[ | ||
"xdotool", | ||
"windowfocus", | ||
"--sync", | ||
active_window, | ||
"key", | ||
"--clearmodifiers", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should probably be something like |
||
"U" + codepoint, | ||
"sleep", | ||
"0.05", | ||
] | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not as important as
copy
; I'd move it afterclipboard
.