fdw / rofimoji

Emoji, unicode and general character picker for rofi and rofi-likes
https://github.com/fdw/rofimoji
MIT License
847 stars 48 forks source link

rofimoji insists on having a typer, even with `-a copy` or `-a print` #158

Closed vain closed 1 year ago

vain commented 1 year ago

With my current experimental Wayland setup, I don't have a typer available. I noticed that rofimoji doesn't like this situation, even when it doesn't actually require a typer.

For example:

$ rofimoji -a print
Traceback (most recent call last):
  File "/usr/bin/rofimoji", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/usr/lib/python3.11/site-packages/picker/__main__.py", line 9, in main
    StandaloneRofimoji().standalone()
    ^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/picker/standalone.py", line 22, in __init__
    self.active_window = self.typer.get_active_window()
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/picker/typer/typer.py", line 26, in get_active_window
    raise NoTyperFoundException()
picker.typer.typer.NoTyperFoundException: Could not find a valid way to type characters.
Please check the required dependencies.

Explicitly specifying a typer, even though it's not installed and never used, can be used as a workaround:

$ command -v wtype
$ rofimoji --typer wtype -a print
👍

Bug or working as intended? :)

Thanks!

fdw commented 1 year ago

wtype is a good choice for this, as it doesn't do anything in the early call (however, it's required for xtype).

I hadn't imagined someone using rofimoji purely for copying (or for typing, at that). Maybe it should use a NoneTyper as a fallback that will only error out when actually used? Is that reasonable?

vain commented 1 year ago

I hadn't imagined someone using rofimoji purely for copying

I found -a copy to be the most reliable way (at least on X11, not sure about Wayland yet). Anything else had subtle bugs. (I hardly remember what they were. Here are my most recent notes on that matter. Maybe long fixed. At the end of the day, -a copy is very explicit and simple, and I know that the clipboard gets overwritten, so I can act accordingly.)

Maybe it should use a NoneTyper as a fallback that will only error out when actually used? Is that reasonable?

Sounds good to me. 👍

Thanks!

fdw commented 1 year ago

I've found a much nicer fix. Feel free to try it out 🙂

vain commented 1 year ago

Works just as well. 👍 Thanks!