Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ You can configure `rofimoji` either with cli arguments or with a config file cal
| `--selector-args` | | | | Define arguments that `rofimoji` will pass through to the selector.<br/>Please note that you need to specify it as `--selector-args="<selector-args>"` or `--selector-args " <selector-args>"` because of a [bug in argparse](https://bugs.python.org/issue9334) |
| `--selector` | | `rofi`, `wofi`, `fuzzel`, `dmenu`, `tofi`, `bemenu`, `wmenu`, `choose` | (automatically chosen) | Show the selection dialog with this application. |
| `--clipboarder` | | `xsel`, `xclip`, `wl-copy`, `pbcopy` | (automatically chosen) | Access the clipboard with this application. |
| `--typer` | | `xdotool`, `wtype`, `ydotool`, `cliclick` | (automatically chosen) | Type the characters using this application. |
| `--typer` | | `xdotool`, `wtype`, `ydotool`, `cliclick`, `wl-ime-type` | (automatically chosen) | Type the characters using this application. |
| `--keybinding-copy`, `--keybinding-type`, `--keybinding-clipboard`, `--keybinding-type-numerical`, `--keybinding-unicode`, `--keybinding-copy-unicode` | | | `Alt+c`, `Alt+t`, `Alt+p`, `Alt+n`, `Alt+u`, `Alt+i` | Choose different keybindings than the default values. |

## Example config file
Expand All @@ -95,7 +95,7 @@ The options are:
| `print` | | Print the chosen characters to `stdout`. |

## Insertion method
By default, `rofimoji` types the characters using either `xdotool`, `wtype` or `ydotool` (see [display server support](#display-server-support)). You can enforce this behavior with `--action type` (`-a type`).
By default, `rofimoji` types the characters using either `xdotool`, `wtype`, `ydotool`, or `wl-ime-type` (see [display server support](#display-server-support)). You can enforce this behavior with `--action type` (`-a type`).

For some applications (f.e. Firefox), this does not work reliably. To work around this, `rofimoji` can copy the emojis to your clipboard and insert them from there with `shift+insert`. Afterwards, it will restore the previous contents.
Unfortunately, it depends on the receiving application whether `shift+insert` uses the clipboard or the primary selection.
Expand Down Expand Up @@ -162,7 +162,7 @@ This also installs the python dependency `configargparse`.
What else do you need:
- Python 3.8 or higher
- A font that can display your scripts, (for emojis, [EmojiOne](https://github.com/emojione/emojione) or [Noto Emoji](https://www.google.com/get/noto/) work)
- Optionally, a tool to programmatically type characters into applications. Either `xdotool` for X11 or `wtype`/`ydotool` for Wayland
- Optionally, a tool to programmatically type characters into applications. Either `xdotool` for X11 or `wtype`/`ydotool`/`wl-ime-type` for Wayland
- Optionally, a tool to copy the characters to the clipboard. `xsel` and `xclip` work on X11; `wl-copy` on Wayland

### MacOS support
Expand Down
2 changes: 1 addition & 1 deletion src/picker/argument_parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def __parse_arguments(only_known: bool) -> argparse.Namespace:
dest="typer",
action="store",
type=str,
choices=["xdotool", "wtype", "ydotool", "cliclick"],
choices=["xdotool", "wtype", "ydotool", "cliclick", "wl-ime-type"],
default=None,
help="Choose the application to type with",
)
Expand Down
2 changes: 1 addition & 1 deletion src/picker/docs/rofimoji.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ Select, insert, or copy Unicode characters like emoji using rofi.

\--typer _TYPER_

: Possible values: xdotool, wtype, ydotool, cliclick
: Possible values: xdotool, wtype, ydotool, cliclick, wl-ime-type

Choose the application to type with manually.

Expand Down
3 changes: 2 additions & 1 deletion src/picker/typer/typer.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ class Typer(ABC):
def best_option(name: Optional[str] = None) -> "Typer":
from .cliclick import CliclickTyper
from .noop import NoopTyper
from .wl_ime_type import WlImeTypeTyper
from .wtype import WTypeTyper
from .xdotool import XDoToolTyper
from .ydotool import YdotoolTyper as YDoToolTyper

available_typers = [XDoToolTyper, WTypeTyper, YDoToolTyper, CliclickTyper, NoopTyper]
available_typers = [XDoToolTyper, WTypeTyper, YDoToolTyper, CliclickTyper, WlImeTypeTyper, NoopTyper]

if name is not None:
return next(typer for typer in available_typers if typer.name() == name)()
Expand Down
27 changes: 27 additions & 0 deletions src/picker/typer/wl_ime_type.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
from subprocess import run
from typing import List

from ..abstractionhelper import is_installed, is_wayland
from .typer import Typer


class WlImeTypeTyper(Typer):
@staticmethod
def supported() -> bool:
return is_wayland() and is_installed("wl-ime-type")

@staticmethod
def name() -> str:
return "wl-ime-type"

def get_active_window(self) -> str:
return "not possible with wl-ime-type"

def type_characters(self, characters: str, active_window: str) -> None:
run(["wl-ime-type", characters])

def insert_from_clipboard(self, active_window: str) -> None:
return "not possible with wl-ime-type"

def type_numerical(self, codepoints: List[int], active_window: str) -> None:
return "not possible with wl-ime-type"