Ubuntu - Fancy Extended Notifications
noorbeast — Sat, 2010-06-26 18:33
Like many I was not happy with the inbuilt limitations of Ubuntu's fancy notification system, notify-osd ( http://www.mail-archive.com/ayatana@lists.launchpad.net/msg00747.html ). But being open source you are free to modify and change what you do not like or something you would like to extend to better suit your needs.
A fork exists for notify-osd, notify-osd-better, which extends functionality, such as notification stacking. You can get the forked notify-osd via ppa for Ubuntu: https://launchpad.net/~jstpierre/+archive/ppa
Or grab the source: https://code.launchpad.net/~jstpierre/notify-osd-better/trunk
Even the fork lacked the one feature I wanted, being able to control the time a notification remains visible. I came across a patch for notify-osd to re-enable the time function: http://www.mail-archive.com/ubuntu-bugs@lists.ubuntu.com/msg1886869.html
What I then did was create my own patch for notify-osd-better, to add the time functionality to the advanced features that had already been created for the fork.
To pull down the truck of notify-osd-better, apply the patch and use the time out functionality you will need to add some programs: sudo apt-get install bzr build-essential libnotify-dev libnotify-bin checkinstall (there may be other programs like automake needed, I am not really sure what I added the first time).
Pull down the trunk: bzr branch lp:~jstpierre/notify-osd-better/trunk
Now create a file called notify-osd-better_timeout.patch in the src directory with the following content:
diff -uNr /home/zeus/Trunk2/trunk/src/display.c /home/zeus/Trunk/trunk/src/display.c
--- /home/zeus/Trunk2/trunk/src/display.c 2010-03-17 19:42:00.348594000 +1000
+++ /home/zeus/Trunk/trunk/src/display.c 2010-03-17 20:06:47.621309000 +1000
@@ -121,8 +121,10 @@
g_object_unref (bubble);
}
+ /*
bubble_set_timeout (bubble,
defaults_get_on_screen_timeout (d));
+ */
x = x_d - (bubble_get_width(bubble) - EM2PIXELS(defaults_get_bubble_width(d), d));
diff -uNr /home/zeus/Trunk2/trunk/src/send-test-notification.sh /home/zeus/Trunk/trunk/src/send-test-notification.sh
--- /home/zeus/Trunk2/trunk/src/send-test-notification.sh 2010-03-17 19:42:00.348594000 +1000
+++ /home/zeus/Trunk/trunk/src/send-test-notification.sh 2010-03-17 20:41:14.140372414 +1000
@@ -61,3 +61,9 @@
Sandwich
Fry
Testing tag"
+
+notify-send -t 20000 "Timing Test" "I am really slow"
+
+notify-send -t 2000 "Timing Test" "I am quick"
+
+notify-send -t 1000 "Timing Test" "I am really fast"
diff -uNr /home/zeus/Trunk2/trunk/src/stack.c /home/zeus/Trunk/trunk/src/stack.c
--- /home/zeus/Trunk2/trunk/src/stack.c 2010-03-17 19:42:00.348594000 +1000
+++ /home/zeus/Trunk/trunk/src/stack.c 2010-03-17 20:09:55.144310000 +1000
@@ -44,6 +44,7 @@
G_DEFINE_TYPE (Stack, stack, G_TYPE_OBJECT);
#define FORCED_SHUTDOWN_THRESHOLD 500
+#define NOTIFY_EXPIRES_DEFAULT -1
/* fwd declaration */
void close_handler (GObject* n, Stack* stack);
@@ -645,6 +646,14 @@
if (body)
bubble_set_message_body (bubble, body);
+ if (timeout == NOTIFY_EXPIRES_DEFAULT) {
+ bubble_set_timeout (bubble,
+ defaults_get_on_screen_timeout (self->defaults));
+ }
+ else {
+ bubble_set_timeout (bubble, timeout);
+ }
+
if (new_bubble && bubble_is_append_allowed(bubble)) {
app_bubble = find_bubble_for_append(self, bubble);
Patch the source: patch -p0 < notify-osd-better_timeout.patch
Then compile and install your new fancy notifications by running the following in a terminal: ./configure; make; sudo checkinstall
You can accept the default settings in checkinstall or alter to suit yourself. Don't forget to remove the original notify-osd!
Here is a video showing off the hacked notification system and also the plugin I wrote for sending irc messages to the cqlug irc via kupfer, which is a universal launcher. Between the two now I have a 'headless' irc setup.