I've installed shotgun and slop for taking screenshots. Write bash script that'll use…
- User
I've installed
shotgunandslopfor taking screenshots. Write bash script that'll use that utilities, save screenshot to path$HOME/Media/"$(now)".pngand save it to the clipboard - Assistant
Sure! Here's a bash script that uses
shotgunandslopto take a screenshot, save it to a specified path, and save it to the clipboard:#!/bin/bash # Set the path where the screenshot will be saved save_path="$HOME/Media/$(date +%Y%m%d%H%M%S).png" # Take the screenshot using shotgun and slop shotgun -g "$(slop -f '-%x-%y %wx%h')" "$save_path" # Save the screenshot to the clipboard xclip -selection clipboard -t image/png -i "$save_path" echo "Screenshot saved to $save_path and copied to clipboard."Save the above script to a file, for example,
screenshot_script.sh. Then make the script executable with the following command:chmod +x screenshot_script.shYou can now run the script by executing
./screenshot_script.shin your terminal. It will capture a screenshot based on the area selected using the mouse, save it to the specified path ($HOME/Media/YYYYMMDDHHMMSS.png), and copy it to your clipboard.Make sure you have
shotgun,slop, andxclipinstalled and accessible in your system.