summaryrefslogtreecommitdiff
path: root/dot-config/rofi/scripts
diff options
context:
space:
mode:
authorlittleblack111 <littleblack11111@gmail.com>2024-10-07 16:11:27 +0800
committerlittleblack111 <littleblack11111@gmail.com>2024-10-07 16:11:27 +0800
commite87c4f7979f1d43a55eebe3640182eebf156f919 (patch)
tree72b20461fafa1cd95448c085461359c22deee37e /dot-config/rofi/scripts
parentaf23c899fa687b4fe745d2b64bab7434921b0fda (diff)
add(rofi_clipboard...): added rofi_clipboard and made it show image as icons as well
Diffstat (limited to 'dot-config/rofi/scripts')
-rwxr-xr-xdot-config/rofi/scripts/cliphist-rofi-img25
-rwxr-xr-xdot-config/rofi/scripts/rofi_clipboard5
2 files changed, 30 insertions, 0 deletions
diff --git a/dot-config/rofi/scripts/cliphist-rofi-img b/dot-config/rofi/scripts/cliphist-rofi-img
new file mode 100755
index 00000000..c30a627d
--- /dev/null
+++ b/dot-config/rofi/scripts/cliphist-rofi-img
@@ -0,0 +1,25 @@
+#!/usr/bin/env bash
+
+tmp_dir="/tmp/cliphist"
+
+if [[ -n "$1" ]]; then
+ cliphist decode <<<"$1" | wl-copy
+ exit
+fi
+
+mkdir -p "$tmp_dir"
+
+read -r -d '' prog <<EOF
+/^[0-9]+\s<meta http-equiv=/ { next }
+match(\$0, /^([0-9]+)\s(\[\[\s)?binary.*(jpg|jpeg|png|bmp)/, grp) {
+ system("echo " grp[1] "\\\\\t | cliphist decode >$tmp_dir/"grp[1]"."grp[3])
+ print \$0"\0icon\x1f$tmp_dir/"grp[1]"."grp[3]
+ next
+}
+1
+EOF
+# echo $(cat "$tmp_dir/cliphist")
+# get last 10 lines and merge them
+
+# cat "$tmp_dir/cliphist"
+cliphist list | gawk "$prog" &
diff --git a/dot-config/rofi/scripts/rofi_clipboard b/dot-config/rofi/scripts/rofi_clipboard
new file mode 100755
index 00000000..55439a06
--- /dev/null
+++ b/dot-config/rofi/scripts/rofi_clipboard
@@ -0,0 +1,5 @@
+#!/usr/bin/bash
+
+DIR="$HOME/.config/rofi"
+RASI="$DIR/clipboard.rasi"
+rofi -modi clipboard:"$DIR/scripts/cliphist-rofi-img" -show clipboard -theme ${RASI}