aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/service.vala14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/service.vala b/src/service.vala
index 0c82538..488b993 100644
--- a/src/service.vala
+++ b/src/service.vala
@@ -97,12 +97,16 @@ public class IndicatorSound.Service: Object {
/* Hide the notification when the menu is shown */
var shown_action = actions.lookup_action ("indicator-shown") as SimpleAction;
shown_action.change_state.connect ((state) => {
- if (state.get_boolean()) {
+ block_notifications = state.get_boolean();
+ if (block_notifications) {
+ debug("Indicator is shown");
try {
sync_notification.close();
} catch (Error e) {
warning("Unable to close synchronous volume notification: %s", e.message);
}
+ } else {
+ debug("Indicator is hidden");
}
});
@@ -216,6 +220,8 @@ public class IndicatorSound.Service: Object {
string cmd;
if (env == "xubuntu" || env == "ubuntustudio")
cmd = "pavucontrol";
+ else if (env == "mate")
+ cmd = "mate-volume-control";
else
{
if (Environment.get_variable ("XDG_CURRENT_DESKTOP") == "Unity" && Environment.find_program_in_path ("unity-control-center") != null)
@@ -280,6 +286,7 @@ public class IndicatorSound.Service: Object {
private bool check_sync_notification = false;
private bool support_sync_notification = false;
+ private bool block_notifications = false;
void update_sync_notification () {
if (!check_sync_notification) {
@@ -294,8 +301,7 @@ public class IndicatorSound.Service: Object {
if (!support_sync_notification)
return;
- var shown_action = actions.lookup_action ("indicator-shown") as SimpleAction;
- if (shown_action != null && shown_action.get_state().get_boolean())
+ if (block_notifications)
return;
/* Determine Label */
@@ -322,7 +328,7 @@ public class IndicatorSound.Service: Object {
/* Put it all into the notification */
sync_notification.clear_hints ();
sync_notification.update (_("Volume"), volume_label, icon);
- sync_notification.set_hint ("value", (int32)Math.round(volume_control.volume.volume * 100.0));
+ sync_notification.set_hint ("value", (int32)Math.round(volume_control.volume.volume / this.max_volume * 100.0));
sync_notification.set_hint ("x-canonical-value-bar-tint", tint);
sync_notification.set_hint ("x-canonical-private-synchronous", "true");
sync_notification.set_hint ("x-canonical-non-shaped-icon", "true");