cairo-msg – a simple splash message app

I have been busy coding a splash app in C for Linux (or other UNIX like OS) that is designed to be simple, light weight yet “pretty”. It uses the Xlib and Cairo libraries and stripped, the binary is only 11k.

There really aren’t many light-weight options for a general purpose splash message app, for what I want anyway. Sure there is zenity, yad, Xdialog, gtkdialog (all dependent on gtk), xmessage, yaf-splash (Xlib) and others like Kdialog (KDE) and probably a bunch more but all of those are either too complex or don’t do what I want without some convoluted scripting techniques which slow things down and introduce margin for error. I wanted something simple that only needs to display a few words with a coloured background indicating what kind of message we are displaying, preferably with an appropriate icon . It had to display in a prominent position on screen (adjustable of course) and with no window decoration. It had to support all fonts so had to be unicode compliant. It had to have a variable timeout, without resorting to hacks like this:

splash-message "bla bla bla" &
pid=$!
sleep 5
kill -9 $pid

So, like all hackers, if you can’t find the tool, make the tool! cairo-msg was born!

Check it out on my GitHub page.

NB: This is tested in Slackware64-14.1 (KDE), Slackware-14.1 (Cinnamon) and Slacko Puppy Linux (64 and 32 running JWM).

Advertisements

Limit Firefox Cache

Just an FYI post.

In all previous slacko versions I did not bother limiting the browser cache. The only way I knew how to do it was to install a default profile in /root/.mozilla. If you decide to run the browser as spot then this totally defeats the purpose.

Mozilla in their infinite wisdom has decided to remove that option from it’s gui preferences program. Rolling Eyes . The only way to do it now is manually through about:config.

With a bit of research I devised a way to limit the browser cache without installing a default profile.

A file; /usr/lib/firefox*/defaults/preferences/local-settings.js needs to be created (you can check it out at /usr/lib/firefox-17.0.11/defaults/preferences). It contains the following:

Code:
//
//default home page and cache
pref(“browser.startup.homepage”, “data:text/plain,browser.startup.homepage=file:///usr/share/doc/home.htm”);
pref(“browser.cache.disk.capacity”, 60000);

You’ll notice that this also sets the home page.

The trick about this though was how to implement it without hard coding?

Well I did this at the woof level with a pinstall.sh. The relevant part of the pinstall.sh contains this:

Code:
# work around for firefox bug to set cache
if [ `pwd` != ‘/’ ];then
FF=$(find usr/lib -type d -name firefox*)
PKGSTATDIR=`find ../../ -type d -name status -maxdepth 3`
PKGSTATFILE=`find $PKGSTATDIR -type f -name ‘findpkgs_FINAL_PKGS*’`
FFVER=`grep ‘firefox’ $PKGSTATFILE | awk -F’|’ ‘{print $6}’`
FFVER=${FFVER%%.*}
if [ “$FFVER” -ge 21 ];then
mkdir -p ${FF}/browser/defaults/preferences
PREFDIR=”${FF}/browser/defaults/preferences”
else
mkdir -p ${FF}/defaults/preferences
PREFDIR=”${FF}/defaults/preferences”
fi
cat > ${PREFDIR}/local-settings.js <<_EOF
//
//default home page and cache
pref(“browser.startup.homepage”, “data:text/plain,browser.startup.homepage=file:///usr/share/doc/home.htm”);
pref(“browser.cache.disk.capacity”, 60000);
_EOF

fi

That will seem like jumble to some, but all it does is create the above file. One important note though; mozilla, again in their infinite wisdom, moved the location of where these type of files are read in firefox-21. From /usr/lib/firefox*/defaults/preferences to /usr/lib/firefox*/browser/defaults/preferences.

This should work for seamonkey as well but the version change over would have to be noted.

Many thanks to Mike’s Musings.

Google… literal “cloud” computing

Loon (YouTube)

Google is going to the cloud, and beyond, literally.

Project Loon is an ambitious Google project with the aim of providing “infrastructure”, (used loosely) to developing markets (?) such that they can use the internet which we all take for granted (except at the end of the billing period  :-P). The basic idea is that several balloons are fitted with internet transceivers and launched into the stratosphere. Their direction is controlled by their level of flight. Wind current directions vary (apparently, see the links) at different altitudes so by controlling the balloon’s altitude relative to conditions *should* keep these mobile data transceivers within operable range.

Imaginative stuff!

Mageia 3

I decided to replace a Raring Ubuntu install on my laptop with Mageia 3. I used the “dualarch” iso downloaded with bit torrent (transmission), ~700MB. I have crap bandwidth so the DVD was out of the question for me, plus I could set up the system the way I want.

The install went pretty smooth except for my wireless connection. The laptop is a Compaq CQ-60, Intel Cantiga graphics, Celeron T1600 (dual core) processor, I GB RAM, Atheros Communications Inc. AR242x / AR542x Wireless Network Adapter (PCI-Express) (rev 01). Note that the iso includes both X86_64 and i586 binaries and the installer decides itself which to install. In my case the 64 bit version was chosen.

What happened with wireless was a known issue on Mageia 2 and my particular wireless chipset. Unfortunately the Mageia devs haven’t got this fixed for 3. For some reason, at every boot, rfkill manages to hard block the wireless. Luckily I have Slackware64-current on this lappy so I pilfered the rfkill binary from that install and inserted into /usr/local/bin. Strangely enough no other distro exhibits this issue. If you use any other wireless chipset you should be fine as non-free firmware blobs are included.

mag3
Mageia 3 default desktop using openbox/lxpanel

I’m sure there is a work around for my case which I will employ.

The only browser included is Midori. That’s ok for finding your way around the web. But I prefer one of the big boys like Firefox or Chrome. I decided on Chrome and got the latest stable 64 bit version from the google servers. It was a simple matter of double clicking the file in my downloads directory once it had downloaded. Mageia automatically resolved all the dependencies and I was browsing G+ within minutes.

I tried out the GUI package manager. It seems ok, pretty much unchanged since the old Mandrake days. That’s good for familiarity, plus it’s a nice simple interface.

Still, I prefer the commandline version, urpmi. I proceed to install gimp, libreoffice, vlc, audacious and a few other small things.

With LXDE on the desktop, a nice and snappy experience is encountered, nothing flashy but it stays out of the way. Who sits there and looks at their desktop anyway? 99% of the time I’m either in a browser, text editor, terminal emulator or word processor.

I might keep this one for awhile. I didn’t like Ubuntu raring on this machine, too slow with Unity or Gnome 3. Probably LXDE would have been the go, but the Amazon stuff kind of turned me off. When I want Amazon to know my business I’ll go there myself. At least with Google, you can go to the Dashboard and delete everything, clear out all the tracking cookies and you are back to square 1. No such thing in Ubuntu/Amazon, even tracks your desktop search!

Google Drive? Not on Linux!

C’mon Google!

Google Drive was announced on the 25th of April, 2012. Right here and now somewhere near the 150th meridian east it is the 24th of July, 2012. Doing the sums in my head that makes it, oh, about three months since the announcement?

Where is Drive for Linux?

Ubuntu One can be run on any Linux, Drop-Box has an app for Linux, I don’t know about Amazon or SkyDrive [ :pig2:]…

Isn’t Android and ChromeOS loosely based on Linux? Is that a fair statement? Well I’m going to make a statement, fair or not!

You have leached of Linux, and with due respect, you have given some stuff back to Linux, but what about Drive? We know you have the resources. You know there are millions of faithful Linux users, many of whom are Google users. We know that many of your developers run your custom flavour of Ubuntu. The Cloud is the future we are told.

What is the problem?

Enter Grive.

Grive Icon
A possible solution

Fortunately, some keen developers have made their own open source command line based solution. Grive.

Even better, for Slacko Puppy Linux users I have made a simple graphical solution called Grive Rox App. It’s just a bash script which depends on gtkdialog (thank you Google code) and ROX-Filer, the file manager by default in Slacko and other Puppy Linux. I’m sure Grive could be made to work with Nautilus, Dolphin or most other graphical file managers.

Comments are most welcome on this topic.

Cheers!