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
Debian users can use debuild instead of make install. Hint courtesy of 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!