Created
January 31, 2022 08:22
-
-
Save vaskas/7262d815988a0a6d165830f66399ca67 to your computer and use it in GitHub Desktop.
Run clipboard contents through percollate and into Plucker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -e | |
## Needs: | |
# python2 | |
# PyPlucker | |
# nodejs, npm | |
# npm install -g percollate | |
# libnotify-bin | |
CODEPAGE="cp1251" | |
WORKDIR="/tmp/pluckerbook" | |
rm -rf "$WORKDIR" | |
mkdir "$WORKDIR" | |
cd "$WORKDIR" | |
clip="$(xclip -o -selection clip)" | |
if [[ "$clip" = http* ]]; then | |
percollate html "$clip" | |
html_orig="$(ls *.html | xargs -I% basename % | head -1)" | |
iconv -c -f utf-8 -t "$CODEPAGE" "$html_orig" > html_conv.html | |
output_name="$(echo $html_orig | sed -e 's/\.html//' | cut -c 1-16)" | |
plucker-build --doc-file="$output_name" --bpp=4 --maxdepth=1 -H "$PWD"/html_conv.html | |
echo "$clip" >> $HOME/.plucker/history.txt | |
else | |
echo $clip > note.txt | |
iconv -c -f utf-8 -t "$CODEPAGE" note.txt > note_conv.txt | |
output_name="Clip$(date +%s)" | |
plucker-build --doc-file="$output_name" -H "$PWD"/note_conv.txt | |
fi | |
notify-send "Built $output_name" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment