[vimshot.sh]: Add vimshot.sh

This commit is contained in:
2024-10-24 01:25:14 +01:00
parent b02c0ddf2f
commit c001a1c26e
2 changed files with 19 additions and 0 deletions

View File

@ -33,5 +33,6 @@
- `stopwatch.sh`: simple stopwatch script that counts the elapsed time in seconds, and displays it in the format HH:MM:SS. - `stopwatch.sh`: simple stopwatch script that counts the elapsed time in seconds, and displays it in the format HH:MM:SS.
- `sync_music.sh`: script to sync my Android phone's music library to the contents of my `~/media/music/` directory, i.e. copy my music library from my - `sync_music.sh`: script to sync my Android phone's music library to the contents of my `~/media/music/` directory, i.e. copy my music library from my
laptop to my phone. laptop to my phone.
- `vimshot.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.
- `webcam.sh`: one-line script that uses the video viewer program `mpv` as a webcam by using `/dev/video0` as its video file source. - `webcam.sh`: one-line script that uses the video viewer program `mpv` as a webcam by using `/dev/video0` as its video file source.
- `wifi_dmenu.sh`: script to connect to an available WiFi network with a dmenu prompt. - `wifi_dmenu.sh`: script to connect to an available WiFi network with a dmenu prompt.

18
vimshot.sh Executable file
View File

@ -0,0 +1,18 @@
#!/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=$(xclip -selection clipboard -out)
# 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
maim --select --hidecursor "$filepath"
notify-send --icon "$filepath" "$basename" "Screenshot saved to: $filepath"