Here's mine. I expanded on n.st's answer.
Create a shell script to call gnome-screenshot
Save this to the file: /usr/bin/area_screenshot
You may need to use sudo
. So use vi
to create it.
sudo vi /usr/bin/area_screenshot
Copy the code below into it.
#!/bin/bash
screenshot_dir="$HOME/Documents/screenshot"
current_year_dir="$screenshot_dir/$(date +%Y)"
current_month_dir="$current_year_dir/$(date +%Y_%m)"
fileout="$current_month_dir/$(date +%Y_%m%d_%H%M%S).png"
# Step 1: Check for screenshot directory
[ -d "$screenshot_dir" ] || mkdir "$screenshot_dir"
# Step 2: Check year and month directory
[ -d "$current_year_dir" ] || mkdir "$current_year_dir"
[ -d "$current_month_dir" ] || mkdir "$current_month_dir"
# Step 3: Take area screenshot, and save to the current month
[ -d "$current_month_dir" ] && /usr/bin/gnome-screenshot -a -f "$fileout" $@
Then, mark the file as executable.
chmod ugo+x /usr/bin/area_screenshot
Then, in your keyboard shortcuts, set area_screenshot
to the Printscreen
button. You will need to create a custom shortcut for this (maybe someone else can link an example to do this).
What does this do?
It will create a screenshot at HOME/Documents/YEAR/YEAR_MONTH/filex.png
.
Where filex.png
is in the format YYYY_MMDD_HHMMSS.png
. So for example, 2019_1220_121314.png
.
How is this helpful?
I find this technique is quite useful to take screenshots of comments and articles. Over time, I capture a lot, so it's very convenient to get it automatically categorized into subfolders. Then over the years, they keep accumulating, and the year
subfolder keeps it nicely organized. I tend to put the current month in my favorites link (in Windows), and manually update it every month, as I usually only need to look at the current month.
It would be great if Ubuntu, Fedora, etc., made something like this as the standard on Linux. Please take my code example, and make it so! It would help everyone by keeping their screenshots nicely organized.