summaryrefslogtreecommitdiff
blob: 9b2f131bcee2d22b5f128494f7ed39ecaa81d2f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
 plugins/common/Makefile.am                  |    9 +-
 plugins/common/gsd-osd-notification.c       |  296 +++++++++++++++++++++++++++
 plugins/common/gsd-osd-notification.h       |   75 +++++++
 plugins/media-keys/gsd-media-keys-manager.c |  106 +++++++---
 4 files changed, 456 insertions(+), 30 deletions(-)

diff --git a/plugins/common/Makefile.am b/plugins/common/Makefile.am
index 447d02d..94ad74f 100644
--- a/plugins/common/Makefile.am
+++ b/plugins/common/Makefile.am
@@ -7,17 +7,22 @@ libcommon_la_SOURCES = \
 	gsd-keygrab.c		\
 	gsd-keygrab.h		\
 	gsd-osd-window.c	\
-	gsd-osd-window.h
+	gsd-osd-window.h	\
+	gsd-osd-notification.c	\
+	gsd-osd-notification.h
 
 libcommon_la_CPPFLAGS = \
 	$(AM_CPPFLAGS)
 
 libcommon_la_CFLAGS = \
 	$(SETTINGS_PLUGIN_CFLAGS)	\
+	$(LIBNOTIFY_CFLAGS)		\
 	$(AM_CFLAGS)
 
 libcommon_la_LDFLAGS = \
 	$(GSD_PLUGIN_LDFLAGS) $(X11_LIBS)
 
 libcommon_la_LIBADD  = \
-	$(SETTINGS_PLUGIN_LIBS)
+	$(SETTINGS_PLUGIN_LIBS) \
+	$(LIBNOTIFY_LIBS)
+
diff --git a/plugins/common/gsd-osd-notification.c b/plugins/common/gsd-osd-notification.c
new file mode 100644
index 0000000..8ebc5a5
--- /dev/null
+++ b/plugins/common/gsd-osd-notification.c
@@ -0,0 +1,296 @@
+/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 8; tab-width: 8 -*- */
+/*
+ * gsd-osd-notification.c
+ * Copyright (C) 2010 Chris Coulson <chrisccoulson@ubuntu.com>
+ * Copyright (C) 2009 Canonical Ltd
+ * 
+ * gsd-osd-notification.c is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ * 
+ * gsd-osd-notification.c is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License along
+ * with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <libnotify/notify.h>
+#include "gsd-osd-notification.h"
+
+struct _GsdOsdNotificationPrivate
+{
+        NotifyNotification *notification;
+        char **icon_names;
+        char *hint;
+        guint icon_array_size;
+};
+
+#define GSD_OSD_NOTIFICATION_PRIVATE(o)  (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSD_TYPE_OSD_NOTIFICATION, GsdOsdNotificationPrivate))
+
+enum
+{
+	PROP_0,
+	PROP_ICON_NAMES,
+        PROP_HINT
+};
+
+static NotifyNotification *icon_only_notification = NULL;
+static gulong handler_id;
+
+#define NOTIFY_CAP_PRIVATE_SYNCHRONOUS "x-canonical-private-synchronous"
+#define NOTIFY_CAP_PRIVATE_ICON_ONLY "x-canonical-private-icon-only"
+#define NOTIFY_HINT_TRUE "true"
+
+G_DEFINE_TYPE (GsdOsdNotification, gsd_osd_notification, G_TYPE_OBJECT);
+
+static const char*
+_calculate_icon (GsdOsdNotification *notifier, guint value, gboolean muted)
+{
+        guint s;
+
+        s = (notifier->priv->icon_array_size -1) * value / 100 + 1;
+        s = MAX (s, 1);
+        s = MIN (s, notifier->priv->icon_array_size -1);
+        if (value <= 0)
+                s = 0;
+
+        return muted ? notifier->priv->icon_names[0] : notifier->priv->icon_names[s];
+}
+
+void
+gsd_osd_notification_set_icon_array (GsdOsdNotification *notifier, const char **icon_names)
+{
+        g_return_if_fail (GSD_IS_OSD_NOTIFICATION (notifier));
+
+        g_strfreev (notifier->priv->icon_names);
+        notifier->priv->icon_names = g_strdupv ((gchar **) icon_names);
+
+        notifier->priv->icon_array_size = g_strv_length ((gchar **) icon_names);
+}
+
+void
+gsd_osd_notification_set_hint (GsdOsdNotification *notifier, const char *hint)
+{
+        g_return_if_fail (GSD_IS_OSD_NOTIFICATION (notifier));
+
+        g_free (notifier->priv->hint);
+        notifier->priv->hint = g_strdup (hint);
+}
+
+gboolean
+gsd_osd_notification_is_supported (void)
+{
+        GList *caps;
+        gboolean has_cap;
+
+        caps = notify_get_server_caps ();
+        has_cap = (g_list_find_custom (caps, NOTIFY_CAP_PRIVATE_SYNCHRONOUS, (GCompareFunc) g_strcmp0) != NULL);
+        g_list_foreach (caps, (GFunc) g_free, NULL);
+        g_list_free (caps);
+
+        return has_cap;
+}
+
+static void
+notification_closed_cb (NotifyNotification *notification,
+                        gpointer data)
+{
+        g_signal_handler_disconnect (icon_only_notification, handler_id);
+        g_object_unref (icon_only_notification);
+        icon_only_notification = NULL;        
+}
+
+gboolean
+gsd_osd_notification_show_icon_only (const char *icon, const char *hint)
+{
+        g_return_val_if_fail (icon != NULL, FALSE);
+        g_return_val_if_fail (hint != NULL, FALSE);
+
+        if (!gsd_osd_notification_is_supported ())
+                return FALSE;
+
+        if (icon_only_notification == NULL) {
+                icon_only_notification = notify_notification_new (" ", "", icon, NULL);
+                notify_notification_set_hint_string (icon_only_notification, NOTIFY_CAP_PRIVATE_SYNCHRONOUS, hint);
+                notify_notification_set_hint_string (icon_only_notification, NOTIFY_CAP_PRIVATE_ICON_ONLY, NOTIFY_HINT_TRUE);
+                handler_id = g_signal_connect (icon_only_notification, "closed", G_CALLBACK (notification_closed_cb), NULL);
+        } else {
+                notify_notification_set_hint_string (icon_only_notification, NOTIFY_CAP_PRIVATE_SYNCHRONOUS, hint);
+                notify_notification_update (icon_only_notification, " ", "", icon);
+        }
+
+        if (!notify_notification_show (icon_only_notification, NULL)) {
+                g_signal_handler_disconnect (icon_only_notification, handler_id);
+                g_object_unref (icon_only_notification);
+                icon_only_notification = NULL;
+                return FALSE;
+        }
+
+        return TRUE;
+}
+
+gboolean
+gsd_osd_notification_show_value (GsdOsdNotification *notifier, gint value, gboolean muted)
+{
+        const char *icon;
+
+        g_return_val_if_fail (GSD_IS_OSD_NOTIFICATION (notifier), FALSE);
+        g_return_val_if_fail (notifier->priv->icon_names != NULL, FALSE);
+        g_return_val_if_fail (notifier->priv->hint != NULL, FALSE);
+
+        if (!gsd_osd_notification_is_supported ())
+                return FALSE;
+
+        if (notifier->priv->notification == NULL) {
+                notifier->priv->notification = notify_notification_new (" ", "", NULL, NULL);
+                notify_notification_set_hint_string (notifier->priv->notification, NOTIFY_CAP_PRIVATE_SYNCHRONOUS, notifier->priv->hint);
+}
+        if (notifier->priv->notification != NULL) {
+                value = MIN (value, 101);
+                value = MAX (value, -1);
+                icon = _calculate_icon (notifier, value, muted);
+                notify_notification_set_hint_int32(notifier->priv->notification, "value", (muted && value > 0) ? 0 : value);
+                notify_notification_update (notifier->priv->notification, " ", "", icon);
+        } else {
+                return FALSE;
+        }
+
+        if (!notify_notification_show (notifier->priv->notification, NULL))
+                return FALSE;
+
+        return TRUE;
+}
+
+gboolean
+gsd_osd_notification_show_overshoot (GsdOsdNotification *notifier, GsdOsdNotifierOvershootType type)
+{
+        gint value;
+        gboolean muted;
+
+        g_return_val_if_fail (type == GSD_OSD_NOTIFICATION_UNDERSHOOT || type == GSD_OSD_NOTIFICATION_OVERSHOOT, FALSE);
+
+        switch (type)
+        {
+        case GSD_OSD_NOTIFICATION_UNDERSHOOT:
+                value = -1;
+                muted = TRUE;
+                break;
+        case GSD_OSD_NOTIFICATION_OVERSHOOT:
+                value = 101;
+                muted = FALSE;
+                break;
+        default:
+                g_assert_not_reached ();
+                break;
+        }
+
+        return gsd_osd_notification_show_value (notifier, value, muted);
+}
+
+GsdOsdNotification*
+gsd_osd_notification_new (const char **icon_names, const char *hint)
+{
+        return (GsdOsdNotification *) g_object_new (GSD_TYPE_OSD_NOTIFICATION,
+                                                    "icon-names", icon_names,
+                                                    "hint", hint,
+                                                    NULL);
+}
+
+static void
+gsd_osd_notification_init (GsdOsdNotification *object)
+{
+        object->priv = GSD_OSD_NOTIFICATION_PRIVATE (object);
+
+        if (!notify_is_initted ())
+                notify_init (g_get_application_name ());
+
+        object->priv->hint = NULL;
+        object->priv->icon_names = NULL;
+        object->priv->notification = NULL;
+}
+
+static void
+gsd_osd_notification_finalize (GObject *object)
+{
+        GsdOsdNotification *notifier = GSD_OSD_NOTIFICATION (object);
+
+        g_strfreev (notifier->priv->icon_names);
+        g_free (notifier->priv->hint);
+
+        if (notifier->priv->notification)
+                g_object_unref (notifier->priv->notification);
+
+        G_OBJECT_CLASS (gsd_osd_notification_parent_class)->finalize (object);
+}
+
+static void
+gsd_osd_notification_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
+{
+	g_return_if_fail (GSD_IS_OSD_NOTIFICATION (object));
+        GsdOsdNotification *notifier = GSD_OSD_NOTIFICATION (object);
+
+	switch (prop_id)
+	{
+	case PROP_ICON_NAMES:
+		gsd_osd_notification_set_icon_array (notifier, (const char**) g_value_get_boxed (value));
+		break;
+        case PROP_HINT:
+                gsd_osd_notification_set_hint (notifier, g_value_get_string (value));
+                break;
+	default:
+		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+		break;
+	}
+}
+
+static void
+gsd_osd_notification_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
+{
+	g_return_if_fail (GSD_IS_OSD_NOTIFICATION (object));
+        GsdOsdNotification *notifier = GSD_OSD_NOTIFICATION (object);
+
+	switch (prop_id)
+	{
+	case PROP_ICON_NAMES:
+		g_value_set_boxed (value, notifier->priv->icon_names);
+		break;
+        case PROP_HINT:
+                g_value_set_string (value, notifier->priv->hint);
+                break;
+	default:
+		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+		break;
+	}
+}
+
+static void
+gsd_osd_notification_class_init (GsdOsdNotificationClass *klass)
+{
+        GObjectClass* object_class = G_OBJECT_CLASS (klass);
+
+        object_class->finalize = gsd_osd_notification_finalize;
+	object_class->set_property = gsd_osd_notification_set_property;
+	object_class->get_property = gsd_osd_notification_get_property;
+
+	g_object_class_install_property (object_class,
+	                                 PROP_ICON_NAMES,
+	                                 g_param_spec_boxed ("icon-names",
+	                                                     "Icon name array",
+	                                                     "An array of icon names for the notification",
+	                                                     G_TYPE_STRV,
+	                                                     G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
+
+        g_object_class_install_property (object_class,
+	                                 PROP_HINT,
+	                                 g_param_spec_string ("hint",
+	                                                     "Notification hint",
+	                                                     "Hint for the notification",
+	                                                     NULL,
+	                                                     G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
+
+        g_type_class_add_private (klass, sizeof (GsdOsdNotificationPrivate));
+}
diff --git a/plugins/common/gsd-osd-notification.h b/plugins/common/gsd-osd-notification.h
new file mode 100644
index 0000000..8205639
--- /dev/null
+++ b/plugins/common/gsd-osd-notification.h
@@ -0,0 +1,75 @@
+/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 8; tab-width: 8 -*- */
+/*
+ * gsd-osd-notification.c
+ * Copyright (C) 2010 Chris Coulson <chrisccoulson@ubuntu.com>
+ * Copyright (C) 2009 Canonical Ltd
+ * 
+ * gsd-osd-notification.c is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ * 
+ * gsd-osd-notification.c is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License along
+ * with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef _GSD_OSD_NOTIFICATION_H_
+#define _GSD_OSD_NOTIFICATION_H_
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define GSD_TYPE_OSD_NOTIFICATION             (gsd_osd_notification_get_type ())
+#define GSD_OSD_NOTIFICATION(obj)             (G_TYPE_CHECK_INSTANCE_CAST ((obj), GSD_TYPE_OSD_NOTIFICATION, GsdOsdNotification))
+#define GSD_OSD_NOTIFICATION_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST ((klass), GSD_TYPE_OSD_NOTIFICATION, GsdOsdNotificationClass))
+#define GSD_IS_OSD_NOTIFICATION(obj)          (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GSD_TYPE_OSD_NOTIFICATION))
+#define GSD_IS_OSD_NOTIFICATION_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE ((klass), GSD_TYPE_OSD_NOTIFICATION))
+#define GSD_OSD_NOTIFICATION_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), GSD_TYPE_OSD_NOTIFICATION, GsdOsdNotificationClass))
+
+typedef struct _GsdOsdNotificationClass GsdOsdNotificationClass;
+typedef struct _GsdOsdNotification GsdOsdNotification;
+typedef struct _GsdOsdNotificationPrivate GsdOsdNotificationPrivate;
+
+struct _GsdOsdNotificationClass
+{
+        GObjectClass parent_class;
+};
+
+struct _GsdOsdNotification
+{
+        GObject parent_instance;
+
+        GsdOsdNotificationPrivate *priv;
+};
+
+typedef enum {
+        GSD_OSD_NOTIFICATION_NO_OVERSHOOT = 0,
+        GSD_OSD_NOTIFICATION_UNDERSHOOT,
+        GSD_OSD_NOTIFICATION_OVERSHOOT,
+} GsdOsdNotifierOvershootType;
+
+GType                   gsd_osd_notification_get_type           (void) G_GNUC_CONST;
+GsdOsdNotification*     gsd_osd_notification_new                (const char                 **icon_names,
+                                                                 const char                  *hint);
+void                    gsd_osd_notification_set_icon_array     (GsdOsdNotification          *notifier, 
+                                                                 const char                 **icon_names);
+void                    gsd_osd_notification_set_hint           (GsdOsdNotification          *notifier,
+                                                                 const char                  *hint);
+gboolean                gsd_osd_notification_is_supported       (void);
+gboolean                gsd_osd_notification_show_value         (GsdOsdNotification          *notifier,
+                                                                 gint                        value,
+                                                                 gboolean                     muted);
+gboolean                gsd_osd_notification_show_overshoot     (GsdOsdNotification          *notifier,
+                                                                 GsdOsdNotifierOvershootType  type);
+gboolean                gsd_osd_notification_show_icon_only     (const char                  *icon,
+                                                                 const char                  *hint);
+
+G_END_DECLS
+
+#endif /* _GSD_OSD_NOTIFICATION_H_ */
diff --git a/plugins/media-keys/gsd-media-keys-manager.c b/plugins/media-keys/gsd-media-keys-manager.c
index 64893b5..ef977f0 100644
--- a/plugins/media-keys/gsd-media-keys-manager.c
+++ b/plugins/media-keys/gsd-media-keys-manager.c
@@ -49,6 +49,7 @@
 #include "eggaccelerators.h"
 #include "acme.h"
 #include "gsd-media-keys-window.h"
+#include "gsd-osd-notification.h"
 
 #ifdef HAVE_PULSE
 #include <canberra-gtk.h>
@@ -86,6 +87,7 @@ struct GsdMediaKeysManagerPrivate
         GtkWidget       *dialog;
         GConfClient     *conf_client;
         GVolumeMonitor  *volume_monitor;
+        GsdOsdNotification *notifier;
 
         /* Multihead stuff */
         GdkScreen       *current_screen;
@@ -112,6 +114,13 @@ G_DEFINE_TYPE (GsdMediaKeysManager, gsd_media_keys_manager, G_TYPE_OBJECT)
 
 static gpointer manager_object = NULL;
 
+static const char *volume_icons[] = {
+        "notification-audio-volume-muted",
+        "notification-audio-volume-low",
+        "notification-audio-volume-medium",
+        "notification-audio-volume-high",
+        NULL
+};
 
 static void
 init_screens (GsdMediaKeysManager *manager)
@@ -616,12 +625,14 @@ do_eject_action (GsdMediaKeysManager *manager)
         }
 
         /* Show the dialogue */
-        dialog_init (manager);
-        gsd_media_keys_window_set_action_custom (GSD_MEDIA_KEYS_WINDOW (manager->priv->dialog),
-                                                 "media-eject",
-                                                 FALSE);
-        dialog_show (manager);
-
+        if (!gsd_osd_notification_show_icon_only ("notification-device-eject", "Eject")) {
+                dialog_init (manager);
+                gsd_media_keys_window_set_action_custom (GSD_MEDIA_KEYS_WINDOW (manager->priv->dialog),
+                                                         "media-eject",
+                                                         FALSE);
+                dialog_show (manager);
+        }
+        
         /* Clean up the drive selection and exit if no suitable
          * drives are found */
         if (fav_drive != NULL)
@@ -645,12 +656,14 @@ do_touchpad_action (GsdMediaKeysManager *manager)
         GConfClient *client = manager->priv->conf_client;
         gboolean state = gconf_client_get_bool (client, TOUCHPAD_ENABLED_KEY, NULL);
 
-        dialog_init (manager);
-        gsd_media_keys_window_set_action_custom (GSD_MEDIA_KEYS_WINDOW (manager->priv->dialog),
-                                                 (!state) ? "touchpad-enabled" : "touchpad-disabled",
-                                                 FALSE);
-        dialog_show (manager);
-
+        if (!gsd_osd_notification_show_icon_only ((!state) ? "touchpad-enabled" : "touchpad-disabled", "Touchpad")) {
+                dialog_init (manager);
+                gsd_media_keys_window_set_action_custom (GSD_MEDIA_KEYS_WINDOW (manager->priv->dialog),
+                                                         (!state) ? "touchpad-enabled" : "touchpad-disabled",
+                                                         FALSE);
+                dialog_show (manager);
+        }
+        
         gconf_client_set_bool (client, TOUCHPAD_ENABLED_KEY, !state, NULL);
 }
 
@@ -659,11 +672,20 @@ static void
 update_dialog (GsdMediaKeysManager *manager,
                guint vol,
                gboolean muted,
-               gboolean sound_changed)
+               gboolean sound_changed,
+               GsdOsdNotifierOvershootType overshoot)
 {
+        GtkWidget *window;
 #ifdef HAVE_PULSE
         vol = (int) (100 * (double) vol / PA_VOLUME_NORM);
 #endif
+        if (overshoot != GSD_OSD_NOTIFICATION_NO_OVERSHOOT) {
+                if (gsd_osd_notification_show_overshoot (manager->priv->notifier, overshoot))
+                        goto done;
+        } else {
+                if (gsd_osd_notification_show_value (manager->priv->notifier, vol, muted))
+                        goto done;
+        }
         vol = CLAMP (vol, 0, 100);
 
         dialog_init (manager);
@@ -673,14 +695,25 @@ update_dialog (GsdMediaKeysManager *manager,
         gsd_media_keys_window_set_action (GSD_MEDIA_KEYS_WINDOW (manager->priv->dialog),
                                           GSD_MEDIA_KEYS_WINDOW_ACTION_VOLUME);
         dialog_show (manager);
-
+done:
 #ifdef HAVE_PULSE
-        if (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",
-                                        CA_PROP_APPLICATION_ID, "org.gnome.VolumeControl",
-                                        NULL);
+        if (sound_changed != FALSE && muted == FALSE) {
+                if (manager->priv->dialog == NULL) {
+                        window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+                        gtk_window_set_screen (GTK_WINDOW (window), manager->priv->current_screen);
+                        gtk_widget_realize (window);
+                        play_volume_event_sound (window);
+                        gtk_widget_destroy (window);        
+                } else {
+                        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",
+                                                CA_PROP_APPLICATION_ID, "org.gnome.VolumeControl",
+                                                NULL);
+                }
+        }
+#else
+        return;
 #endif
 }
 
@@ -691,6 +724,7 @@ do_sound_action (GsdMediaKeysManager *manager,
         gboolean muted;
         guint vol, norm_vol_step;
         int vol_step;
+        GsdOsdNotifierOvershootType overshoot = GSD_OSD_NOTIFICATION_NO_OVERSHOOT;
         gboolean sound_changed;
 
 #ifdef HAVE_PULSE
@@ -743,17 +777,23 @@ do_sound_action (GsdMediaKeysManager *manager,
                         if (gvc_mixer_stream_set_volume (manager->priv->stream, vol) != FALSE) {
                                 gvc_mixer_stream_push_volume (manager->priv->stream);
                                 sound_changed = TRUE;
+                        } else {
+                                overshoot = GSD_OSD_NOTIFICATION_UNDERSHOOT;   
                         }
                 } else if (!muted) {
                         vol = vol - norm_vol_step;
                         if (gvc_mixer_stream_set_volume (manager->priv->stream, vol) != FALSE) {
                                 gvc_mixer_stream_push_volume (manager->priv->stream);
                                 sound_changed = TRUE;
+                        } else {
+                                overshoot = GSD_OSD_NOTIFICATION_UNDERSHOOT;   
                         }
                 }
 #else
-                if (!muted && (vol <= vol_step))
+                if (!muted && (vol <= vol_step)) {
                         acme_volume_mute_toggle (manager->priv->volume);
+                        overshoot = GSD_OSD_NOTIFICATION_UNDERSHOOT;
+                }
                 acme_volume_set_volume (manager->priv->volume, vol - vol_step);
 #endif
                 break;
@@ -767,6 +807,8 @@ do_sound_action (GsdMediaKeysManager *manager,
                                if (gvc_mixer_stream_set_volume (manager->priv->stream, vol) != FALSE) {
                                         gvc_mixer_stream_push_volume (manager->priv->stream);
                                         sound_changed = TRUE;
+                               } else {
+                                       overshoot = GSD_OSD_NOTIFICATION_OVERSHOOT; 
                                }
                         } else {
                                 gvc_mixer_stream_change_is_muted (manager->priv->stream, muted);
@@ -777,7 +819,6 @@ do_sound_action (GsdMediaKeysManager *manager,
                                 acme_volume_set_mute   (manager->priv->volume, FALSE);
                         }
                         acme_volume_set_volume (manager->priv->volume, vol + vol_step);
-                        
 #endif
                 } else {
 #ifdef HAVE_PULSE
@@ -794,12 +835,14 @@ do_sound_action (GsdMediaKeysManager *manager,
                         }
 #else
                         acme_volume_set_volume (manager->priv->volume, vol + vol_step);
+                        if (acme_volume_get_volume (manager->priv->volume) == 100)
+                                overshoot = GSD_OSD_NOTIFICATION_OVERSHOOT;   
 #endif /* HAVE_PULSE */
                 }
                 break;
         }
 
-        update_dialog (manager, vol, muted, sound_changed);
+        update_dialog (manager, vol, muted, sound_changed, overshoot);
 }
 #endif /* defined(HAVE_PULSE) || defined(HAVE_GSTREAMER) */
 
@@ -945,8 +988,11 @@ gsd_media_player_key_pressed (GsdMediaKeysManager *manager,
 
 static gboolean
 do_multimedia_player_action (GsdMediaKeysManager *manager,
+                             const char          *icon,
                              const char          *key)
 {
+        if (icon != NULL)
+                gsd_osd_notification_show_icon_only (icon, key);
         return gsd_media_player_key_pressed (manager, key);
 }
 
@@ -1017,19 +1063,19 @@ do_action (GsdMediaKeysManager *manager,
                 execute (manager, "gcalctool", FALSE, FALSE);
                 break;
         case PLAY_KEY:
-                return do_multimedia_player_action (manager, "Play");
+                return do_multimedia_player_action (manager, NULL, "Play");
                 break;
         case PAUSE_KEY:
-                return do_multimedia_player_action (manager, "Pause");
+                return do_multimedia_player_action (manager, NULL, "Pause");
                 break;
         case STOP_KEY:
-                return do_multimedia_player_action (manager, "Stop");
+                return do_multimedia_player_action (manager, NULL, "Stop");
                 break;
         case PREVIOUS_KEY:
-                return do_multimedia_player_action (manager, "Previous");
+                return do_multimedia_player_action (manager, NULL, "Previous");
                 break;
         case NEXT_KEY:
-                return do_multimedia_player_action (manager, "Next");
+                return do_multimedia_player_action (manager, NULL, "Next");
                 break;
         default:
                 g_assert_not_reached ();
@@ -1172,6 +1218,7 @@ gsd_media_keys_manager_start (GsdMediaKeysManager *manager,
         manager->priv->volume = acme_volume_new ();
         gnome_settings_profile_end ("acme_volume_new");
 #endif /* HAVE_PULSE */
+        manager->priv->notifier = gsd_osd_notification_new (volume_icons, "volume");
         g_idle_add ((GSourceFunc) start_media_keys_idle_cb, manager);
 
         gnome_settings_profile_end (NULL);
@@ -1268,6 +1315,9 @@ gsd_media_keys_manager_stop (GsdMediaKeysManager *manager)
         }
         g_list_free (priv->media_players);
         priv->media_players = NULL;
+
+        if (manager->priv->notifier != NULL)
+                g_object_unref (manager->priv->notifier);     
 }
 
 static void