Skip to content

Instantly share code, notes, and snippets.

@MahouShoujoMivutilde
Created October 12, 2022 17:04
Show Gist options
  • Save MahouShoujoMivutilde/7113baadb13208d91f4271a28debc58b to your computer and use it in GitHub Desktop.
Save MahouShoujoMivutilde/7113baadb13208d91f4271a28debc58b to your computer and use it in GitHub Desktop.
Use dmenu instead of `copyq show` to select clipboard entries
#!/usr/bin/env bash
read -r -d '' copyqjs << EOM
for (var i = 0; i < size(); i++) {
var lines = str(read(i)).split(/[\r\n]+/);
var line = "";
if (lines.length > 1) {
line = lines[0] + " (+" + str(lines.length - 1) + " more lines)";
} else {
line = lines[0];
}
if (line == "") {
line = '<probably image>';
}
print(i + " " + line + "\n");
}
EOM
pick="$(echo "$copyqjs" | copyq eval - | dmenu -i -l 20 | awk '{print $1}')"
if [[ "$pick" != "" ]]; then
copyq select "$pick"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment