[vimshot.sh]: Merge x11_vimshot.sh and wl_vimshot.sh
This commit is contained in:
@ -34,8 +34,7 @@
|
|||||||
- `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.
|
||||||
- `wl_vimshot.sh`: Wayland 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.
|
|
||||||
of the screenshot via `notify-send`.
|
of the screenshot via `notify-send`.
|
||||||
- `x11_vimshot.sh`: X11 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.
|
|
||||||
|
14
src/wl_vimshot.sh → src/vimshot.sh
Executable file → Normal file
14
src/wl_vimshot.sh → src/vimshot.sh
Executable file → Normal file
@ -3,7 +3,12 @@
|
|||||||
# 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.
|
# 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")
|
basename=$(basename "$0")
|
||||||
filepath=$(wl-paste)
|
|
||||||
|
if [ $(pgrep -x "Xorg") ]; then
|
||||||
|
filepath=$(xclip -selection clipboard -out)
|
||||||
|
else
|
||||||
|
filepath=$(wl-paste)
|
||||||
|
fi
|
||||||
|
|
||||||
# check if the filepath is absolute or relative, and if relative, make absolute
|
# check if the filepath is absolute or relative, and if relative, make absolute
|
||||||
if [ "${filepath#\/}" = "$filepath" ] || [ "${filepath#\~}" = "$filepath" ]; then
|
if [ "${filepath#\/}" = "$filepath" ] || [ "${filepath#\~}" = "$filepath" ]; then
|
||||||
@ -13,6 +18,9 @@ fi
|
|||||||
notify-send "$basename" "Taking screenshot to $filepath"
|
notify-send "$basename" "Taking screenshot to $filepath"
|
||||||
|
|
||||||
sleep 5
|
sleep 5
|
||||||
grim -g "$(slurp)" "$filepath"
|
|
||||||
|
|
||||||
notify-send --icon "$filepath" "$basename" "Screenshot saved to: $filepath"
|
if [ $(pgrep -x "Xorg") ]; then
|
||||||
|
maim --select --hidecursor "$filepath" && notify-send --icon "$filepath" "$basename" "Screenshot saved to: $filepath"
|
||||||
|
else
|
||||||
|
grim -g "$(slurp)" "$filepath" && notify-send --icon "$filepath" "$basename" "Screenshot saved to: $filepath"
|
||||||
|
fi
|
@ -1,16 +0,0 @@
|
|||||||
#!/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"
|
|
Reference in New Issue
Block a user