src/shell-screenshot.c: Fetch the screenshot directory from GSettings
When the PrintScrn
key is pressed in GNOME Shell, it takes a screenshot and writes it to $HOME/Pictures
, or otherwise falling back to $HOME
if that directory is not found. The gnome-screenshot
tool does a similar action, but also checks for the existence of the auto-save-directory
gsetting in org.gnome.gnome-screenshot
. This will allow GNOME Shell to also use that key, and store screenshots in this location when found.
Testing
- Before applying the patch, take a screenshot with the PrintScrn key.
- A screenshot should now be stored in
$HOME/Pictures
. - Create the new screenshot directory, and set the value for gnome-screenshot:
mkdir $HOME/Screenshots
gsettings set org.gnome.gnome-screenshot auto-save-directory $HOME/Screenshots
- Take the screenshot again, and notice that it stores in
$HOME/Pictures
instead of$HOME/Screenshots
- Apply the patch, and restart
gnome-shell
, then take the screenshot again - The screenshot should be written in
$HOME/Screenshots
instead of$HOME/Pictures
. - Delete the gsettings value, and try again, to see that it returns to storing screenshots in
$HOME/Pictures
gsettings reset org.gnome.gnome-screenshot auto-save-directory
Edited by Michael Aaron Murphy