Skip to content

szaffarano/rofi-tools

Repository files navigation

Rofi Tools

GitHub Release GitHub License pre-commit NixOS

Note: Only tested with rofi-wayland, although it should work with the official version.

Cliphist integration

A WIP integration with cliphist to show both text and images in a Rofi menu. Requires wl-clipboard and of course cliphist.

Since I wanted to use different layouts/rofi configurations for texts and images, neither the script mode nor a custom mode/plugin were valid options because it's impossible to dynamically update the layout without re-launching Rofi (more info here).

Usage

Just build the tool or download the latest release and add the binary to your path.

It's also exposed as a Nix flake. Add the input to your flake.nix

{
  inputs = {
    wofi-tools = {
      url = "github:szaffarano/rofi-tools";
      inputs = {
        nixpkgs.follows = "nixpkgs";
      };
    };
  }
}

And reference the package as usual, e.g.,

home.packages = [
  inputs.rofi-tools.packages.${pkgs.system}.rofi-cliphist
];

And finally call it

path/to/cliphist-rofi

It will show by default all non-binary cliphist entries. You can switch between text/image mode by using Alt-t / Alt-i and also delete entries using Alt-d.

Text Mode

Image Mode

Configuration

  • Through the command line:
Usage: rofi-cliphist [OPTIONS]

Options:
  -v, --verbose                          Show verbose output
  -r, --rofi-path <ROFI_PATH>            Path to rofi executable [default: rofi]
  -c, --cliphist-path <CLIPHIST_PATH>    Path to cliphist executable [default: cliphist]
  -w, --clipboard-path <CLIPBOARD_PATH>  Path to wl-copy executable [default: wl-copy]
  -f, --config <FILE>                    Sets a custom config file
  -h, --help                             Print help
  -V, --version                          Print version
  • Through a configuration file, either on $XDG_CONFIG_HOME/rofi-cliphist.toml or the path specified using the -f/--config flag
[rofi]
path = "rofi"

[cliphist]
path = "cliphist"

[clipboard]
path = "wl-copy"

[text_mode_config]
title = "Text"
shortcut = "Alt+t"
description = "Switch to text mode"

[image_mode_config]
title = "Image"
shortcut = "Alt+i"
description = "Switch to image mode!"

[delete_mode_config]
title = "Delete"
shortcut = "Alt+d"
description = "Delete entry"