2

I want to get user's default screenshooter application. Like, in a fresh install Ubuntu, it is gnome-screenshot, or in Xubuntu it is xfce4-screenshooter. Or maybe Distro A's screenshooter is imagemagick's import, I don't know.

How can I check this?

I'm trying to test whether the user has a screenshooter, a screen capture utility. If so, I'll use it and capture screen, for example.

How can I accomplish this?

Radu Rădeanu
  • 169,590

2 Answers2

3

To get the name of the default screenshot tool from terminal you can use the following command:

gsettings get org.compiz.integrated command-screenshot

Otherwise, this Q&A may help you.

Radu Rădeanu
  • 169,590
0

On the different Ubuntu flavors you can use the following command to get the name of the default screenshooter application:

egrep -l -H "(applets-screenshooter|snapshot)" /usr/share/applications/* | grep -oP "^.*/\K(.*?)(?=\.desktop)"

This command looks for desktop applications with the snapshot keyword or the applets-screenshooter icon and outputs only the desktop file name (without the extension).

To use the output for example in a bash script:

$ screenshooter="$(egrep -l -H "(applets-screenshooter|snapshot)" /usr/share/applications/* | grep -oP "^.*/\K(.*?)(?=\.desktop)")"
$ echo $screenshooter
gnome-screenshot
  • I'm sure that my default screenshoter is Shutter. Even like this, your answer give me another two default screenshooters (gnome-screenshot and xfce4-screenshooter). How can be this possible? To have two default screenshooters? – Radu Rădeanu Sep 30 '14 at 17:10
  • @RaduRădeanu Actually I assumed that my command had to be run on a fresh installation. I then checked the .desktop files of gnome-terminal, KSnapshot and xfce4-screenshooter. As shutter is not installed by default I didn't check it. Of course if you install xfce4-screenshooter on stock ubuntu it will also match hence the two results. – Sylvain Pineau Sep 30 '14 at 17:54