I think I spoke too soon, as I only looked at the options available without testing them...
So, with the interactive window, I can copy the screenshot to the clipboard without issues. However, the command line option -c
or --clipboard
doesn't seem to work at all. Looking a bit more into it, it seems this has been an ongoing issue since Ubuntu 18.04, and it's likely not going to be addressed at this point since Gnome has moved forward with their new implementation.
In that case, I have to agree that the snippet of code you used is the best (and only?) choice to mimic the behavior that you're after. But I still would like to offer an alternative to improve upon that a little bit:
- bash -c "gnome-screenshot -af ~/Pictures/Screenshots/_custom_screenshot && xclip ~/Pictures/Screenshots/_custom_screenshot -selection clipboard -target image/png; rm ~/Pictures/Screenshots/_custom_screenshot
+ bash -c 'gnome-screenshot -af "$XDG_RUNTIME_DIR"/_custom_screenshot && xclip "$XDG_RUNTIME_DIR"/_custom_screenshot -selection clipboard -target image/png; rm "$XDG_RUNTIME_DIR"/_custom_screenshot'
The $XDG_RUNTIME_DIR
is a special directory that exists only in RAM. This will be faster — admittedly, for such a simple operation there's not a lot of room for noticeable improvement — but more importantly it won't write anything to disk.