Pages

December 20, 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.

December 18, 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.

October 21, 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.

October 19, 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.

October 14, 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.

September 29, 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.