[wl_screenshot.sh]: Add wl_screenshot.sh
This commit is contained in:
@ -34,5 +34,6 @@
|
|||||||
- `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.
|
- `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_screenshot.sh`: screenshot script for Wayland with selection using `grim` & `slurp` that both saves the image file and adds the image to the `wl-copy` clipboard, and notifies the user of the screenshot via `notify-send`.
|
||||||
- `x11_screenshot.sh`: screenshot script for X11 with selection using `maim` that both saves the image file and adds the image to the `xclip` clipboard, and notifies the user
|
- `x11_screenshot.sh`: screenshot script for X11 with selection using `maim` that both saves the image file and adds the image to the `xclip` clipboard, and notifies the user
|
||||||
of the screenshot via `notify-send`.
|
of the screenshot via `notify-send`.
|
||||||
|
13
wl_screenshot.sh
Executable file
13
wl_screenshot.sh
Executable file
@ -0,0 +1,13 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# Screenshot script with selection using grim and slurp.
|
||||||
|
#
|
||||||
|
filepath="$HOME/media/images/screenshots/$(date +%Y-%m-%d\ %H:%M:%S).png"
|
||||||
|
grim -g "$(slurp)" - | tee "$filepath" | wl-copy
|
||||||
|
|
||||||
|
# if screenshot is cancelled, tee will create an empty file, so checking if the file is empty
|
||||||
|
if [ -s "$filepath" ]; then
|
||||||
|
# send notification with a thumbnail of the screenshot taken, the name of the script, and the filepath
|
||||||
|
notify-send --icon "$filepath" "$(basename "$0")" "Screenshot saved to: $filepath"
|
||||||
|
else
|
||||||
|
rm "$filepath"
|
||||||
|
fi
|
Reference in New Issue
Block a user