fdw / rofimoji Goto Github PK
View Code? Open in Web Editor NEWEmoji, unicode and general character picker for rofi and rofi-likes
Home Page: https://github.com/fdw/rofimoji
License: MIT License
Emoji, unicode and general character picker for rofi and rofi-likes
Home Page: https://github.com/fdw/rofimoji
License: MIT License
https://bugzilla.mozilla.org/show_bug.cgi?id=1657777
Not sure where else I should put this but last night I stumbled across the bug report that would solve the issue of rofimoji not being able to use xdotool type
in Firefox. It's a good issue to follow and vote for if you'd benefit from it being fixed.
The new aliases (which are really neat, by the way) sometimes require keyboard interaction even when you type in an exact match. Eg when you type "rocket" (which is a full emoji name), you will still get "astronaut (astronaut, rocket)" as first result.
As a side note, it might be nice not to show the original name in brackets, too, because some of the entries get pretty long.
examples of applications that it doesn't paste to: qutebrowser, telegram-desktop
examples of applications it does paste to (in my case): chromium, ghome-terminal
i wish i knew how to debug this. xdotool type ๐
doesn't work either
xdotool type literallyanywordexceptemojis
does work
I already have xclip
installed and use it as my primary x-clipboard tool. This project lists xsel
as a dependency, and I see that in rofimoji.py
, xsel
is run through a Popen
call. I think it would be nice if the user could specify their preferred x selection tool in running rofimoji, to eliminate the strict dependency on xsel
.
Most messaging apps keep track of the last 10-20 used emojis, for quick reference and ease of use -- something I think it would be very handy for rofimoji.
rofi itself already has that sort of functionality for its modis, it uses a cache file for keeping their command history.
What do you think? Is this something worth giving a look into?
From sources
Download the src directory. In the picker subdirectory, execute python setup.py install --user. This also installs the python dependencies xdg and configargparse.
This doesn't seem to be accurate anymore. One have to execute the script in src
, not in picker
.
It then got installed under:
~/.local/lib/python3.8/site-packages/
So far so good, but I also had to manually make the rofimoji.py
script executable afterwards, because the installer didn't.
Furthermore I had to manually add an alias to my zsh-config to reach it for execution.
I have the feeling this isn't the intended way to go at all but more some lucky hackyish solution.
Expected behaviour:
Maybe someone can help me out here.๐๐
I'm on Fedora and i3wm and installed it from source.
I only run rofi on my primary monitor, but rofimoji doesn't allow changing this. It just requires adding the -monitor primary
option when you run rofi, substituting primary
for whatever monitor you want it on. I already hacked it in by hardcoding it but I'm unfortunately not confident enough that I can add it as an option and submit a PR, so it would be cool if it was added.
I tried to install it from arch repo to no avail.
Joyb pixel icon did get installed.
Then i just doenloaded the rofimoji script n run it.
But i'm shown a list of emoji without shown any emoji icons
As you can see in this comparison table yaourt
really shouldn't be used anymore. Even the author implicitly abandoned the project ("I do not plan to maintain yaourt anymore. The codebase is old, in bash, have implementations issues and other aur helper have superseded it these last years. Maybe it's time for yaourt to retire to the attic?").
There's no color, and a lot of emojis are missing. I'm using the Blobmoji fork of Noto Color Emojis font.
https://github.com/C1710/blobmoji
Unfortunately I can't take a screenshot because rofi grabs keyboard input. I can take a picture with my phone if you'd like, however.
Using the latest package in Arch's pacman (v.4.3.0), I get the following:
rofimoji --action=type
usage: rofimoji [-h] [--version] [--insert-with-clipboard] [--copy-only] [--skin-tone {neutral,light,medium-light,moderate,dark brown,black,ask}] [--files FILE [FILE ...]]
[--prompt PROMPT] [--rofi-args ROFI_ARGS] [--max-recent MAX_RECENT] [--clipboarder CLIPBOARDER] [--typer TYPER]
rofimoji: error: unrecognized arguments: --action=type
And I see that the latest change concerns actions. Could a regression have been introduced?
Often times I'll need to look up the specific codepoint of an emoji or other character online and it would be much easier to just have it in the menu. I'm thinking it could be dynamically inserted into the entry text, like so:
<small>1F600</small> grinning face <small>(face, grin, grinning face)</small>
<small>1F9D1+200D+1F4BB</small> technologist <small>(coder, developer, inventor, software, technologist)</small>
There are some considerations for implementing this:
When starting rofimoji with the -c or --use-clipboard switch it has no effect. Emojis are still directly inserted.
This could be easily fixed by changing the following conditions:
if returncode == 0 and not args.use_clipboard:
insert_emojis(emojis, active_window, args.use_clipboard)
elif returncode == 10 or args.use_clipboard:
copy_emojis_to_clipboard(emojis)
elif returncode == 11:
type_emojis(emojis, active_window)
elif returncode == 12:
copy_paste_emojis(emojis, active_window)
That's what I get when I try to run the script:
python3 src/picker/rofimoji.py
Traceback (most recent call last):
File "src/picker/rofimoji.py", line 9, in <module>
import configargparse
ModuleNotFoundError: No module named 'configargparse'
python3 --version: Python 3.6.10
I am using arch, but I do not want to install from the AUR because the rofimoji
package depends on an emoji-font
package, which gives (in my opinion) very ugly yellow emojis.
I prefer to use the monochrome emojis that my fonts already provide since it will match my theme. I cloned the repository and I can run rofimoji.py
in the picker
folder and it works as expected.
However I am unable to locate any sort of wheel
file in the releases or anywhere in the repo so I can install it in my path. How does this work? I can manually copy rofimoji.py
to a spot in my $PATH
(~/.local/bin/
) but then it cannot find the symbol files.
How can install it manually?
Since this is a Python package, I think it should be released on PyPI so the users can easily update the program without having to download the new release.
Some emojis have a gender modifier, e.g., shrugging and facepalm, but the current implementation of rofimoji doesn't apply the skin tone to such emojis.
Would there be an interest in supporting that in rofimoji?
I just finished implementing it in my fork: https://github.com/facocalj/rofimoji/commit/0539983e3027e27626037d79cc70854abd3a298e
This is how the warning looks like when I press Enter
or Alt+c
:
Pango-WARNING **: shaping failure, expect ugly output. shape-engine='PangoFcShapeEngine', font='Noto Color Emoji 13.5', text='๐ป'
I've compiled the latest Emoji release via Gentoo but that didn't change a thing.
Not sure how to debug and fix that?
Please tell me what kind of information you need.
When I select the thumbs up emoji, rofimoji crashes with:
Traceback (most recent call last):
File "/usr/bin/rofimoji", line 1905, in <module>
emojis = compile_chosen_emojis(stdout.splitlines(), args.skin_tone[0])
File "/usr/bin/rofimoji", line 1870, in compile_chosen_emojis
emoji = select_skin_tone(emoji, skin_tone)
File "/usr/bin/rofimoji", line 1756, in select_skin_tone
return selected_emoji + fitzpatrick_modifiers_reversed[skin_tone]
KeyError: 'a'
I'm running 0f81d64 with rofi 1.5.4 on Archlinux. The 2.1.0 release seems to work fine.
README.md update needed
Hey, thanks for this great project ๐
I encountered a minor problem when running rofimoji. I run it using the following command:
./rofimoji.py --action copy
and it works fine - rofi appears with the emojis, and I can select some, which is then copied to the clipboard. However, after rofi closes, the following is printed to the console:
usage: rofimoji.py [-h] [--version] [--action {type,copy,clipboard,unicode,copy-unicode}]
[--skin-tone {neutral,light,medium-light,moderate,dark brown,black,ask}]
[--files FILE [FILE ...]] [--prompt PROMPT] [--rofi-args ROFI_ARGS]
[--max-recent MAX_RECENT] [--clipboarder {xsel,xclip,wl-copy}]
[--typer {xdotool,wtype}]
rofimoji.py: error: argument --action/-a: expected one argument
which is puzzling, since I did provide an argument ๐
That's not a problem, since the application works fine. It may be misleading, though ๐
It would be nice to have aliases available for the emojis. Thus I could also type wizard
when looking for mage. Or dog might also surface paw prints ๐พ and an eggplant might also be found when searching for aubergine.
Hello! Thanks for this awesome tool! I was thinking it would be pretty useful to integrate Font Awesome icons as a data set. Is that something someone has done? If not, how much work would it be to format them for use here? I'm assuming it just comes down to doing a custom character file, so I'll look into that unless someone has already done it.
Hi,
First of all, thank you for the interesting work you've done on this project. I was just wondering if this script has to be executed stand-alone, or is it possible to integrate it into the "normal" rofi I use, and maybe switch to this modi
using Ctrl-Tab
Thank you
Hi
When copying and pasting emoji on my laptop everything works fine, but when doing it on my main computer it pastes what was on my clipboard previously. This is weird because the software is identical (cloned installs, ubuntu 18.04.3), the only difference is in drivers. My main box uses nvidia drivers, the laptop intel.
When I fixed it (very cleanly and properly) by sticking in a time.sleep() after the xdotool command (https://github.com/fdw/rofimoji/blob/master/rofimoji.py#L1920) in copy_paste_emojis, things works fine.
If I don't have that sleep there in firefox it pastes whatever was in the clipboard previously. (Is xdotool queueing a command and xsel is somehow executing before it even if the .wait() is there?).
Repro:
rofi -modi "emoji:rofimoji -a copy" -show emoji
This doesn't occur if I run rofimoji -a copy
, nor does it occur if I omit the -a copy
. It doesn't make a difference if I specify a --clipboarder
, and I've been using rofi for a long time with other "modi" without issue.
I'm on Arch with everything up to date. rofimoji is v5.0.0.
Hello,
Quick question about using the most recently used list. According to the README, I should be able to use Alt+<number>
to insert the corresponding emoji, but when I press the combination Alt+<number>
, nothing happens and rofimoji
is closed without inserting anything.
Is there an additional setting I need to configure?
Thank you
I like this tool a lot, but I know I'll forget the keybinds. Thus, I made a man page for myself and thought I'd share it. rofimoji-manpage.zip
Here's the command I use to make the man page from the markdown file:
pandoc -s -t man -o <output.1> <input.1.md>
On my system (Ubuntu 18.04), I put my custom man files here: ~/.local/share/man/man1
I would like to pass some parameters to rofi that I don't use in my main rofi config. For example, I like to use 3 columns with rofimoji, but when I use rofi in any other mode I use 1.
I suggest passing on any arguments that start with a single -
to the rofi
call. Then I could run rofimoji -columns 3
to get the desired effect.
That's the error message I get since today ... not sure what has changed since I didn't install or update rofimoji or any of it's direct dependencies (xdg and configargparse). I uninstalled and re-installed everything but the error remains. Not sure how I should proceed to get that error out of my way ...
Python 3.6.10 btw.
There are many rofi plugins (e.g. rofi-calc) which can be invoked as modi within rofi. This is preferred for me, as I'm sure like many other people I have a key combination (super+d) bound to rofi, and would rather not have another one just to invoke rofimoji (and would also rather not have to open a terminal just to start it).
Would it be possible to package this in such a way as to make it a rofi modus?
Thanks for sharing this tool. Its the perfect solution for selecting emojis. I was using a gnome extensions before, but that takes up valuable panel space.
I would like to define the rofi padding this script uses in rofimoji.py, so that it overrides my rofi config. I use a handful of rofi scripts, and for all but 2 I have rofi fullscreen with padding at 0, which i set in the rofi config.
I do not know python, so I am probably doing something wrong. I tried this:
rofi = Popen(
args=[
'rofi',
'-dmenu',
'-padding 375',
'-i',
'-p',
' ๐ฝ ',
'-kb-custom-1',
'Alt+c',
],
stdin=PIPE,
stdout=PIPE
)
But rofi ignores the -padding, and just uses what is set in my config. I assume my formatting is wrong....hmmm. Any tips would be really appreciated.
EDIT: After more use. I am going to leave the padding how it is, at 0. I found using it fullscreen make sense for how i use it. Thanks again for sharing.
The strange thing is, this font has the correct "skull and crossbones" emoji. Rofimoji just isn't using it for some reason. I suspect "smiling face" is the same but I haven't tested that.
Using the latest package of rofimoji from the Arch linux repos, when calling "rofimoji", I was met with:
$ rofimoji
Traceback (most recent call last):
File "/usr/bin/rofimoji", line 5, in <module>
from picker.rofimoji import main
File "/usr/lib/python3.8/site-packages/picker/rofimoji.py", line 12, in <module>
from xdg import BaseDirectory
ImportError: cannot import name 'BaseDirectory' from 'xdg' (/home/burrhole/.local/lib/python3.8/site-packages/xdg/__init__.py)
After reinstalling python-pyxdg-026.6
from the Arch repository, I was still getting this error. After checking https://pypi.org/project/xdg/, I noticed that the issue seemed to be rofimoji trying to import the wrong modules, and after replacing
from xdg import BaseDirectory
to
from xdg import XDG_CONFIG_DIRS, XDG_DATA_HOME
and the associated references to the new imports, the script runs as expected.
I can understand why my fix worked, but I'm honestly not sure how the script works for others in the first place without that fix.
This is the diff of the original script vs the version that works for me:
--- rofimoji.py-bak 2020-09-23 19:33:12.850406059 -0400
+++ rofimoji.py 2020-09-23 19:37:17.411656820 -0400
@@ -9,7 +9,7 @@
from typing import List, Tuple
import configargparse
-from xdg import BaseDirectory
+from xdg import XDG_CONFIG_DIRS, XDG_DATA_HOME
skin_tone_selectable_emojis = {'โ', 'โน', 'โ', 'โ', 'โ', 'โ', '๐
', '๐', '๐', '๐', '๐', '๐',
'๐', '๐', '๐', '๐', '๐', '๐', '๐', '๐', '๐', '๐', '๐',
'๐', '๐', '๐', '๐', '๐ฆ', '๐ง', '๐จ', '๐ฉ', '๐ช', '๐ซ', '๐ฌ',
@@ -73,7 +73,7 @@
parser = configargparse.ArgumentParser(
description='Select, insert or copy Unicode characters using rofi.',
default_config_files=[os.path.join(directory, 'rofimoji.rc') for directory in
- BaseDirectory.xdg_config_dirs]
+ XDG_CONFIG_DIRS]
)
parser.add_argument('--version', action='version', version='rofimoji 4.2.0')
parser.add_argument(
@@ -189,7 +189,7 @@
def load_recent_characters(max: int) -> List[str]:
try:
- with open(os.path.join(BaseDirectory.xdg_data_home, 'rofimoji', 'recent'), 'r') as file:
+ with open(os.path.join(XDG_DATA_HOME, 'rofimoji', 'recent'), 'r') as file:
return file.read().strip().split('\n')[:max]
except FileNotFoundError:
return []
@@ -286,8 +286,8 @@
def save_characters_to_recent_file(characters: str, max_recent_from_conf: int):
- old_file_name = os.path.join(BaseDirectory.xdg_data_home, 'rofimoji', 'recent')
- new_file_name = os.path.join(BaseDirectory.xdg_data_home, 'rofimoji', 'recent_temp')
+ old_file_name = os.path.join(XDG_DATA_HOME, 'rofimoji', 'recent')
+ new_file_name = os.path.join(XDG_DATA_HOME, 'rofimoji', 'recent_temp')
max_recent = min(max_recent_from_conf, 10)
@@ -314,7 +314,7 @@
def append_to_favorites_file(characters: str):
- file_name = os.path.join(BaseDirectory.xdg_data_home, 'rofimoji', 'favorites')
+ file_name = os.path.join(XDG_DATA_HOME, 'rofimoji', 'favorites')
os.makedirs(os.path.dirname(file_name), exist_ok=True)
with open(file_name, 'a+') as file:
Apologies if there's anything confusing or poorly formatted in this issue.
EDIT: Also, after looking at the XDG Base Directory specification at https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html#variables it looks like rofimoji should be importing XDG_CONFIG_HOME
rather than XDG_CONFIG_DIRS
for $HOME/.config/rofimoji.rc
since HOME
defaults to $HOME/.config/
and DIRS
defaults to /etc/xdg
, but I may be mistaken.
I would love to also have maths symbols in rofimoji. If I write a PR, would you consider integrating it? I would modify extract_emojis.py
and I would integrate https://unicode.org/Public/math/latest/MathClassEx-15.txt in there.
a *
expression should be added to rofimoji.rc
to allow all files to be included. Maybe even regexes. What do you think?
I know this makes a tad less sense, but hear my out.
I'm a big fan of the project, and used to swear by it on X11. But ever since I switched to Wayland, I've been using wofi
instead of rofi
, for various reasons and that makes it infeasible to use this package.
It would be great if you allowed manually specifying the dmenu provider so I could swap out rofi -dmenu
for wofi --dmenu
.
When trying to use rofimoji with the exact same arguments as in the example on the release page (https://github.com/fdw/rofimoji/releases/tag/3.0.0) I get an error:
$ rofimoji --rofi-args "-columns 3"
usage: rofimoji [-h] [--use-clipboard] [--skin-tone {neutral,light,medium-light,moderate,dark brown,black,ask}]
[--emoji-file FILE] [--rofi-args ROFI_ARGS]
rofimoji: error: argument --rofi-args: expected one argument
Other than that it works exactly like I hoped. Cool project ๐
Hi good to see this cool project ๐ I want use rofimoji output in my library(It's IME called kime)
so I spawn rofimoji process in code and works nice but as README mentioned, xdotool and wtype is not working on some apps
however, if rofimoji support stdout output such as --action stdout
I can use IME side commit string
for those apps
When selecting multiple emoji, only one emoji is copied to my clipboard โ It seems you're copying each emoji individually, overriding the previously copied emoji.
I use rofimoji as a standalone thing called from rofi (open rofi -> type emoji -> open rofimoji), and about 90% of the time hitting enter on an emoji does not result in it being inserted into whatever text field etc. I'm working in. It sporadically works, but most of the time I have to copy and paste the character.
I'm really unsure how to go about debugging this though, so am happy to do so with some pointers to gather more information. I notice this the most in firefox because I spend so much time in it.
Hello, I compiled an installed rofimoji with the setup.py
.
When I launch rofimoji
in my shell, here is the output:
Traceback (most recent call last):
File "/usr/local/bin/rofimoji", line 11, in <module>
load_entry_point('rofimoji==4.3.0', 'console_scripts', 'rofimoji')()
File "/usr/local/lib/python3.6/dist-packages/rofimoji-4.3.0-py3.6.egg/picker/Rofimoji.py", line 360, in main
Rofimoji()
File "/usr/local/lib/python3.6/dist-packages/rofimoji-4.3.0-py3.6.egg/picker/Rofimoji.py", line 47, in __init__
self.active_window = self.typer.get_active_window()
File "/usr/local/lib/python3.6/dist-packages/rofimoji-4.3.0-py3.6.egg/picker/Typer.py", line 47, in get_active_window
encoding='utf-8').stdout[:-1]
File "/usr/lib/python3.6/subprocess.py", line 423, in run
with Popen(*popenargs, **kwargs) as process:
TypeError: __init__() got an unexpected keyword argument 'capture_output'
I tried to launch it without arguments and with those arguments too but the issue is the same:
rofimoji --clipboarder xclip --typer xdotool
Do you know what could I do to make it work?
Thanks!
If an emoji has multiple skins such as ๐ then after selecting the emoji and I'm prompt to choose the skin I cannot use alt+c
to copy to clipboard anymore, it just types c
in the search field.
No matter how I start rofimoji, upon hitting enter I get no output. Copying with Alt+c works fine, though. xdotool is installed and confirmed as working โ are there any other troubleshooting steps I could take?
Rofi runs fine when executed by rofimoji
. Yet when rofi -modi "emoji:rofimoji" -show emoji
is ran, then empty rofi dialog is displayed. No errors, just empty rofi window.
Rofi config:
! ------------------------------------------------------------------------------
! ROFI Color theme
! ------------------------------------------------------------------------------
rofi.color-enabled: true
rofi.font: Droid Sans Mono for Powerline 10
rofi.theme: gruvbox-dark-hard
rofi.terminal: urxvtc
rofi.show-icons: true
!rofi.matching: regex
rofi.bw: 3
Bit unrelated, but is there also possible to combine rofi with other pre-existing combi options?
Eg
rofi -show combi -combi-modi 'window#drun#run' -modi combi#ssh -modi emoji#rofimoji -sidebar-mode
produces no errors, but only the combi
and ssh
modes are displayed.
Rofimoji installed by /usr/bin/env python3 -m pip install --user --upgrade git+ssh://[email protected]/fdw/rofimoji.git
Is is possible to use Rofimoji to insert Unicode into another Rofi window? I setup a Rofi menu to create named Sway workspaces, with the intention of adding emoji names, only to discover that the Rofimoji menu will not show up while another Rofi menu is open.
Currently, the rofi dmenu prompt is hardcoded as a smiley face. However, many people (me included) use custom prompts for their different rofi windows and modis.
Would there be an interest in making rofimoji's prompt customisable? If so, I could submit a PR
What do other apps like Firefox/Chrome/your text editor show instead of emojis?
Emojis in other apps are fine, even when I select an emoji from rofimoji
, it's inserted and displayed correctly in the app
Which emoji fonts do you have installed?
Sorry, I'm not so sure about this; I have noto-fonts-emoji
, and I think that should be fine?
Are the emoji fonts set in your font config?
Again sorry, I don't know the answer to this one
Which versions of rofimoji and pango are installed?
pacman
shows 4.1.1-1
for rofimoji
and shows 1:1.44.7+11+g73b46b04-1
for pango
I have Manjaro on my Desktop, and the confusing part for me is that everything was working fine in my environment, and I was able to see all the emojis (without me playing with font config or anything), but I recently opened rofimoji
and I saw these weird characters appearing.
I can't say since when this happened; I'm always updating my packages, so something should have broken this, but, since I didn't configure anything before (or I did and it was a while back and I don't remember), I'm not sure what the source of the problem is
:) for ๐
:D for ๐
=D for ๐
-.- for ๐
etc.
I think those are much faster to type.
Hi, nice little app you have here. I recently installed Arch with Sway and as of yet I have not found a symbol picker. I used rofimoji
a bit on another laptop but it doesn't do anything in sway. No error messages in the terminal. I figure it's because rofi doesn't work with Wayland. It might work if I use XWayland but I'm trying to avoid that.
There is a fork of rofi here that supports Wayland.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.