mupuf.org // we are octopimupuf.org

How-to: Change Notify-osd's Behaviour and Theme

This post is just a quick tu­to­r­ial on how to mod­ify No­ti­fyOsd’s dis­play colours, font size, and bub­ble po­si­tion. It in­cludes source code edi­tion, and thus is not ad­vised for be­gin­ner users.

The first thing you’ll need is to get a copy of your no­tify-osd pack­age. For our beloved Xubuntu users, it’ll be:

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

Then, you’ll have to mod­ify a par­tic­u­lar file, con­tain­ing the de­fault set­tings, hard­coded in the source. I’m gonna use nano for this pur­pose:

$ nano src/defaults.c

We’re now go­ing to check­out lines 116 to 144. If you’re us­ing nano, you can use the Ctrl+_ key­board short­cut 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 go­ing to mod­ify, in a first time, DE­FAULT­_­GRAV­ITY. It can take three val­ues: GRAV­I­TY_NONE: the be­hav­iour in Jaunty. A no­ti­fi­ca­tion will al­ways go into the top right cor­ner GRAV­I­TY_EAST: the be­hav­iour No­ti­fyOsd has been hav­ing for about a week in Karmic’s de­vel­op­ment cy­cle, with the no­ti­fi­ca­tions cen­tered ver­ti­cally on the screen GRAV­I­TY_NORTH_EAST: the Karmic be­hav­iour. Works like GRAV­I­TY_NONE but does not put asyn­chro­nous no­ti­fi­ca­tions on top of the screen, even if there is no syn­chro­nous no­ti­fi­ca­tion be­ing dis­played.

Once this is done, we can change the colours of our no­ti­fi­ca­tion bub­bles by chang­ing the fol­low­ing 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 mod­ify the bold­ness of the text, the opac­ity of the bub­bles, their sizes, and even the de­fault text size and font size. Val­ues are pretty self-ex­plicit, and this is not meant to be a tu­to­r­ial for be­gin­ners, so I’m not go­ing to get into de­tails.

Let’s in­stead di­rectly switch to the com­pil­ing and test­ing part. You’ll need some pack­ages, in­clud­ing gtk-doc, and the gtk and cairo de­vel­op­ment pack­ages. Don’t for­get to kill your no­ti­fi­ca­tion dae­mon be­fore you start no­tify-osd. Here, I as­sume you’re al­ready us­ing this one.

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

Once you’re sat­is­fied with what you’re done, you can just in­stall no­tify-osd. If you’re on a De­bian (this in­cludes Xubuntu) sys­tem, you can use /usr as a pre­fix, as it’s the one used on these dis­tri­b­u­tions:

$ ./configure --prefix=/usr
$ sudo make install
Up­date

De­bian users can use de­build in­stead of make in­stall. Hint cour­tesy of an­drew­some­thing.

Note that you’ll need to down­load the source again and use make unin­stall if you want to re­move the files, so you can use check­in­stall if you want to make it pos­si­ble for your pack­age man­ager to re­move the files. I’m link­ing you to the check­in­stall web­site be­cause I have never tested it and do not know how it works.

That’s all for to­day. If you’re dis­ap­pointed No­ti­fyOsd does not al­low full cus­tomi­sa­tion via GConf keys, well, you’re not alone. I am too, and I also am dis­ap­pointed that my patch al­low­ing such cus­tomi­sa­tion (and use of Xf­conf as an al­ter­na­tive back­end) has still not been re­viewed by the No­ti­fyOsd de­vel­op­ers. If you’re in­ter­ested into hav­ing such a patch (and a work­ing pack­age, pos­si­bly hosted on a repos­i­tory) for No­ti­fyOsd, please leave a com­ment and I’ll con­sider up­dat­ing the patch and build­ing the pack­age when I have some time.

Also, if you’re won­der­ing what I’ve been do­ing the last 2 months, well, I’ll just an­swer with a word: Synema. The name of a new ap­pli­ca­tion whose first al­pha I hope to pub­licly re­lease soon. There will be an­other post about it once I’m done with the ex­ams. Stay tuned!

Comments