diff --git a/README.md b/README.md
index 616ae52..0073eab 100644
--- a/README.md
+++ b/README.md
@@ -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.
Please note that you need to specify it as `--selector-args=""` or `--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
@@ -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.
@@ -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
diff --git a/src/picker/argument_parsing.py b/src/picker/argument_parsing.py
index f1d84f8..c572aec 100644
--- a/src/picker/argument_parsing.py
+++ b/src/picker/argument_parsing.py
@@ -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",
)
diff --git a/src/picker/docs/rofimoji.1.md b/src/picker/docs/rofimoji.1.md
index 2b5f237..73237f4 100644
--- a/src/picker/docs/rofimoji.1.md
+++ b/src/picker/docs/rofimoji.1.md
@@ -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.
diff --git a/src/picker/typer/typer.py b/src/picker/typer/typer.py
index cd5dd0a..f66b1bc 100644
--- a/src/picker/typer/typer.py
+++ b/src/picker/typer/typer.py
@@ -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)()
diff --git a/src/picker/typer/wl_ime_type.py b/src/picker/typer/wl_ime_type.py
new file mode 100644
index 0000000..af762eb
--- /dev/null
+++ b/src/picker/typer/wl_ime_type.py
@@ -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"