diff options
-rw-r--r-- | data/org.mate.SettingsDaemon.plugins.media-keys.gschema.xml.in | 15 | ||||
-rw-r--r-- | plugins/media-keys/acme.h | 6 | ||||
-rw-r--r-- | plugins/media-keys/msd-media-keys-manager.c | 31 |
3 files changed, 47 insertions, 5 deletions
diff --git a/data/org.mate.SettingsDaemon.plugins.media-keys.gschema.xml.in b/data/org.mate.SettingsDaemon.plugins.media-keys.gschema.xml.in index 8cea9ee..8983272 100644 --- a/data/org.mate.SettingsDaemon.plugins.media-keys.gschema.xml.in +++ b/data/org.mate.SettingsDaemon.plugins.media-keys.gschema.xml.in @@ -40,6 +40,21 @@ <summary>Volume up</summary> <description>Binding to raise the system volume.</description> </key> + <key name="volume-mute-quiet" type="s"> + <default>'<Alt>XF86AudioMute'</default> + <summary>Mute the audio quietly</summary> + <description>Binding to mute the system volume quietly.</description> + </key> + <key name="volume-down-quiet" type="s"> + <default>'<Alt>XF86AudioLowerVolume'</default> + <summary>Turn the volume down quietly</summary> + <description>Binding to lower the system volume quietly.</description> + </key> + <key name="volume-up-quiet" type="s"> + <default>'<Alt>XF86AudioRaiseVolume'</default> + <summary>Turn the volume up quietly</summary> + <description>Binding to raise the system volume quietly.</description> + </key> <key name="power" type="s"> <default>'<Control><Alt>Delete'</default> <summary>Shut down</summary> diff --git a/plugins/media-keys/acme.h b/plugins/media-keys/acme.h index 8ab55fe..8d6aba2 100644 --- a/plugins/media-keys/acme.h +++ b/plugins/media-keys/acme.h @@ -32,6 +32,9 @@ enum { MUTE_KEY, VOLUME_DOWN_KEY, VOLUME_UP_KEY, + MUTE_QUIET_KEY, + VOLUME_DOWN_QUIET_KEY, + VOLUME_UP_QUIET_KEY, POWER_KEY, EJECT_KEY, HOME_KEY, @@ -74,6 +77,9 @@ static struct { { MUTE_KEY, "volume-mute", NULL, NULL }, { VOLUME_DOWN_KEY, "volume-down", NULL, NULL }, { VOLUME_UP_KEY, "volume-up", NULL, NULL }, + { MUTE_QUIET_KEY, "volume-mute-quiet", NULL, NULL }, + { VOLUME_DOWN_QUIET_KEY, "volume-down-quiet", NULL, NULL }, + { VOLUME_UP_QUIET_KEY, "volume-up-quiet", NULL, NULL }, { POWER_KEY, "power", NULL, NULL }, { EJECT_KEY, "eject", NULL, NULL }, { HOME_KEY, "home", NULL, NULL }, diff --git a/plugins/media-keys/msd-media-keys-manager.c b/plugins/media-keys/msd-media-keys-manager.c index a4e958a..33ac891 100644 --- a/plugins/media-keys/msd-media-keys-manager.c +++ b/plugins/media-keys/msd-media-keys-manager.c @@ -634,7 +634,8 @@ static void update_dialog (MsdMediaKeysManager *manager, guint volume, gboolean muted, - gboolean sound_changed) + gboolean sound_changed, + gboolean quiet) { if (muted) volume = 0.0; @@ -651,7 +652,7 @@ update_dialog (MsdMediaKeysManager *manager, dialog_show (manager); #ifdef HAVE_LIBCANBERRA - if (sound_changed != FALSE && muted == FALSE) + if (quiet == FALSE && sound_changed != FALSE && muted == FALSE) ca_gtk_play_for_widget (manager->priv->dialog, 0, CA_PROP_EVENT_ID, "audio-volume-change", CA_PROP_EVENT_DESCRIPTION, "Volume changed through key press", @@ -663,7 +664,9 @@ update_dialog (MsdMediaKeysManager *manager, } static void -do_sound_action (MsdMediaKeysManager *manager, int type) +do_sound_action (MsdMediaKeysManager *manager, + int type, + gboolean quiet) { gboolean muted; gboolean muted_last; @@ -735,7 +738,8 @@ do_sound_action (MsdMediaKeysManager *manager, int type) update_dialog (manager, CLAMP (100 * volume / (volume_max - volume_min), 0, 100), muted, - sound_changed); + sound_changed, + quiet); } static void @@ -1099,7 +1103,22 @@ do_action (MsdMediaKeysManager *manager, case VOLUME_DOWN_KEY: case VOLUME_UP_KEY: #ifdef HAVE_LIBMATEMIXER - do_sound_action (manager, type); + do_sound_action (manager, type, FALSE); +#endif + break; + case MUTE_QUIET_KEY: +#ifdef HAVE_LIBMATEMIXER + do_sound_action (manager, MUTE_KEY, TRUE); +#endif + break; + case VOLUME_DOWN_QUIET_KEY: +#ifdef HAVE_LIBMATEMIXER + do_sound_action (manager, VOLUME_DOWN_KEY, TRUE); +#endif + break; + case VOLUME_UP_QUIET_KEY: +#ifdef HAVE_LIBMATEMIXER + do_sound_action (manager, VOLUME_UP_KEY, TRUE); #endif break; case POWER_KEY: @@ -1250,6 +1269,8 @@ acme_filter_events (GdkXEvent *xevent, switch (keys[i].key_type) { case VOLUME_DOWN_KEY: case VOLUME_UP_KEY: + case VOLUME_DOWN_QUIET_KEY: + case VOLUME_UP_QUIET_KEY: /* auto-repeatable keys */ if (xev->type != KeyPress) { return GDK_FILTER_CONTINUE; |