Skip to content
The Chat Archive
gpt-3.5-turbo-0613· OpenAI WildChat-4.8M (AI2)

I've installed shotgun and slop for taking screenshots. Write bash script that'll use…

  1. User

    I've installed shotgun and slop for taking screenshots. Write bash script that'll use that utilities, save screenshot to path $HOME/Media/"$(now)".png and save it to the clipboard

  2. Assistant

    Sure! Here's a bash script that uses shotgun and slop to 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.sh
    

    You can now run the script by executing ./screenshot_script.sh in 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, and xclip installed and accessible in your system.