Files
utility_scripts/wl_vimshot.sh

19 lines
726 B
Bash
Executable File

#!/bin/sh
# Script to take a wait a few seconds before taking a screenshot to the filepath in the clipboard.
# For use as part of my LaTeX note-taking workflow in Vim: create the figure environment, copy the file name, invoke this script, and select the region in the source material to be screenshotted.
basename=$(basename "$0")
filepath=$(wl-paste)
# check if the filepath is absolute or relative, and if relative, make absolute
if [ "${filepath#\/}" = "$filepath" ] || [ "${filepath#\~}" = "$filepath" ]; then
filepath="$(pwd)/$filepath"
fi
notify-send "$basename" "Taking screenshot to $filepath"
sleep 5
grim -g "$(slurp)" "$filepath"
notify-send --icon "$filepath" "$basename" "Screenshot saved to: $filepath"