Pages

February 15, 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.

January 23, 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.

January 16, 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.

January 02, 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.

December 17, 2009

JWM and GDM in Ubuntu

JWM is a lean yet featureful window manager. It's the default WM in Puppy Linux and Damn Small Linux. I wanted to do some work with JWM on my Ubuntu Jaunty machine, but I noticed after installing it I didn't get an entry in the GDM login screen giving me the option of using it. Fortunately, this is easy to fix.

As root, create a file called jwm.desktop in /usr/share/xsessions containing the text below:
[Desktop Entry]
Encoding=UTF-8
Name=JWM session
Comment=Use this session to run JWM as your desktop environment
Exec=jwm
Icon=
Type=Application

(Note that the file has to be in /usr/share/xsessions -- it won't work if you put it in /usr/local/share/xsessions even though you'd think it should.)

Logout, and you should now have an entry that reads "JWM session" in GDM's session selector that starts JWM.

November 24, 2009

Anti-aliased fonts in Wine

Anti-aliased fonts in Wine seem to be disabled by default. This leads to some pretty ugly font rendering. (No flames, please. If you don't like anti-aliased fonts, then please move along.)

An almost-in-passing comment on this post tells you an easy way to turn on anti-aliasing. I tried it on my Ubuntu Jaunty installation, and it seems to work fine. To spare you the need to reference and hunt and peck the original post, here's what I did:

  1. Open the file ~/.wine/user.reg in a text editor.
  2. Change the entry "FontSmoothing"="0" to "FontSmoothing"="1"
  3. Close your text editor
  4. There is no fourth step.
Enjoy.

Later addition: There is a more comprehensive discussion of enabling anti-aliasing (including ClearType) here.

November 22, 2009

Different GTK settings for different sessions

Here's the situation:

You like using different window managers for different things. For example, sometimes you want to use IceWM, other times Openbox, etc. This is easy enough to do if you are using GDM, but there's a small thing that bothers you. All the above WMs will use the same configuration files for GTK settings, but you want to use different settings for each. For example, in Openbox you may want to use Tango icons but you like the default Gnome icons better in IceWM.

I describe below a way you can make this happen. It's a tiny bit hackish, but it seems to work just fine. It assumes you are not using gnome-settings-daemon.

GTK settings--the easy way

First of all, make life easy for yourself and install LXAppearance. It is part of the LXDE desktop environment, but many distributions let you install it as a standalone package. It is the best tool I know of to adjust GTK appearance settings. You do not need LXAppearance to do what I describe below, but you will love life a little more if you have it.

Different settings per Window Manager

Here's where the fun begins. This should work with any WM that has a startup script (required) and a shutdown script (strongly recommended but not strictly necessary). I used IceWM to test the idea.

GTK settings are stored in the .gtkrc-2.0 file in your home directory. What we are going to do at startup is redirect this by doing the following:
  • create a file .gtkrc-icewm-2.0 to store the GTK settings for icewm
  • copy the original .gtkrc-2.0 file to a backup location.
  • delete the original .gtkrc-2.0 file
  • then create a link from .gtkrc-2.0 to .gtkrc-icewm-2.0
And at session end, we will:
  • remove the link, and
  • restore the backed up .gtkrc-2.0
There are a few test we should do in the process to make sure we don't mess anything up. Below are experts from my ~/.icewm/startup and ~/.icewm/shutdown files that outline the needed tests.

Excerpt from ~/.icewm/startup:
### This section lets icewm use its own gtk settings ###
# it uses the following files
# .gtkrc-2.0 original gtk settings file
# .gtkrc-icewm-2.0 file where gtk settings for icewm session are stored
# .gtkrc-2.0-orig.BAK file where original .gtkrc-2.0 is stored
#
# if .gtkrc-icewm-2.0 doesn't exist, make it
if [ ! -f ~/.gtkrc-icewm-2.0 ] ; then
if [ -f ~/.gtkrc-2.0 ] ; then
cp ~/.gtkrc-2.0 ~/.gtkrc-icewm-2.0
else
touch ~/.gtkrc-icewm-2.0
fi
fi

# if .gtkrc-2.0 is a regular file, move .gtkrc-2.0 to a backup file,
# then link to .gtkrc-icewm-2.0. (This should be undone in shutdown.)
if [ -f ~/.gtkrc-2.0 ] ; then
cp ~/.gtkrc-2.0 ~/.gtkrc-2.0-orig.BAK
ln -sf ~/.gtkrc-icewm-2.0 ~/.gtkrc-2.0
fi
#
### end gtk settings stuff
Excerpt from ~/.icewm/shutdown:
# if .gtkrc-2.0 is a link then remove link and restore backed up .gtkrc-2.0
if [ -h ~/.gtkrc-2.0 ] ; then
rm ~/.gtkrc-2.0
cp ~/.gtkrc-2.0-orig.BAK ~/.gtkrc-2.0
fi
If you don't do the shutdown bits, then the link to the .gtkrc-icewm-2.0 file will remain in place when you start a session in a different WM. This means that every WM you use that doesn't use gnome-settings-daemon (and maybe xfce-mcs-manager) must do a restore on startup if things are not to get really wonky.