MùPùF.org

Linux, Programming and Octopodes

--- *Projects* (website in development: svn r299)--- » PPassKeeper » ArduIDE

How-to: Change Notify-osd's behaviour and themeHow-to: Change Notify-osd's behaviour and theme

This post is just a quick tutorial on how to modify NotifyOsd's display colours, font size, and bubble position. It includes source code edition, and thus is not advised for beginner users.

The first thing you'll need is to get a copy of your notify-osd package. For our beloved Xubuntu users, it'll be:

$ apt-get source notify-osd
$ cd notify-osd-0.9.28

Then, you'll have to modify a particular file, containing the default settings, hardcoded in the source. I'm gonna use nano for this purpose:

$ nano src/defaults.c

We're now going to checkout lines 116 to 144. If you're using nano, you can use the Ctrl+_ keyboard shortcut to get to a line of your choice.

Here is a copy of what you should see:

#define DEFAULT_DESKTOP_BOTTOM_GAP    6.0f
#define DEFAULT_BUBBLE_WIDTH         24.0f
#define DEFAULT_BUBBLE_MIN_HEIGHT     5.0f
#define DEFAULT_BUBBLE_MAX_HEIGHT    12.2f
#define DEFAULT_BUBBLE_VERT_GAP       0.5f
#define DEFAULT_BUBBLE_HORZ_GAP       0.5f
#define DEFAULT_BUBBLE_SHADOW_SIZE    0.7f
#define DEFAULT_BUBBLE_SHADOW_COLOR  "#000000"
#define DEFAULT_BUBBLE_BG_COLOR      "#131313"
#define DEFAULT_BUBBLE_BG_OPACITY    "#cc"
#define DEFAULT_BUBBLE_HOVER_OPACITY "#66"
#define DEFAULT_BUBBLE_CORNER_RADIUS 0.375f
#define DEFAULT_CONTENT_SHADOW_SIZE  0.125f
#define DEFAULT_CONTENT_SHADOW_COLOR "#000000"
#define DEFAULT_MARGIN_SIZE          1.0f
#define DEFAULT_ICON_SIZE            3.0f
#define DEFAULT_GAUGE_SIZE           0.625f
#define DEFAULT_GAUGE_OUTLINE_WIDTH  0.125f
#define DEFAULT_TEXT_FONT_FACE       "Sans"
#define DEFAULT_TEXT_TITLE_COLOR     "#ffffff"
#define DEFAULT_TEXT_TITLE_WEIGHT    TEXT_WEIGHT_BOLD
#define DEFAULT_TEXT_TITLE_SIZE      1.0f
#define DEFAULT_TEXT_BODY_COLOR      "#eaeaea"
#define DEFAULT_TEXT_BODY_WEIGHT     TEXT_WEIGHT_NORMAL
#define DEFAULT_TEXT_BODY_SIZE       0.9f
#define DEFAULT_PIXELS_PER_EM        10.0f
#define DEFAULT_SYSTEM_FONT_SIZE     10.0f
#define DEFAULT_SCREEN_DPI           96.0f
#define DEFAULT_GRAVITY              GRAVITY_NORTH_EAST

We're going to modify, in a first time, DEFAULT_GRAVITY. It can take three values: GRAVITY_NONE: the behaviour in Jaunty. A notification will always go into the top right corner GRAVITY_EAST: the behaviour NotifyOsd has been having for about a week in Karmic's development cycle, with the notifications centered vertically on the screen GRAVITY_NORTH_EAST: the Karmic behaviour. Works like GRAVITY_NONE but does not put asynchronous notifications on top of the screen, even if there is no synchronous notification being displayed.

Once this is done, we can change the colours of our notification bubbles by changing the following keys:

#define DEFAULT_BUBBLE_SHADOW_COLOR  "#000000"
#define DEFAULT_BUBBLE_BG_COLOR      "#131313"
#define DEFAULT_CONTENT_SHADOW_COLOR "#000000"
#define DEFAULT_TEXT_TITLE_COLOR     "#ffffff"
#define DEFAULT_TEXT_BODY_COLOR      "#eaeaea"

Colours have to be of the form #rgb or #rrggbb. Of course, you can also modify the boldness of the text, the opacity of the bubbles, their sizes, and even the default text size and font size. Values are pretty self-explicit, and this is not meant to be a tutorial for beginners, so I'm not going to get into details.

Let's instead directly switch to the compiling and testing part. You'll need some packages, including gtk-doc, and the gtk and cairo development packages. Don't forget to kill your notification daemon before you start notify-osd. Here, I assume you're already using this one.

$ ./configure
$ make
$ killall notify-osd && ./src/notify-osd

Once you're satisfied with what you're done, you can just install notify-osd. If you're on a Debian (this includes Xubuntu) system, you can use /usr as a prefix, as it's the one used on these distributions:

$ ./configure --prefix=/usr
$ sudo make install

Update: Debian users can use debuild instead of make install. See the third comment, from andrewsomething.

Note that you'll need to download the source again and use make uninstall if you want to remove the files, so you can use checkinstall if you want to make it possible for your package manager to remove the files. I'm linking you to the checkinstall website because I have never tested it and do not know how it works.

That's all for today. If you're disappointed NotifyOsd does not allow full customisation via GConf keys, well, you're not alone. I am too, and I also am disappointed that my patch allowing such customisation (and use of Xfconf as an alternative backend) has still not been reviewed by the NotifyOsd developers. If you're interested into having such a patch (and a working package, possibly hosted on a repository) for NotifyOsd, please leave a comment and I'll consider updating the patch and building the package when I have some time.

Also, if you're wondering what I've been doing the last 2 months, well, I'll just answer with a word: Synema. The name of a new application whose first alpha I hope to publicly release soon. There will be another post about it once I'm done with the exams. Stay tuned!

Published Jan. 14, 2010 by — tags: development, tutorial, xubuntu

Comments (10)

#1 Synema

By Vincent, Jan. 14, 2010 22:54:07

Checkinstall is easy: replace sudo make install with sudo checkinstall, and follow the instructions.

I'm curious to Synema :)

#2 Synema

By Steve Dodier, Jan. 14, 2010 23:41:35

Can't reveal anything yet! It's a school project, so I have to wait for the agreement of several teachers before I can publish anything. And there is still much to do so I don't expect a 1.0.0 before June.

#3 debuild

By andrewsomething, Jan. 17, 2010 00:53:02

As you're already pulling the source with apt, it's trivial to just build the deb instead of using "make install"

Just run:

apt-get build-dep notify-osd && debuild

#4 debuild

By Steve Dodier, Jan. 17, 2010 10:53:52

Thanks for the tip Andrew! That'll surely help Debian users.

#5 Nike Shox nz

By Nike Shox nz, July 22, 2010 09:11:10

Every day we have to wear a pair of shoes to work. So a pair of satisfaction and comfortable shoes will be necessary. Welcome to our website to see all kinds of shoes by Nike Shox nz or Nike Shox Deliver .Thanks!

#6 ..

By whise, Jan. 17, 2010 15:05:49

there should be a preferences menu that allows to do this in a more sane maner ...

#7 cooking a package

By Phil, March 9, 2010 01:16:06

On ubuntu you should build a package with debuild too.

@whise:

Right, it should be configurable through a menu. The Gnome an apps maintainer should do it like in VLC: a short preferences list for those, who want it simple and an advanced settings menu for those, who want more.

#8 Multiple notifications

By acidrums4, March 30, 2010 19:07:58

How about get multiple bubbles at the same time? I wrote to one of the notify-osd developers, but I didn't get answer...

#9 thankyou

By nfl store, July 27, 2010 04:34:00

I have been searching for some articales like this for a long time,thank you for your post,it really helps me.

#10 up

By jacky, July 27, 2010 04:36:44

If you are nfl jerseys fans, don’t miss to buy cheap authentic NFL Jerseys here nfl store, 2010 new style nfl football jerseys on hot sale!

Write a new comment