Skip to content

Instantly share code, notes, and snippets.

@jjaimealeman
Last active October 25, 2021 01:50
Show Gist options
  • Save jjaimealeman/209741ae4dda4f5ae9483a7773dc5ee7 to your computer and use it in GitHub Desktop.
Save jjaimealeman/209741ae4dda4f5ae9483a7773dc5ee7 to your computer and use it in GitHub Desktop.
A simple bash screenshot script that writes my filename as I like.
#!/bin/bash
# learning to version control my gists
# /home/jammo/Pictures/myscrot.sh
# Sun Oct 24 06:09:37 PM MDT 2021
# I recently came across a default configuration in Pop OS 21.01 that I wanted to change.
# https://www.reddit.com/r/pop_os/comments/qdzj3h/how_can_i_change_the_default_screenshot_filename/
#
# I was unable to successfully make any edits using 'dconf-editor' because the setting doesn't exit.
#
# So I decided to make my own bash script and it works as I wanted.
#
# REQUIREMENTS!!!
# These came by default with Pop OS
# 'scrot - command line screen capture utility'
# 'ImageMagick - is a free software suite for the creation, modification and display of bitmap images.'
# 'eog - a GNOME image viewer'
#
# chmod a+x myscrot.sh
# sudo cp myscrot.sh /usr/local/bin/
#
# And then call it from within your terminal.
#
myscrot() {
echo What area do you want your screenshot of?
PS3='Select a screenshot option: '
scroptions=("Both Monitors" "Active Window" "Selection")
select size in "${scroptions[@]}"
do
case $size in
"Both Monitors")
echo "Your chose: $size."
# scrot '%Y%m%d_%H%M%S_$wx$h.png' -e 'mv $f $HOME/screenshots/'
scrot -p "$HOME"/Pictures/screenshots/'%Y%m%d_%H%M%S_$wx$h.png' -e 'convert -bordercolor white -border 7 $f $f; eog $f'
break
;;
"Active Window")
echo "Your chose: $size."
scrot -upd 2 -c "$HOME"/Pictures/screenshots/'%Y%m%d_%H%M%S_$wx$h.png' -e 'convert -bordercolor white -border 5 $f $f; eog $f'
break
;;
"Selection")
echo "Your chose: $size."
scrot -s "$HOME"/Pictures/screenshots/'%Y%m%d_%H%M%S_$wx$h.png' -e 'convert -bordercolor white -border 3 $f $f; eog $f'
break
;;
*) echo "You chose $REPLY? That's not an option!";
esac
done
}
myscrot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment