Last active
June 21, 2024 21:50
-
-
Save Andrew-Pynch/a8d3231852eb744e32abca8ef33589af to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# make sure to install dependencies | |
# sudo apt-get install maim xclip | |
# if you want to make this action hotkeyable add the following lines to your | |
# .zshrc or .bashrc file | |
# alias segmented_screenshot='~/Linux-Setup-Scripts/scripts/take_segmented_screenshot.sh' | |
# bindkey -s '^x' 'segmented_screenshot\n' # this will bind segmented screenshot to ctrl + x | |
# bindsym Mod4+Shift+s exec ~/Linux-Setup-Scripts/scripts/take_segmented_screenshot.sh # binding for i3 | |
# Take a screenshot of a selected area and save it to a temporary file | |
temp_file="/tmp/screenshot_$(date +%s).png" | |
maim -s "$temp_file" | |
# Check if the screenshot was taken successfully | |
if [ $? -eq 0 ]; then | |
# Copy the image to clipboard | |
xclip -selection clipboard -t image/png -i "$temp_file" | |
echo "Screenshot taken and copied to clipboard" | |
# Optionally, remove the temporary file | |
rm "$temp_file" | |
else | |
echo "Failed to take screenshot" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment