20 December 2010

XDG menus in Openbox

Now I feel stupid. For year(s) I've been sorta griping about how the Openbox menu doesn't give you a program listing that coincides with what you get in GNOME, Xfce, and even fbpanel. I've hunted for solutions to this before but came up short. Turns out the solution is insanely simple.

The following is a direct quote from from the excellent ArchWiki. I tried it in Ubuntu Maverick and it works.

Obm-xdg

obm-xdg is a command-line tool that comes with Obmenu. It can generate a categorized sub-menu of installed GTK/GNOME applications.

To use obm-xdg, add the following line to ~/.config/openbox/menu.xml:

{menu execute="obm-xdg" id="xdg-menu" label="xdg"/}

(note: the curly brackets above should actually be angled brackets, but this crazy Blogger interface makes it close to impossible to write the above with angled brackets.)

Then run openbox --reconfigure to refresh the Openbox menu. You should now see a sub-menu labeled xdg in your menu.

Note: If you do not have GNOME installed, then you need to install gnome-menus package for obm-xdg to work.

Update: This is having issues on Squeeze. More later as I (if I) figure it out.

18 December 2010

Java Swing anti-aliased font rendering

[Update 2011-04-03:  The Arch Wiki describes lots of options for the export below. I've been having good results with export _JAVA_OPTIONS='-Dawt.useSystemAAFontSettings=setting']

Today I noticed fonts in my Swing-based Java apps were utterly hideous. They were no longer being rendered with anti-aliasing. I don't know if this is because today I logged into a minimal Openbox+fbpabel setup and GNOME was handling this automatically or if it's caused by some other subtle thingy.

No matter, it's pretty easy to fix. Add

export _JAVA_OPTIONS="-Dawt.useSystemAAFontSettings=on"

to your ~/.profile file. You'll probably then have to logout and back in. After this anti-alised rendering will be the default.

Supposedly, you can do this system-wide by adding

_JAVA_OPTIONS="-Dawt.useSystemAAFontSettings=on"

to your /etc/environment file, but I have not tried this.

Update There is one downside to this: the JVM will write Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=on to the console. It's not a deal-breaker, but it is a little annoying.

21 October 2010

No Gnome in Maverick Meerkat

I am a little surprised that no one has yet commented on how there is no longer a Gnome entry in the Ubuntu Maverick Meerkat login screen. Instead, you have various options for "Ubuntu Desktop Edition." When you select "Ubuntu Desktop Edition" you get something that looks, acts, smells, and sounds almost exactly like Gnome. For now.

19 October 2010

Enabling touchpad clicking and edge scrolling in Squeeze

Gnome has a mouse configuration interface that lets you enable touchpad clicking and scrolling. But if you are a Debian Squeeze user and prefer Xfce, LXDE, or some handmade alternative, you will find that your touchpad's clicking and edge scrolling won't work [1]. You'll also find that those functions don't work in the GDM login screen even if you do use Gnome. No probs. The fix is easy.

To fix:
  1. Open  /usr/share/X11/xorg.conf.d/50-synaptics.conf (as root) in an editor.
  2. Add the text
    Option "TapButton1" "1"
    Option "VertEdgeScroll" "1"

    between Section "InputClass" and EndSection.
  3. Save, reboot and enjoy.
Note that if you use Gnome, you might find that your old mouse settings are messed up after the above. Set them again and all should be fine.

If you don't like the idea of changing system config files, you can use synclient in a startup script to enable things as well.

Useful links:

[1] At least at the time of this writing. When Squeeze is eventually released, this may change.

14 October 2010

Fixing brightnes control, etc. on a Samsung R510 with Debian Squeeze

I finally got around to installing Linux on my Samsung R510 laptop. One of the problems with Samsung laptops is that they don't play well with some Linux standards. One example is the brightness control--it just doesn't work. There are some other issues that are less irritating, but this one is the worst for me.

There is a fix for these ails that was developed for Ubuntu (some of which is also at Google code.). The problem is that my current distribution of choice is Debian Testing (Squeeze). The good news is that these bits developed for Ubuntu can be used in Squeeze as well.

We need to install three different packages: easy-slow-down-manager, samsung-backlight, and samsung-tools. Here's what I did after installing Squeeze with Gnome on the R510:

easy-slow-down-manager
Download the Maverick *.deb for easy-slow-down-manager from from https://launchpad.net/~voria/+archive/ppa and install it directly with gdebi or your favorite package installer. It's all DKMS source code, so installing the package in Squeeze should be ok.

samsung-backlight
Downloaded the Maverick *.deb for samsung-backlight from from https://launchpad.net/~voria/+archive/ppa and install it directly with gdebi or your favorite package installer. Like easy-slow-down-manager, it's all DKMS source, so installing the package in Squeeze should be ok.

With a lot of Samsung laptops, we'd be done with these two packages. Sadly, the R510 needs some extra love. The following is taken almost verbatim from http://www.voria.org/forum/viewtopic.php?f=3&t=516&start=0&hilit=r510

First (as root):
# gedit /lib/udev/rules.d/95-keyboard-force-release.rules

In the Samsung section you will see a line with *N130*|*N140* etc. Add |*R510* there

Do the same for:
# gedit /lib/udev/rules.d/95-keymap.rules

Next, add "acpi_backlight=vendor" to grub:
# gedit /etc/default/grub

and add "acpi_backlight=vendor" to the line GRUB_CMDLINE_LINUX_DEFAULT so it looks like
GRUB_CMDLINE_LINUX_DEFAULT="quiet acpi_backlight=vendor"

Save the file and then update grub:
# update-grub

samsung-tools
It may or may not be ok to install the Ubuntu package for samsung-tools on Squeeze, but since it's got binaries in it, this is risky. I decided to download the sources and build a package on the Squeeze-equipped R510 instead. Start by getting some build tools:
# apt-get install build-essential devscripts fakeroot

Then from https://launchpad.net/~voria/+archive/ppa get the Maverick *.tar.gz sources for samsung-tools. Expand the *.tar.gz and inside the directory that has the debian directory (i.e., not in the debian directory, but in the directory immediately above), open a term and:

dch -l {your initials}

and add comment like "Compiled for Debian." Close the editor and in the term build the package with:
dpkg-buildpackage -rfakeroot -us -uc

You may need to add additional dependencies if it fails. Pay attention to the error messages. Assuming it completes, this will generate a *.deb package file. Install it using gdebi or whatever.

After rebooting, you should now have working brightness buttons and a host of other working {Fn}-{Fsomething} keys. You will also have a new app under System->Preferences->Samsung Tools Preferences that you can use to change keybindings, etc and/or run as a Gnome panel app.

If it doesn't work
If the above doesn't work, you may be interested in playing with brightung. I haven't played with it except to confirm that (as root)

# setpci -s 00:02.0 F4.B={some-hex-number}

changes the brightness on my R510.

Workaround for installing desktops in Squeeze

I've done a couple new Debian Testing installations in the last couple days and have noticed something strange in the installer. At a point in the installation process, you will be offered a menu of choices for major package bundles to be installed. If you want a desktop environment, you're supposed to select "Desktop environment." In the past when I did this, the following screen would offer you a choice of DTEs including Gnome, KDE, Xfce, and LXDE. However, the last few installs I tried did not. And exactly what it installs I'm not sure because I wasn't willing to wait 3 hours (at my connection speeds) for the download and install process to complete. So here's the workaround:

First, using the installer, install the system you want but do not install a desktop environment. 

When the installation completes, login using the command line. Then become root
su

Next, make sure you have tasksel installed:
# apt-get install aptitude tasksel

Finally, use tasksel to install your desktop. To install Gnome:
# tasksel install gnome-desktop --new-install

Reboot:
# reboot

and when your computer restarts, you should be good to go.

29 September 2010

Scrpit for building Debian Squeeze libcairo2 with Ubuntu patches

[Update 2011-06-25: Indeed, you should consider this post obsolete. See this post for more info.] 
[Update 2011-06-24: This whole business may be unnecessary as it appears installing a recent version of Iceweasel from http://mozilla.debian.net/ also installs new libcairo2 with decent font rendering. I've yet to do careful comparisons, but it's possible that this solves both "ugly rendering in general" as well as "ugly rendering in Firefox" issues.]
[Update 2011-03-06 Reader datSilencer points out that the location of the Arch patch has changed. I have updated the script to reflect the change.]

Based on the post I wrote earlier, which is itself based on work published in a CrunchBang Linux Forum thread and by quanliking, I put together a script for quasi-automatically building libcario2 for Squeeze using the Ubuntu and Arch patches.

You can get the script at http://download.tuxfamily.org/skinny/libcairo2-patched/build-libcairo2.sh.

Prerequisites
  • Enable sources in your /etc/apt/sources.list (i.e.,  make sure sources.list has something similar to deb-src http://ftp.us.debian.org/debian/ squeeze main non-free contrib in it). If you make any changes, be sure to # apt-get update
  • # apt-get install build-essential devscripts fakeroot
  • # apt-get build-dep cairo
To use
  1. Download build-libcairo2.sh into the directory where you plan to build the packages. I recommend you start with a dedicated and empty directory.
  2. Open the script in a text editor and change the constants at the top as documented.
  3. Make the script executable and execute it:
    $ chmod +x build-libcairo2.sh
    $ ./build-libcairo2.sh
  4. Part of the way through, it will prompt you to fill in a line that opens in your default CLI editor. Do what it asks.
  5. When it's finished, open a term and follow the directions to install.
Rebuilding
When it comes time to rebuild (i.e., after a new Debian release) you must start over with an empty directory. Or at the very least, you must rename the top-level folder named libcairo2 that your previous build generated. This is to make sure that you get the most recent everything and that there are no goofy problems that might lead to a build that melts Arctic ice or increases the mercury content of fish.

Todo
An obvious bit of low-hanging fruit is to make entering of version info interactive, but it's arguable that that would be easier and less error prone that editing the script.

To round this out, we also need an additional script or package that adds the needed files from Ubuntu's fontconfig-config package to /etc/fonts/conf.avail and /etc/fonts/conf.d.

Notes
I uploaded the i386 packages that I built for my own use to http://download.tuxfamily.org/skinny/libcairo2-patched. Feel free to try these if you don't feel like building them yourself. However, I'm not making any promises that I'll keep these up-to-date.

Legal disclaimer
I have tested the code and packages mentioned here to make sure they don't bruise kittens or eat children. However, I wrote and built this stuff for my own use and have made it available here with no warranty of any kind whatsoever in the hopes it might be useful to others. Use at your own risk.

15 July 2010

Firefox 3.6 with pretty fonts in Debian Squeeze (easier version)

[Update 2011-06-25: You should consider this post obsolete. See this post for more info.] 
 
If all the Mercurial and Namoroka in my previous posts about building and installing Firefox 3.6 in Squeeze has your head spinning a bit, here's a simplified version that gets the sources via FTP. As was the case in the previous build, this version enables cairo so you get nicer font rendering. This version also configures the build to use official Mozilla Firefox branding so you don't get Deer Park icons and such.

Preproduction
1) Create a working directory. Use a file manger or whatever you are comfortable with to do this. I called mine ~/firefox-release.

2) Get all the tools and things you need to build Firefox. In a terminal as root (using su):

# apt-get build-dep iceweasel
# apt-get install libasound2-dev libcurl4-openssl-dev libnotify-dev libxt-dev libiw-dev mesa-common-dev autoconf2.13 yasm
# apt-get install libidl-dev


Get and build
1) Get the source code. Open a web browser or ftp client and go to ftp://ftp.mozilla.org/pub/mozilla.org/firefox/releases/3.6.6/source/. Download firefox-3.6.6.source.tar.bz2 into ~/firefox-release. (If 3.6.6 is no longer the most recent version, then replace 3.6.6 above with whatever the most recent 3.6 happens to be.)

2) Extract the archive you downloaded. Use tar -jxvf *.tar.bz2 on the command line or whatever GUI tool you are comfortable with. This will give you a mozilla-1.9.2 directory inside ~/firefox-release.

3) Make a configuration file. Create a new file inside ~/firefox-release/mozilla-1.9.2 called mozconfig. Open mozconfig inside a text editor and paste in the following text:

. $topsrcdir/browser/config/mozconfig
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/ff-release
#mk_add_options MOZ_MAKE_FLAGS="-j4"
ac_add_options --disable-debug
ac_add_options --disable-tests
ac_add_options --enable-optimize
ac_add_options --enable-official-branding
ac_add_options --enable-system-cairo

Save the file and exit the editor.

3) Build the beast by opening a terminal in ~/firefox-release/mozilla-1.9.2 and entering the following command:

make -f client.mk

Once the compile is done, the binaries will be in
~/firefox-release/mozilla-1.9.2/ff-release/dist/bin/.
As a test, execute the file firefox to make it go.

"Install"
1) Copy the contents of the bin directory to /opt, converting links to actual files. Do not try to copy the files with a file manager because it probably won't convert the links to files--which will render your "install" nonfunctional. Instead, open a terminal and go to ~/firefox-release/mozilla-1.9.2/ff-release/dist/. Then become root (using su) and do:

# cp -R -L bin /opt/firefox-release
# chown root:root -R /opt/firefox-release


You should now have a new directory in /opt called firefox-release. Inside it will be an executable file called firefox. If all went well, executing this file (NOT as root) will launch the browser.

2) Create a command that lets you launch the browser. As root, make a softlink from /usr/local/bin/firefox to /opt/firefox-release/firefox:

# ln -s /opt/firefox-release/firefox /usr/local/bin/firefox

3) Create a desktop file to introduce the new stuff to the menu. As root, create a file called firefox-release.desktop in /usr/local/share/applications (adding any directories that aren't already present.) Paste the following into firefox-release.desktop:

[Desktop Entry]
Encoding=UTF-8
Name=Firefox Release
Comment=Browse the World Wide Web
GenericName=Web Browser
X-GNOME-FullName=Firefox Web Browser
Exec=firefox %u
Terminal=false
X-MultipleArgs=false
Type=Application
Icon=/opt/firefox-release/icons/mozicon128.png
Categories=Network;WebBrowser;
MimeType=text/html;text/xml;application/xhtml+xml;application/xml;application/vnd.mozilla.xul+xml;application/rss+xml;application/rdf+xml;image/gif;image/jpeg;image/png;
StartupWMClass=Firefox-bin
StartupNotify=true
Name[en_US]=Firefox Release

Save the file and exit the editor.

You're done.

14 July 2010

Fixing OpenOffice.org font rendering in Debian Squeeze

I guess I'm on a roll with font rendering improvements...

After patching libcario2 in Squeeze, I noticed font rendering in OpenOffice.org was really awful. It may have been equally awful before and I never noticed. In any case, it's now something that needs attention.

Ugly fonts in OO.org have been reported under Ubuntu and other distributions as well. A good explanation of the problem (in Ubuntu, at least) and a workable solution is offered by Mike Kasic about halfway down the bug report at https://bugs.launchpad.net/ubuntu/+source/cairo/+bug/271283. I tried his suggestions on my Squeeze installation, and it worked. If you don't want to be bothered filtering through the bug report, here's the executive summary.

Fixing just the session
Open a terminal and do:
echo "Xft.lcdfilter: lcddefault" | xrdb -merge

Making the fix persist across sessions
echo "Xft.lcdfilter: lcddefault" >> ~/.Xresources

Apply the fix for all users all the time
As root:
# sudo sh -c 'echo "Xft.lcdfilter: lcddefault" > /etc/X11/Xresources/lcd-filter-lcddefault'

Note: I have only tried the first two above. I have not tested applying the change to all users.

The fix also works on my Sabayon Linux 5 install that uses the lcdpatch in cairo.

"Installing" handmade Firefox 3.6 in Debian Squeeze

[Update 2011-06-25: You should consider this post obsolete. See this post for more info.]

Yesterday we saw how to build Firefox 3.6 from sources. This post shows you how to "install" it.

The reason I put "install" in quotes is because it's arguable that what we're going to do is a real installation. In a real Linux installation, you splay the various bits and pieces of your app into /usr/local/bin, /usr/local/share, /usr/local/lib, and various other places (or /usr/bin, /usr/share, /usr/lib if it's an official distribution package). What we are going to do here is take the easy way out--but a way that lots of "packages" take. We're going to dump stuff into /opt.

If you open up {whatever}/firefox-mercurial/192src/objdir-ff-release/dist/bin/ (or wherever you built your sources), you'll see that quite a few of the items in the bin directory are relative links to resources outside bin. If we try a conventional copy of the bin directory to /opt, what we get won't work because the targets of those links won't be copied. You could copy the whole objdir-ff-release to /opt, which will copy the needed link targets, but this will produce something many MB more than we need. The solution is to convert the links into targets themselves when you copy the file. This is actually pretty easy to do using the command line.

Copy the bin
Open a terminal in {whatever}/firefox-mercurial/192src/objdir-ff-release/dist. From there, become root (using su) and then:

# cp -R -L bin /opt/ff-from-src
# chown root:root -R /opt/ff-from-src


You should now have a new directory in /opt called ff-from-src. Inside it will be an executable file called firefox, and what used to be links will now be actual files. If all went well, executing this file (NOT as root) will launch the browser.

Making commands
We will next do a couple things to let you launch your new Firefox as a command and add an item to your menu.

1. Using whatever mechanism you are most comfortable with, make a softlink called firefox in /usr/local/bin to /opt/ff-from-src/firefox. You'll need to do this as root.

2. Add a png icon called firefox-namoroka.png to /usr/local/share/pixmaps/mozilla. You'll probably need to add the pixmaps and mozilla directories. Again you'll have to be root to do this. The icon can be whatever you want the icon to be in your menu. I used this one, even though it's the same one that Swiftfox uses. I wanted an icon that said "Firefox" but that differentiated itself from the stock FF icon. I scaled the icon to 128x128. Another nice icon is this one, but in spite of the attribution given on the page, I'm not sure it's actually GPL or where it originally came from.

3. Create a file called firefox-namoroka.desktop in /usr/local/share/applications again adding any directories you need and again as root. Copy/paste the following into firefox-namoroka.desktop:

[Desktop Entry]
Encoding=UTF-8
Name=Firefox Namoroka
Comment=Browse the World Wide Web
GenericName=Web Browser
X-GNOME-FullName=Firefox Web Browser
Exec=firefox %u
Terminal=false
X-MultipleArgs=false
Type=Application
Icon=/usr/local/share/pixmaps/mozilla/firefox-namoroka.png
Categories=Network;WebBrowser;
MimeType=text/html;text/xml;application/xhtml+xml;application/xml;application/vnd.mozilla.xul+xml;application/rss+xml;application/rdf+xml;image/gif;image/jpeg;image/png;
StartupWMClass=Firefox-bin
StartupNotify=true
Name[en_US]=Firefox Namoroka

You should now have an entry in your desktop menu and other desktop integration niceness.

13 July 2010

Firefox 3.6 with pretty fonts in Debian Squeeze

[Update 2011-06-25: You should consider this post obsolete. See this post for more info.] 

Iceweasel 3.6 has yet to trickle down to Debian Testing and very well may not make it before the freeze. However, some of us would like to have some 3.6iness in spite of this. If you've tried downloading SwiftFox, IceCat or the Firefox 3.6 binaries, you know that you get a 3.6, but the font rendering looks poopy.

Here's what I did to compile FF 3.6 from sources and get the same smooth font rendering that you get with Iceweasel 3.5 from the Squeeze repo. I'm not an expert, but this seems to have worked.

The following is based mostly on Mozilla's documentation on a Simple Firefox Build and Linux Prerequisites.

Preproduction
First, create a working directory. I called mine firefox-mercurial. The reason for the name will become obvious shortly.

Next, get the tools you need to build stuff. Since there's no firefox package in the Debian repos, I used (as root):

# apt-get build-dep iceweasel

Then install a bunch of other stuff that is supposedly needed:

# apt-get install mercurial libasound2-dev libcurl4-openssl-dev libnotify-dev libxt-dev libiw-dev mesa-common-dev autoconf2.13 yasm

You will also have to add:

# apt-get install libidl-dev

This isn't documented anywhere that I know of. I found this out the hard way after my first attempts to compile failed.

Get sources
With a regular user terminal open in firefox-mercurial, use mercurial to get the sources:

hg clone http://hg.mozilla.org/releases/mozilla-1.9.2/ 192src

This will get you the latest, most update, bleeding edge version of 3.6--which may or may not be the same as the release version. For example, at the time of this writing, the latest version is 3.6.8pre and the latest release is 3.6.6. To specify the exact version you want, use #{tag}, where {tag} is  one of tags listed at http://hg.mozilla.org/releases/mozilla-1.9.2/. For example, to get and build FF 3.6.6:

hg clone http://hg.mozilla.org/releases/mozilla-1.9.2/#FIREFOX_3_6_6_RELEASE 192src

Getting the sources will take a long time, but not nearly as long as compiling will later on.

Next we need to move into the 192src directory and set up the mozconfig file that tells the system how to build firefox:

cd 192src
echo '. $topsrcdir/browser/config/mozconfig' > mozconfig
echo 'mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/objdir-ff-release' >> mozconfig
echo 'mk_add_options MOZ_MAKE_FLAGS="-j4"' >> mozconfig
echo 'ac_add_options --disable-debug' >> mozconfig
echo 'ac_add_options --disable-tests' >> mozconfig
echo 'ac_add_options --enable-optimize' >> mozconfig
echo 'ac_add_options --enable-system-cairo' >> mozconfig


The objdir-ff-release is the name of the directory that built stuff will end up in. You can change this name if you want. The line with --enable-optimize is optional. The last option above, --enable-system-cairo, I found looking through the list of available options, and I'm pretty sure it's what gives you nice font rendering in GTK+ environments.

Build the beast with

make -f client.mk

The build will take forever. Once the compile is done, the binaries will be in
{whatever}/firefox-mercurial/192src/objdir-ff-release/dist/bin/.
Execute the file firefox to make it go.

When you make it go, you'll notice that the app is identified by its code name, Namoroka.

Updating
I have not yet tried this, but according to Mozilla's documentation, to build a new version you'll need to update the sources with

hg pull -r default
hg update


I suspect you do this in the 192src directory and I suspect you'll need to rebuild as above afterward. Also, I suspect that in place of default above you'll want to use a valid tag (as when you first cloned the sources), but until I actually update I won't be able to say for sure.

Extra credit
Once I've done some more testing, I will be move the built files to /opt/firefox and add a *.desktop entry for it. The big question is whether I should call it 'Firefox' or 'Namoroka'.

09 July 2010

Ubuntu font rendering in Debian Squeeze

[Update 2011-06-25: Confirmed. Updating Iceweasel from http://mozilla.debian.net/ fixes fonts. See this post for more info. So there's no longer any real need to do what's below.]
[Update 2011-06-24: This whole business may be unnecessary as it appears installing a recent version of Iceweasel from http://mozilla.debian.net/ also installs new libcairo2 with decent font rendering. I've yet to do careful comparisons, but it's possible that this solves both "ugly rendering in general" as well as "ugly rendering in Firefox" issues.]
[Update 2011-03-08:]  Reader datSilencer points out that the location of the Arch patch has moved. Therefore, the process for extracting and applying the Arch patch won't work. I am updating the script but I won't be updating this post. If you want to do things manually, please consult the script for the needed changes.]
[Update 2010-09-23: I made a script to semi-automate a lot of the following.]

I love Debian. I really do. But one thing I don't love about Debian is the way it renders fonts in GTK. Or rather, the way Ubuntu renders fonts has spoiled me. After reading about how some people have successfully patched their libraries to use the same changes used by Ubuntu, I've finally succeeded myself. It's been so gratifying and such a good learning experience that I wanted to share.

The process below is based on information from the CrunchBang Linux Forums and from one quanliking. Huge, huge thanks to those people.

To get Ubuntu font rendering in Debian Squeeze, we need to download, patch, rebuild, and reinstall the libcairo2 package. If this breaks your system don't sue me. I am not an expert nor do I play one on TV.

Pre-production
Begin by making sure downloading of package sources is enabled for apt. The line below should be in /etc/apt/sources.list and not commented out:

deb-src http://ftp.us.debian.org/debian/ squeeze main non-free contrib

The actual address will differ depending on which mirror you set up your system to use, but there should be a line that begins "deb-src", has a mirror's address in the middle, and ends with "squeeze main non-free contrib" or "testing main non-free contrib".

Install the needed build tools (as root):

# apt-get install build-essential devscripts fakeroot
# apt-get build-dep cairo


As a regular user, create a new directory called patched-packages in your home directory.

Get the patches
Open the patched-packages directory you created above in a terminal (i.e., the prompt should read something like username@computername:~/patched-packages$).

At the command prompt:

mkdir libcairo2
cd libcairo2
mkdir downloaded-patches


We now need to get two sets of patches, one from Ubuntu and the other from Arch Linux. To get the Ubuntu patches, go to http://packages.ubuntu.com/lucid/libcairo2 and look at the list of links on the right. We want the file cairo_1.8.10-{#}ubuntu1.debian.tar.gz. Download it into ~/patched-packages/downloaded-patches and expand it. This should produce a new directory inside ~/patched-packages/downloaded-patches called debian (i.e., you should now have a ~/patched-packages/downloaded-patches/debian).

I'm not yet sure what the original source of the Arch Linux patch is, but apparently we need it. So go to http://aur.archlinux.org/packages.php?ID=17327 and download the file cairo-respect-fontconfig.patch into ~/patched-packages/downloaded-patches

You're done getting patches.

Get the sources
We now need to get the Debian source package for libcairo2. In a terminal inside ~/patched-packages/libcario2,

mkdir deb-sources
cd deb-sources
apt-get source cairo
cd ./cairo-*


Then copy the patches we downloaded earlier to the Debian package's patches directory:

cp ../../downloaded-patches/cairo-respect-fontconfig.patch ./debian/patches/
cp ../../downloaded-patches/debian/patches/04_lcd_filter.patch ./debian/patches/
cp ../../downloaded-patches/debian/patches/06_Xlib-Xcb-Hand-off-EXTEND_PAD-to-XRender.patch ./debian/patches/


Next, apply the patches to the sources:

patch -p1 -i ./debian/patches/cairo-respect-fontconfig.patch
patch -p1 -i ./debian/patches/04_lcd_filter.patch
patch -p1 -i ./debian/patches/06_Xlib-Xcb-Hand-off-EXTEND_PAD-to-XRender.patch


We now need to modify the changelog to indicate that we've diddled with the package and set a version increment:

dch -i

This will open a text editor. Once there, add

David Turner's ClearType-like LCD filtering patch and fix.

after the asterisk at the top and then save and exit.

(Note: Instead of dch -i above you can also use dch -l {your initials}.)

Build and install
Time to build it. Continuing from where we were in the terminal above (i.e., inside something like ~/patched-packages/libcairo2/deb-sources/cairo-1.8.10) do

dpkg-buildpackage -rfakeroot -us -uc

The result should be a bunch of new packages inside ~/patched-packages/libcairo2/deb-sources/

Look if you don't believe me. All that's left is to install. Open a root terminal and go to the ~/patched-packages/libcairo2/deb-sources/ directory. Then do:

# dpkg -i *.deb

This will install all the debs that were made, of which you may actually only need a subset. Apart from taking up some disk space the extra packages won't hurt anything, and if you install a package in the future that needs one of these, you'l be glad you installed them now.

Congrats. You should now have (IMHO) much improved font rendering. This should hold you until Debian releases a new libcairo2. If the new libcairo2 release doesn't have the "Ubuntu patches" already built in, you'll have to repeat the above process, making sure you get patches that are appropriate for the new version and that there are no additional patch files. (If there are, you will need to copy/add them before rebuilding.)

Rolling back your system to the original Debian packages should be as easy as using Synaptic to "Package -> Force Version..." to the original libcairo2 packages.

Happy building.

04 July 2010

Debranding Firefox in PCLinuxOS

I'm not a huge fan of third-party branding. One of my (minor, when put into perspective) gripes about PCLinuxOS is that they sorta go nuts with it. One of the apps that's the target of their branding is Firefox. If you are equally bugged by this, debranding the default profile used as the template for new profiles isn't that hard.
  1. Download the official firefox-3.{whatever}.tar.bz2 archive from Mozilla's servers. Be sure to download the version that's the same as the one that is already installed on your machine.
  2. As root, deflate the archive. I am pretending we're in /opt and got a /opt/firefox directory:
    # tar -jxvf firefox-3.{whatever}.tar.bz2
  3. Again as root, replace /usr/lib/firefox-3.{whatever}/defaults/profile with /opt/firefox/defaults/profile
Now you can delete the profiles in ~/.mozilla/firefox. (This will of course wipe out all your old bookmarks, etc. Jump through the needed hoops now if you want to save anything.) When you restart Firefox you'll now get the profile defaults, links, etc. that the Mozilla upstream devs thought you would want. The same will be true for any new users or profiles you create from now on.

The downside to this is that to keep the PCLinuxOS branding at bay you'll need to repeat steps 1-3 every time a new FF update is installed.

03 July 2010

Fixing ugly fonts in Sabayon Firefox

I've been taking the Gentoo-based Sabayon rolling release distribution for a spin. One of the things that you'll notice is that some fonts in Firefox look ghastly horrible. Luckily, there's an easy fix. The problem involves the rendering of Helvetica, Lucida, and Times fonts and is discussed (and solved) on the Gentoo mailing list.

Instead of editing /etc/fonts/local.conf, I changed my ~/.fonts.conf file. I got better results using "Sans" than "DejaVu Sans" and in a similar spirit I used "Serif" instead of "DejaVu Serif". My entire .fonts.config looks like:
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>

<!-- see http://www.mail-archive.com/gentoo-user@lists.gentoo.org/msg83300.html -->
<!-- Replace Helvetica with DejaVu Sans -->
<match target="pattern" name="family">
        <test name="family" qual="any"><string>Helvetica</string></test>
        <edit name="family" mode="assign">
                <string>Sans</string>
        </edit>
</match>

<!-- Replace Lucida with DejaVu Sans -->
<match target="pattern" name="family">
        <test name="family" qual="any"><string>Lucida</string></test>
        <edit name="family" mode="assign">
                <string>Sans</string>
        </edit>
</match>

<!-- Replace Times with DejaVu Serif -->
<match target="pattern" name="family">
        <test name="family" qual="any"><string>Times</string></test>
        <edit name="family" mode="assign">
                <string>Serif</string>
        </edit>
</match>
<!-- -->

<match target="font" >
  <edit mode="assign" name="hinting" >
   <bool>true</bool>
  </edit>
</match>
<match target="font" >
  <edit mode="assign" name="hintstyle" >
<!--
   <const>hintmedium</const>
-->
   <const>hintslight</const>
  </edit>
</match>
<match target="font" >
  <edit mode="assign" name="rgba" >
   <const>rgb</const>
  </edit>
</match>
<match target="font" >
  <edit mode="assign" name="antialias" >
   <bool>true</bool>
  </edit>
</match>

</fontconfig>

Speaking of font rendering, Sabayon has default font rendering that's almost as nice as Ubuntu's. IMHO the only thing that gives Ubuntu the edge is a bit more contrast. If I find a fix for this, I will post this as well.

27 June 2010

Thunderbird 3 new account config workaround

Thunderbird versions 3.0 and 3.1 have a feature that's meant to make configuring new accounts easier but in fact may just make life more complicated for some users. When you set up a new account, the new Tbird account wizard asks you for your name, email address, and password. It then automatically tries to configure the account for you by probing various "best options" using common conventions for port numbers, server names, etc. ... then Voila! you have a fully functioning account configured with SSL and the like if it's available, all without the hassle of dealing with entering server name and port numbers and "Use TLS/Use SSL" options.

The problem is that there's no way to override this. The new account wizard doesn't ask if you want to try an autoconfig or do a manual config--it just starts the autoconfig automatically. There is a "Manual Setup" button on the autoconfig dialog, but there's no way to press it before the autoconfig starts.

"No big deal," you say. "Just wait for the autoconfig to run its course and then go back and manually set the parameters you don't like." Well, that only works for some options. In particular, the "Account Settings" dialog doesn't let you change from IMAP to POP--so if the autoconfig decided that IMAP was your "best option", then that's what you're stuck with. And I've found no way to hit the "Manual Setup" button on the autoconfig dialog before the IMAP/POP selection has been made.

The problem has been reported in bug reports, and the developers' response seems to be, "We will address this in a future release."

"Ah," you say. "It's best to stick with Thunderbird 2 then." However, that's not such an attractive option. Quoting from the Mozilla website: "Please note that Thunderbird 2.0.0.24 is the last planned security and stability release of Thunderbird 2.0. We encourage you to update to Thunderbird 3.1."

So here's a workaround for dealing with v3's new account issues.

In the new account wizard dialog, enter a short bogus email address:
Then click "Continue".

The wizard will vainly try to find the bogus address and eventually give up.
Now is the time to select whether you want POP or IMAP. You will not get a second chance to do this. After you have made the appropriate selection, click "Manual Setup..." and then enter the real account details.

It may not be a pretty, but it seems to work.

17 June 2010

(No) icons in GTK buttons

I don't know if this has anything to do with the no icons in menus issue, but the solution is darned near the same. I noticed that my Ubuntu Karmic doesn't serve up icons in its buttons with GTK apps in GNOME. The fix comes from someone trying remove his icons:
There is now a new key in GNOME Configurator Editor. Below are the steps to disable buttons on icons in GNOME 2.26 and above.
  1. Press Alt + F2
  2. Type gconf-editor and hit Enter.
  3. Go to Desktop –> GNOME –> Interface
  4. Uncheck the key buttons_have_icons

Just check the box to get your icons back.

12 May 2010

startupmanager is your friend

After a recent update to my Karmic system, I noticed my boot screen icon's colors went all hallucinogenic. I later noticed that doing a Ctl-Alt-F1 resulted in a console that was nearly impossible to read: the text was a veeery dark grey. I figured the problems were related and I was right.

Using startupmanager (in the repositories), I was able to fix both problems by setting the boot screen bit depth from 8 bits to 16 bits. Dunno exactly what happened, but it's fixed now.

Configuring grub2/boot stuff is definitely easier with the startupmanager around. Recommended.

11 May 2010

Getting your menu icons back in GNOME 2.30

According to this post, the Interface tab in GNOME's Appearance Preferences has been removed in GNOME 2.30. I can confirm that as of this writing the tab isn't available under Debian Squeeze.

Thia means if you want to have icons in menus enabled (who doesn't?) you need to resort to gconf-editor (i.e., Applications -> System Tools -> Configuration Editor) and set the key:

/desktop/gnome/interface/menus_have_icons

I mean really. Who doesn't want icons in their menus?

30 March 2010

sox and mp3

This is just an info nugget that I hope will save someone else the half-hour it just cost me. In Debian, sox won't play mp3 files by default--even with the baddest, ugliest gstreamer bits installed. The magic bit of fufu dust you need to make sox play mp3 is the libsox-fmt-mp3 package. But as long as you're at it, you may as well just install all the libsox formats with:

# aptitude install libsox-fmt-all

28 March 2010

GNU IceCat and file managers


There's no shortage of essentially identical Mozilla-derived browsers in Linuxspace now. Firefox is the official Mozilla product. Two better known variations are Iceweasel--a Debian project that replaces the not-really-covered-by-a-free-license Mozilla branding stuff in Firefox with really-covered-by-a-free-license branding, and Swiftfox--which offers processor-specific optimized compiles of the Mozilla code.

Perhaps a lesser-known variant (as of this writing) is GNU IceCat. IceCat is very similar to Iceweasel in that its main purpose for being is to remove the non-libre Mozilla bits from Firefox. It goes one step further than Iceweasel in its pursuit of libreness in that it redirects its add-ons explorer to a GNU-maintained list of add-ons that are fully-libre. Don't worry--you can still install any add-on that you can in normal Firefox by visiting Mozilla's add-on site. Seems like a winner: promoting libre software without limiting the use of proprietary software.

However, more interesting than the above for me is something I've found to be case with the latest version of IceCat that is not the case with the other three. In any of the other three (or four if you count hand-installing the official Mozilla binaries rather than the Ubuntu and Debian packages), no matter what I've tried, I have not been able to tell the browser in the downloads dialog to "open containing folder" using the file manager of my choice. Whatever I've tried, they all insist on opening folders in Nautilus. However, IceCat has a file: application type with which you can set the desired file manager just as you might with any other type. And there was much rejoicing.

The weird thing is that I seem to recall that the file: application type was present in older versions of Firefox--e.g. as included in Jaunty. So I don't know if the current lack of the file: type is a temporary abnormality or the sign of things to come on all fronts. Whatever the case, IceCat is my default browser on my Debian machines because I tend to use a custom Openbox/Thunar environment most of the time. It not my default on Ubuntu because it--along with Swiftfox and the binaries directly download-able from Mozilla--does not respect your system font rendering settings. (It's always something, isn't it?)

There's a PPA for Ubuntu users and deb packages for 32-bit Debian users if you wanna give it a go.

23 March 2010

Ubuntu as not Linux

!=

?

Yesterday, I commented on how there seems to be a concerted effort by Canonical to brand Ubuntu as an independent OS and conceal the Linux that it is. I based this view mostly on UI and software developments I've seen in the last few Ubuntu releases. Today, I got a bit more curious about the PR side of things and had a look at the Ubuntu website.

As a start, I wanted to see how prominently the site featured the term "Linux". And after visiting a whole bunch of pages a typical user would, I couldn't find a single use of the term. Compare this to the respective sites for Debian, Fedora, Mandriva, and even openSuSE, all of which state very plainly on their home pages that they are Linux-based distributions.

So, I fired up Google and searched for "linux" site:www.ubuntu.com to see if I missed something. Excluding mentions in security reports (which a typical user will almost certainly never access), the term "linux" popped up in Google's results in three places:
  1. The Ubuntu Server Edition page--which a regular (i.e., desktop) user will likely never visit.
  2. The Ubuntu MID Edition page--which is intended for use by industry folk building MIDs, not by end users.
  3. In passing in the list of download options. (Look for it ... can you find it?)
This is making me sad.

22 March 2010

Gamesters of Triskelion

==
?

Like a few others, I am becoming increasingly concerned about the direction that Ubuntu seems to be headed. In essence, it seems that there is a concerted effort 1) to brand Ubuntu in such a way that it conceals the Linux that it is and 2) to do this in a way, along with some other stuff, to lock users into the OS. In other words, the motivation behind Ubuntu may not be to create a better Linux through which the parent Canonical will make money by providing support to Enterprise and other commercial users; rather the whole raison d'etre may be to develop a platform to market and sell to regular desktop users proprietary services that will increasingly come glued to the platform. And it just so happens that a Linux base provides most of the functionality for the required platform--as well as a core of well-meaning developers who are willing to work for free and who will have done all the heavy lifting for you

In other other words, I am concerned that the monetization of Ubuntu via content services is the gold standard and that the love-for-all goals stated in Canonical's publicity is just propaganda meant to get people on all sides on board. I really, really, really hope I am wrong and that I am being far, far, far too cynical because I've been well conditioned with the nutty stuff that Microsoft is known for doing, Apple has started doing, and Novell is doing with openSuSE.

In any case, based on my growing concern I did a tiny bit of research into Canonical Ltd. Just about everyone knows that it was founded by Mark Shuttleworth, who is (according to Wikipedia) South African by birth, a SA and UK citizen, and a space tourist. But not everyone may know that the company he founded to develop Ubuntu is registered in the Isle of Mann.

It's worth noting that the Isle of Mann is not part of the UK--it is a British Crown dependency. However, it is a great place to setup a business because, "The Isle of Man is a low tax economy with no capital gains tax, wealth tax, stamp duty, death duty or inheritance tax and income tax rates of 10% and 18%; corporation tax is at 0%." In fact it is quite well known as a center for offshore banking, and, "banking and other services now contribute the great bulk of GDP."

I now place the tinfoil hat firmly upon my head.

The national symbol of the Isle of Mann is the triskelion:

Compare this with:


Just a coincidence or a weird joke?

06 March 2010

Karmic and Pulseaudio (not SOLVED)

I have been bitten by the bug reported at https://bugs.launchpad.net/pulseaudio/+bug/352732 . In fact, I was bitten by this back in Jaunty. There the problem was isolated to logging out of a non-Gnome session (and into Gnome? I forget exactly). In Jaunty I solved the problem by killing pulseaudio before terminating non-Gnome sessions. Now in Karmic this solution doesn’t seem to work in all situations, so I am trying the suggestion in post #77. Namely, in /etc/pulse/default.pa, comment out the line load-module module-device-restore

Here is the snippet from my /etc/pulse/default.pa:

### mfk addition: comment out "load-module module-device-restore"
### see https://bugs.launchpad.net/pulseaudio/+bug/352732 #77
#load-module module-device-restore

We’ll see how it goes.

Update (2010-03-10)
I just noticed that my soundcard input selection is being disrespected. There are two inputs on my lappy, and the system always defaults to input 1 no matter what. I don't know if this is related to the above or not.

Update (2010-03-12)
I re-enabled load-module module-device-restore , and my input settings began to be respected. However, the trashing of output settings returned. So ... pick your poison. I guess I am coming down on the side of those who complain that Pulseaudio is (still) not ready for prime time. Or is this a problem with the way it's implemented in Ubuntu? 

15 February 2010

Karmic, openbox, and messed up desktop numbers (SOLVED)

I think it started after I upgraded to Karmic. When logging into an openbox session, the number of desktops I was getting was equal to one ... no matter what I set the number to during the previous session. Herein I describe a fix.

The script that gets called when GDM starts up an openbox session is /usr/bin/openbox-session. It just so happens that before I upgraded to Karmic, I had created a new script in /usr/local/bin/skinnydebbie-session that was a copy of the Jaunty version of /usr/bin/openbox-session with a few changes in the config files called. The interesting thing was that after the Karmic upgrade I did not have the wrong-number-of-desktops problem when starting from /usr/local/bin/skinnydebbie-session.; it only manifested itself when starting from /usr/bin/openbox-session. A quick comparison of the two files revealed a fix. At the top of my /usr/local/bin/skinnydebbie-session is the following snippet of code which I am sure was inherited from the Jaunty version of /usr/bin/openbox-session and was probably left off the Karmic version:

# Clean up after GDM
xprop -root -remove _NET_NUMBER_OF_DESKTOPS \
      -remove _NET_DESKTOP_NAMES \
      -remove _NET_CURRENT_DESKTOP 2> /dev/null

I added this snippet to my ~/.config/openbox/autostart.sh and voila! I get the right number of desktops. I am pretty sure it would work if I added it to /usr/bin/openbox-session instead.

This should probably be a bug report, but I'm feeling a bit too lazy now to do it.

23 January 2010

Squeeze and the Java plugin (SOLVED)

Another Squeeze issue popped up: the Sun Java plugin (i.e., sun-java6-plugin) doesn't work. It took a bit of poking around to find a fix, but here it is. As root in a terminal:

# nano /etc/sysctl.d/bindv6only.conf

Then change
net.ipv6.bindv6only = 1
to
net.ipv6.bindv6only = 0

Finally,
# invoke-rc.d procps restart

I have no idea what other positive or negative ramifications this will have to your system, so proceed with caution. I'm pretty sure you can undo any damage by setting the 0 back to 1 and doing the invoke-rc.d call over.

FWIW, the icedtea6-plugin doesn't work either, but I haven't been able to figure out that one.

16 January 2010

Squeeze and GRUB dual boot problems (SOLVED)

Earlier this evening, I installed a command-line version of Debian Squeeze (i.e., still "testing" as of this writing) from the netinstall CD alongside a regular Ubuntu Karmic installation and had an issue with GRUB that nearly had me cleaning my underwear.

Toward the end of the installation, the Debian installer told me that it saw I had Ubuntu installed and so would I want to install GRUB? It also assured me that it recognized that I had Ubuntu installed and that everything would be ok.

I've been through similar prompts with dual-boot installations before, and indeed everything has always gone just swimmingly. So, I said, "Sure." What I didn't know was that Squeeze is using the new and possibly-not-entirely-ready-for-prime-time GRUB 2. (I guess Karmic is as well.)

When I rebooted, GRUB gave me options for the new Squeeze install, but any trace of the Ubuntu install was gone. Hunting for /boot/grub/menu.lst gave me nothing. That's when I discovered that Squeeze installed GRUB 2 and most of the GRUB repair stuff on the Internet was obsolete. I was about the resort to drastic measures when this post inspired me to try

# update-grub

and it worked.

02 January 2010

Changing keyboard layouts

Just a quick post to mention an easy way to change keyboard layouts. From the command line:

setxkbmap [layout]

For example, I sometimes need to switch to Turkish Q:

setxkbmap tr

And then back to US:

setxkbmap us

Cheers.