Files
linux-bin/mv2figs.sh

28 lines
838 B
Bash
Raw Permalink Normal View History

2019-02-05 19:30:40 -08:00
#!/bin/bash
2020-10-05 23:08:33 -07:00
#!/bin/bash
if [ "$1" == "-h" ] ; then
echo "
mv2figs - move image to figure assets folder and put html figure string containing relative link to the asset on system clipboard
- used by the <ctrl-z> screenshot shortcut set in .config/sway/config and .config/i3/config
- default figure assets set as HOME/figures
Usage: mv2figs.sh img.jpg
mv2figs.sh img.jpg ~/myproject/assets
"
exit 0
fi
set -e
2019-02-05 19:30:40 -08:00
#default image location
2020-10-05 23:08:33 -07:00
# blobFolder=$HOME/figures
blobFolder=${2:-$HOME/figures}
#TODO: add xorg-x11 vs wayland logic here
2020-05-10 22:25:36 -07:00
# wayland: use "wl-copy"
#xorg-x11: use "xclip -selection clipboard"
2019-02-05 19:30:40 -08:00
mv $1 $blobFolder/$1
2020-05-10 22:25:36 -07:00
echo "<figure><img src=\""$(basename $blobFolder)/$1"\" width=\"500px\"><figcaption></figcaption></figure>" | wl-copy