Giter VIP home page Giter VIP logo

rofimoji's Introduction

Rofimoji: A character picker for rofi

Do you want to use one of those fancy emojis? Or one of those other interesting characters Unicode offers? But you haven't found a good picker yet?

Fear no more, rofimoji invokes the power of rofi (and other dmenu-derivatives) to give you exactly the picker you always wanted.

Main features

How does it look?

Default

Screenshot of rofimoji

With a grid theme

Screenshot of rofimoji with a grid theme

Usage

Standalone

Call rofimoji as a standalone tool.

  1. Run rofimoji
  2. Search for the character you want
  3. (optional) Select multiple emoji with shift+enter
  4. Hit enter to for the default action or use one of the shortcuts to do something else.
    alt+1 directly chooses the most most recently used character (alt+2 for the second most recently one etc.)
  5. Maybe select a skin color
  6. ๐Ÿฆพ

As a rofi mode

Integrate rofimoji as just another rofi mode.

  1. Call rofi with rofi -modi "emoji:rofimoji" -show emoji
  2. Search for the character you want
  3. Hit enter to execute your default action;
    Alt+Shift+1 for copying to the clipboard
    Alt+Shift+3 for the "clipboard" insertion method
    alt+1 inserts the most recently used character (alt+2 for the second most recently one etc.)
  4. Maybe select a skin color
  5. ๐Ÿ‰

Caveats when running rofimoji as a rofi mode

There are some limitations to this approach, though: Running as rofi mode has several drawbacks that cannot be changed:

  • Because rofi is the main process, rofimoji cannot directly type to any window. Only copying the character works, so set the --action accordingly.
  • You can only select one character at a time.
  • The custom keyboard shortcuts are still there, but mapped to Alt+Shift+1 (on a Qwerty keyboard) etc.

The configuration still works as described. You can have several modes in a combi for different character sets, for example, or set a default action and skin tone.

Configuration

You can configure rofimoji either with cli arguments or with a config file called $XDG_CONFIG_HOME/rofimoji.rc. For the file, use the long option names without double dashes.

Options

long option short option possible values default value description
--action -a type, copy, clipboard, unicode, copy-unicode, print, menu type Choose what rofimoji should do with the selected characters. See Actions below for details.
--files -f all, <yourfile> or any of the files in data emojis Define which file(s) to load characters from. A file name without extension (f.e. emojis_smileys_emotion) is enough for the distributed ones or any in ${XDG_DATA_HOME}/rofimoji/data. Globbing with * is possible.
all is a shortcut for all default files at once. Use with caution, that is a lot.
--skin-tone -s light, medium-light, moderate, dark brown, black, as well as neutral and ask ask Define the skin tone of supporting emojis. ask will always ask the user.
--max-recent 0-10 10 Show at most this many recently picked characters. The number will be capped at 10. Set to 0 to disable the whole feature.
--no-frecency
(no-frecency=True in the config file)
- <false> By default, rofimoji shows frequently used items first. With this option, they're shown in the order of the file.
--hidden-descriptions
(hidden-descriptions=True in the config file)
- <false> Only list the characters, but not their description. This is useful for grid themes in rofi. Note that they're still searchable, even though the description is not shown. Not used with other selectors.
--use-icons false Show characters as icons in rofi. Not used for other selectors.
--prompt -r any string ๐Ÿ˜€ Define the prompt text for rofimoji.
--selector-args Define arguments that rofimoji will pass through to the selector.
Please note that you need to specify it as --selector-args="<selector-args>" or --selector-args " <selector-args>" because of a bug in argparse
--selector rofi, wofi, fuzzel, dmenu, tofi, bemenu, wmenu (automatically chosen) Show the selection dialog with this application.
--clipboarder xsel, xclip, wl-copy (automatically chosen) Access the clipboard with this application.
--typer xdotool, wtype (automatically chosen) Type the characters using this application.
--keybinding-copy, --keybinding-type, --keybinding-clipboard, --keybinding-unicode, --keybinding-copy-unicode Alt+c, Alt+t, Alt+p, Alt+u, Alt+i Choose different keybindings than the default values.

Example config file

~/.config/rofimoji.rc:

action = copy
files = [emojis, math]
skin-tone = moderate

Actions

The --action (-a) option defines what action will be taken when a character is selected. Multiple actions can be specified with a space character in between (for example: -a type copy). The options are:

name shortcut description
type alt+t Directly type the characters into the last active window. This is the default
copy alt+c Copy them to the clipboard.
clipboard alt+p Insert the selected characters through pasting from the clipboard, instead of directly typing them. See Insertion Method.
unicode alt+u Type the unicode codepoints of the selected characters.
copy-unicode alt+i Copy the codepoints to clipboard.
print Print the chosen characters to stdout.

Insertion method

By default, rofimoji types the characters using either xdotool or wtype (see 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. Therefore, rofimoji uses both and also restores both. To use this workaround, you can either use the keybinding alt+p or start it as rofimoji --action clipboard (-a clipboard). If you want to have it directly typed instead, you can hit alt+t, even though it was started with --action clipboard. Note that you can change the keybindings.

Finally, with --action copy (or -a copy) you can also tell rofimoji to only copy the selected characters to your clipboard.

Display server support

rofimoji supports both X11 and Wayland by using the correct tools for each environment (see Supported Selectors). It tries to automatically choose the right one for the currently running session. If you want to manually overwrite this, have a look at the --selector, --clipboarder and --typer options above.

Most recently used characters

By default, rofimoji will show the last ten recently used characters separately; you can insert them with alt+1, alt+2 and so on. It will use the default insertion method. If you don't want this, you can set --max-recent to 0.

Additionally, rofimoji also remembers in general which characters are used more frequently and sorts the list accordingly. You can disable this behavior with --no-frecency.

Rofi theming

By default, rofimoji re-uses the existing rofi configuration, but you can pass your own using --selector-args (for example --selector-args="-theme ~/your-rofi-theme.rasi").

If you would like a more character-focused theme, you can use packaged grid.rasi together with the --hidden-descriptions parameter. This theme still imports the existing rofi configuration but moves the entries into a grid. Of course, you can base your own theme on this. (If you have improvements, please open a PR!) To use the arrow keys in rofi only for the grid and not the query, pass these -selector-args: -kb-row-left Left -kb-row-right Right -kb-move-char-back Control+b -kb-move-char-forward Control+f.

Screenshot of rofimoji with a grid theme

Supported characters

If you miss something, please open an issue!

Custom character files and descriptions

If the predefined ones are not enough, you can define additional character files and load them with -f (see options). In each line, one 'character' can be defined, followed by a single space character ( ). After that, you can write whatever description you want.

If the character is also in another selected file, all descriptions will be combined. If you give it the same name as one of those included with rofimoji, yours will be preferred.

For added comfort, rofimoji will automatically load an "additional" file for predefined ones. This file needs to called <filename>.additional.csv and lie in ${XDG_DATA_DIR}/rofimoji/data/. For example, if you want to extend emojis_smileys_emotion, call the file emojis_smileys_emotions.additional.csv. This is helpful if you want additional descriptions: You can define such an additional character file, add the character and your description and your descriptions will now also be shown.

If you think your file is useful to others, please open a PR to include it in a future version of rofimoji.

Installation

From distribution repositories

Packaging status

From PyPI

rofimoji is on PyPI. You can install it with pipx install rofimoji (or sudo pipx install rofimoji).

From Github

Download the wheel file of the latest release and install it with sudo pip install $filename (or you can use pip install --user $filename to only install it for the local user). Afterwards, there should be a rofimoji on your $PATH. This also installs the python dependency configargparse.

Dependencies

What else do you need:

  • Python 3.8 or higher
  • A font that can display your scripts, (for emojis, EmojiOne or Noto Emoji work)
  • Optionally, a tool to programmatically type characters into applications. Either xdotool for X11 or wtype for Wayland
  • Optionally, a tool to copy the characters to the clipboard. xsel and xclip work on X11; wl-copy on Wayland

Supported Selectors

Please note that only rofi (both on X and Wayland) supports custom keyboard shortcuts, recent files or a grid theme at the moment. For all others, only basic functionality works.

X.org

Wayland

rofimoji's People

Contributors

carnager avatar chmduquesne avatar cmurtagh-lgtm avatar dependabot[bot] avatar desbma avatar eumiro avatar fdw avatar jakubkaczor avatar k0ral avatar komputerwiz avatar kqzz avatar major avatar markstos avatar mcourteaux avatar nathanalderson avatar op avatar owenthewizard avatar polyzen avatar puresick avatar reeseovine avatar rogach avatar s3lph avatar santos-j avatar siers avatar the-compiler avatar tranzystorekk avatar tusqasi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

rofimoji's Issues

Rofi-Args not working

  • Which versions of rofimoji? 3.0.1-1 (see screenshot)

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

2020-02-13-184631_1886x391_scrot

Other than that it works exactly like I hoped. Cool project ๐Ÿ‘

Show chars from all files

a * expression should be added to rofimoji.rc to allow all files to be included. Maybe even regexes. What do you think?

Python error at first launch: unexpected keyword argument 'capture_output'

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!

Wheel file?

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?

Character insertion frequently fails

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.

Can I get emoji output with stdout?

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

rofimoji not executable by default

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:

  • To not have to do all the manual steps described above.
  • To open rofimoji via shortcut or directly from rofi rather than starting it from terminal.

Maybe someone can help me out here.๐Ÿ™๐Ÿ˜€
I'm on Fedora and i3wm and installed it from source.

Add support for wofi

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.

rofimoji throws error message and doesn't show any emoji

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.

Suggestion: provide a man page

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

Insert into another Rofi window

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.

rofimoji seriously broken with commit f211333

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

Emojis are all of a sudden displayed as weird characters

  • What does rofimoji show instead of the emojis? Can you please share a screenshot (`Alt+Shift+s** in rofimoji)

rofi-2020-05-04-1837-00000

  • 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

Feature request: Most recent Emojis

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?

doesn't paste into qt applications

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

Feature Request: Custom rofi prompt

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

--action argument is unrecognized

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?

Define rofi -padding in rofimoji.py

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.

How to use most recently used list?

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

copy_paste_emoji has race condition

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?).

Clipboard Switch has no effect

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)

rofi in -modi mode is blank

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

Sorting: Always display exact matches first

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.

Rofimoji fails to import BaseDirectory from xdg

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.

Cant see any emoji

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

realloc(): invalid next size

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.

[feat request] Allow user to specify X-clipboard tool

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.

Use as a modi

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

Usage in rofi freezes Xorg

Repro:

  1. Run rofi -modi "emoji:rofimoji -a copy" -show emoji
  2. Select any emoji with the Enter key
  3. Everything bar the mouse will be frozen - need to switch to another TTY to kill rofi

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.

Allow choosing a monitor

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.

KeyError in select_skin_tone

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.

Don't recommend yaourt as an AUR helper

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?").

Font Awesome Icons?

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.

Make rofimoji a modus of roji

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?

--action expected one argument despite working correctly

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 ๐Ÿ™‚

No output in X windows

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?

Release the package on PyPI

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.

Can't copy "skin-emojis" to clipboard

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.

[Feature request] Option to show Unicode character codepoint(s)

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:

  • Codepoints are not stored in the character files so they would need to be generated on-the-fly.
  • Should it omit invisible joiners? They're important to know sometimes.
  • Can it accurately insert the text in the right spot or should it be attached to an end?

Native Wayland support

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.

[Font Problem] Doesn't display certain emojis properly

  • What does rofimoji show instead of the emojis? Can you please share a screenshot (`Alt+Shift+s** in rofimoji) It shows a tiny black and white version of the "smiling face" and the "skull and crossbones" emojis.
  • What do other apps like Firefox/Chrome/your text editor show instead of emojis? The "skull and crossbones" emoji in Vivaldi browser looks as it does in Rofimoji. But if I paste it into a page with my smartphone, and then look at that same page on my desktop, it shows the right "skull and crossbones" with color.
  • Which emoji fonts do you have installed? Blobmoji.ttf
  • Are the emoji fonts set in your font config? Yes
  • Which versions of rofimoji and pango are installed? I just "git pull"ed the latest version of Rofimoji as of 2019-12-09 15:00 GMT-08, libpango version is 1.42.4-7~deb10u1 amd64.

rofi-2019-12-09-1503-00000
rofi-2019-12-09-1509-00000

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.

[feature request] pass arguments to rofi

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.