[CopyQ] Add copyq_rofi script

This commit is contained in:
Ivan Malison 2016-09-30 17:26:37 -07:00
parent 35663fe1c8
commit 1434f817f7
No known key found for this signature in database
GPG Key ID: 62530EFBE99DC2F8
3 changed files with 21 additions and 0 deletions

View File

@ -0,0 +1,9 @@
String.prototype.replaceAll = function(search, replacement) {
var target = this;
return target.split(search).join(replacement);
};
for (var i=0; i<size(); i++) {
var item = str(read(i));
print("(" + i + ")" + " " + item.replaceAll("\\n", "(newline)") + "\\n");
}

4
dotfiles/lib/bin/copyq_all.sh Executable file
View File

@ -0,0 +1,4 @@
#!/usr/bin/env bash
SOURCE_DIR="$(dirname ${BASH_SOURCE[0]})"
copyq eval "$(cat $SOURCE_DIR/copyq_all.js)"

8
dotfiles/lib/bin/copyq_rofi.sh Executable file
View File

@ -0,0 +1,8 @@
#!/usr/bin/env bash
SELECTED_INDEX="$(copyq_all.sh | rofi -dmenu -format i)"
if [ "$SELECTED_INDEX" -eq "$SELECTED_INDEX" ] 2>/dev/null; then
copyq select "$SELECTED_INDEX"
copyq paste
fi