forked from colonelpanic/dotfiles
[CopyQ] Add copyq_rofi script
This commit is contained in:
parent
35663fe1c8
commit
1434f817f7
9
dotfiles/lib/bin/copyq_all.js
Normal file
9
dotfiles/lib/bin/copyq_all.js
Normal 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
4
dotfiles/lib/bin/copyq_all.sh
Executable 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
8
dotfiles/lib/bin/copyq_rofi.sh
Executable 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
|
Loading…
Reference in New Issue
Block a user