You are not logged in.

#1 2012-01-03 07:15:25

YAOMTC
Member
Registered: 2010-02-23
Posts: 204

How can I disable the sound that gnome-screenshot makes? [SOLVED]

Every time I take a screenshot using gnome-screenshot, it makes an annoying camera sound. There's no options available to change that in the GUI or the command line. Any ideas?

EDIT: The file is /usr/share/sounds/freedesktop/stereo/camera-shutter.oga, thanks don_crissti!

Last edited by YAOMTC (2012-01-03 20:35:13)

Offline

#2 2012-01-03 12:21:22

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: How can I disable the sound that gnome-screenshot makes? [SOLVED]

Hack the source code.
Or remove the sound file that it plays?

Offline

#3 2012-01-03 19:15:01

YAOMTC
Member
Registered: 2010-02-23
Posts: 204

Re: How can I disable the sound that gnome-screenshot makes? [SOLVED]

brebs wrote:

Hack the source code.
Or remove the sound file that it plays?

I did some searching and I found this part in gnome-screenshot.c:

static void
play_sound_effect (GdkWindow *window)
{
  ca_context *c;
  ca_proplist *p = NULL;
  int res;

  c = ca_gtk_context_get ();

  res = ca_proplist_create (&p);
  if (res < 0)
    goto done;

  res = ca_proplist_sets (p, CA_PROP_EVENT_ID, "screen-capture");
  if (res < 0)
    goto done;

  res = ca_proplist_sets (p, CA_PROP_EVENT_DESCRIPTION, _("Screenshot taken"));
  if (res < 0)
    goto done;

  if (window != NULL)
    {
      res = ca_proplist_setf (p,
                              CA_PROP_WINDOW_X11_XID,
                              "%lu",
                              (unsigned long) GDK_WINDOW_XID (window));
      if (res < 0)
        goto done;
    }

  ca_context_play_full (c, 0, p, NULL, NULL);

 done:
  if (p != NULL)
    ca_proplist_destroy (p);

}

I don't see a reference to any sound file here, or anywhere else in the file, or in cheese_flash.h (included)... So if I just comment out this function, will it still be able to compile and work? I haven't done this before...

Offline

#4 2012-01-03 20:13:54

don_crissti
Member
Registered: 2009-03-17
Posts: 35

Re: How can I disable the sound that gnome-screenshot makes? [SOLVED]

The sound in question is /usr/share/sounds/freedesktop/stereo/camera-shutter.oga.
Just replace it with your favorite sound (or move it elsewhere if you want no sound at all).

Offline

#5 2012-01-03 20:36:03

YAOMTC
Member
Registered: 2010-02-23
Posts: 204

Re: How can I disable the sound that gnome-screenshot makes? [SOLVED]

Hey thanks! Out of curiosity, how did you find that out?

Offline

#6 2012-01-03 21:04:11

don_crissti
Member
Registered: 2009-03-17
Posts: 35

Re: How can I disable the sound that gnome-screenshot makes? [SOLVED]

smile Let's just say that after 11 years of using Gnome I know a few things about it...

Offline

Board footer

Powered by FluxBB