Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rofi-emoji: init at 2.1.2 #83753

Merged
merged 2 commits into from Apr 4, 2020
Merged

rofi-emoji: init at 2.1.2 #83753

merged 2 commits into from Apr 4, 2020

Conversation

cole-h
Copy link
Member

@cole-h cole-h commented Mar 30, 2020

This plugin is intended to be supplied to the rofi wrapper through an
override:

pkgs.rofi.override { plugins = [ rofi-emoji ]; }
Motivation for this change
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

Takes inspiration from and relies on #83136.

This comes with a script that uses binaries like notify-send, wl-copy, xclip, xsel:
https://github.com/Mange/rofi-emoji/blob/61d6a795ef3703c4c5babd7dc861041c4f7d7e50/clipboard-adapter.sh.

Should I patch these to be absolute store paths with substituteAll (and thus relying on X11 binaries on Wayland and vice-versa), or is it fine as-is? Or is there another solution I haven't though of? I currently don't have any problems, but I'm on Arch and have these binaries in my PATH already.

I'm still curious whether or not it's "fine" to rely on the xclip/wl-clipboard binaries unconditionally. Maybe I should add waylandSupport ? true and x11Support ? true and make them optional (but requiring at least one of those to be set)?


To test, run the following:

nix-shell -I nixpkgs=https://github.com/NixOS/nixpkgs/tarball/f0fe89357ea79c8a9fb35876a26f70ce7455cfee -p 'rofi.override { plugins = [ rofi-emoji ]; }' --run 'rofi -show emoji -modi emoji'

If you see a rofi window pop up with emoji, it works! Now see if you can select an emoji (with enter) and paste it somewhere. If you can, I likely don't need to substitute the binaries in clipboard-adapter.sh; otherwise, I probably will have to.

EDIT: Updated the above easy-test command to point to new commits.

Copy link
Member

@Ma27 Ma27 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd vote for patching all dependencies into the script (e.g. by using wrapProgram --prefix PATH). Also, when testing on NixOS, a so-called emoji file can't be found. Maybe a path to it should be fixed as well.

@cole-h
Copy link
Member Author

cole-h commented Mar 31, 2020

It appears that the reason that file can't be found is that $out/share is not a part of XDG_DATA_DIRS ($out/share/all_emojis.txt is what it wants to find).

I could make a patch that forces the path to be $out/share/all_emojis.txt (would also need to be done for the clipboard script), sidestepping the traversal through XDG_DATA_DIRS and the need to find a way to wrap it. It feels kinda icky; the alternative is to modify the rofi wrapper itself to prefix the XDG_DATA_DIRS with every plugin's $out/share path.

Which do you think is more preferable? I lean towards modifying the wrapper, but I'll defer to you (or anybody else who has an opinion on this).

EDIT: Would this matter in the case where the plugin has no /share? e.g. rofi-calc, another plugin, has no /share directory...

This plugin is intended to be supplied to the `rofi` wrapper through an
override:

    pkgs.rofi.override { plugins = [ rofi-emoji ]; }
@cole-h
Copy link
Member Author

cole-h commented Mar 31, 2020

I opted to modify the wrapper. It appears to work for me. (Removed all local all_emojis.txt files to hopefully test that this is the case.) I'm no Nix wizard, so maybe my modifications could be improved? Happy to entertain ideas.

@cole-h cole-h changed the title rofi-emoji: init at 2.1.1 rofi-emoji: init at 2.1.2 Mar 31, 2020
@cole-h cole-h requested a review from Ma27 April 2, 2020 00:20
@Ma27 Ma27 merged commit 384a164 into NixOS:master Apr 4, 2020
@cole-h cole-h deleted the rofi-emoji branch April 9, 2020 21:41
@etu etu mentioned this pull request Aug 26, 2020
10 tasks
@rikhuijzer
Copy link
Contributor

I'll leave it here since it isn't clearly documented. To install rofi-emoji globally on NixOS, use

environment.systemPackages = with pkgs; [
  (rofi.override { plugins = [ rofi-emoji ]; })
  [...]
];

And to link the emoji picker to, say, mod+u in i3wm use

bindsym $mod+u exec "rofi -modi emoji -show emoji"

With that, pressing mod+u will open the emoji picker and pressing return on one of the emoji will past it in the active window.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants