| 1 | #!/usr/bin/envscip-shell filesystem . . `/usr/bin/env`. bash |
| 2 | |
| 3 | tmp_dir="/tmp/cliphistscip-shell filesystem . . `/tmp/cliphist`." |
| 4 | rmscip-shell system . . rm. -rf "$tmp_dir" |
| 5 | |
| 6 | if [[ -n "$1" ]]; then |
| 7 | cliphist decode <<<"$1" | wl-copy |
| 8 | exit |
| 9 | fi |
| 10 | |
| 11 | mkdirscip-shell system . . mkdir. -p "$tmp_dir" |
| 12 | |
| 13 | read -r -d '' prog <<EOF |
| 14 | /^[0-9]+\s<meta http-equiv=/ { next } |
| 15 | match(\$0, /^([0-9]+)\s(\[\[\s)?binary.*(jpg|jpeg|png|bmp)/, grp) { |
| 16 | system("echo " grp[1] "\\\\\t | cliphist decode >$tmp_dir/"grp[1]"."grp[3]) |
| 17 | print \$0"\0icon\x1f$tmp_dir/"grp[1]"."grp[3] |
| 18 | next |
| 19 | } |
| 20 | 1 |
| 21 | EOF |
| 22 | cliphist list | gawkscip-shell system . . gawk. "$prog" |