[screenshot.sh]: Merge wl_screenshot.sh and x11_screenshot.sh

This commit is contained in:
2025-01-28 04:25:03 +00:00
parent 8d7b3c4b0f
commit 2f099e145b
3 changed files with 9 additions and 17 deletions

View File

@ -27,6 +27,7 @@
- `qutebrowser_search.sh`: script that finds all the search engines defined in the qutebrowser `config.py` configuration file and makes them available for - `qutebrowser_search.sh`: script that finds all the search engines defined in the qutebrowser `config.py` configuration file and makes them available for
searching via dmenu, i.e. allow web searching with qutebrowser without having to wait for it to start up before you start your search. searching via dmenu, i.e. allow web searching with qutebrowser without having to wait for it to start up before you start your search.
- `repos_checker.sh`: script to find all of the Git repositories in the current directory & its sub-directories and display each found repository's `git status`. - `repos_checker.sh`: script to find all of the Git repositories in the current directory & its sub-directories and display each found repository's `git status`.
- `screenshot.sh`: screenshot script for both Xorg and Wayland with selection that both saves the image file and adds the image to the clipboard, and notifies the user via `notify-send`.
- `stdin_to_notis.sh`: scripts that reads from `stdin` and sends each line as a system notification. - `stdin_to_notis.sh`: scripts that reads from `stdin` and sends each line as a system notification.
Intended for use when a program that outputs to `stdout` is called from a non-terminal or graphical program, making the `stdout` output inaccessible. Intended for use when a program that outputs to `stdout` is called from a non-terminal or graphical program, making the `stdout` output inaccessible.
The output can instead be piped into this script to make it readable as a system notification. The output can instead be piped into this script to make it readable as a system notification.
@ -35,8 +36,6 @@
laptop to my phone. laptop to my phone.
- `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`.
- `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. - `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.
- `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`.
- `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. - `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.

View File

@ -1,8 +1,13 @@
#!/bin/sh #!/bin/sh
# Screenshot script with selection using grim and slurp. # Script to take a selection screenshot on both Xorg and Wayland
#
filepath="$HOME/media/images/screenshots/$(date +%Y-%m-%d\ %H:%M:%S).png" filepath="$HOME/media/images/screenshots/$(date +%Y-%m-%d\ %H:%M:%S).png"
grim -g "$(slurp)" - | tee "$filepath" | wl-copy
if [ $(pgrep -x "Xorg") ]; then
maim --select --hidecursor | tee "$filepath" | xclip -selection clipboard -target image/png
else
grim -g "$(slurp)" - | tee "$filepath" | wl-copy
fi
# if screenshot is cancelled, tee will create an empty file, so checking if the file is empty # if screenshot is cancelled, tee will create an empty file, so checking if the file is empty
if [ -s "$filepath" ]; then if [ -s "$filepath" ]; then

View File

@ -1,12 +0,0 @@
#!/bin/sh
# Screenshot script with selection using maim and notification.
filepath="$HOME/media/images/screenshots/$(date +%Y-%m-%d\ %H:%M:%S).png"
maim --select --hidecursor | tee "$filepath" | xclip -selection clipboard -target image/png
# if maim 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