Pages

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.

October 26, 2009

issues with libtrash and ROX or Firefox

libtrash is a shared library by Manuel Arriaga that gives Linux delete operations a trashcan behavior. When I tried it under Debian Etch with ROX, I don't remember having any problems. This weekend I gave it a go with Ubuntu Januty, and, sadly, it is having issues. (I haven't tried it on Debian Lenny yet.)

With both Openbox or IceWM, ROX started behaving a bit strange. In particular, any attempts to move into parent directories took a very, very long time.

There are also issues with Firefox. libtrash's website points out a problem with segfaults when starting up on some systems. I didn't see segfaults on my system; instead Firefox just didn't want to start. Even from the command line, all I got was a stuck process (no debug/warning/etc. messages).

I really hope these issues get ironed out because when it works, libtrash is pretty cool.

October 06, 2009

ssh via Cygwin

Argh. I am trying to set up Unison on my Windows XP box at work. Unison needs an ssh connection, and the ssh server I had been using, KpyM Telnet/SSH Server, just doesn't seem to get along with Unison. This has led me try try the ssh server in Cygwin, and all I can say is "Ouch."

While Cygwin is truly a blessing, it is not exactly easy to set up. If you are trying to set up a ssh server with it, I found the directions here to be a godsend. Be sure to read it carefully as there are lots of little bits and pieces that can be messed up in the default install. In particular, I ran into a roadblock with group IDs right, and this solved it.

September 29, 2009

Starting up gnubiff



I am using gnubiff as my email notifier because it's cuter and more flexible than the defacto standard Mail Notification. In fact, I use two different instances of gnubiff to provide notification for two different groups of email accounts. (Yeah ... I have too many email accounts.)

However, one of gnubiff's issues is that once it encounters an error (such as if the Internet connection isn't up) it tends to get stuck even when whatever caused the error is fixed. To help with this problem, I wrote a script that I call when my session starts up. The script waits until the Internet connection is up before starting my biffs. You'll need to modify the specific biff/gnubiff/whatever calls for your needs.
#!/bin/bash

# Copyright (c) 2009, Mithat Konar
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without 
# modification, are permitted provided that the following conditions are
# met:
# 
#     * Redistributions of source code must retain the above copyright 
#       notice, this list of conditions and the following disclaimer.
#     * Redistributions in binary form must reproduce the above copyright
#       notice, this list of conditions and the following disclaimer in the
#       documentation and/or other materials provided with the
#       distribution.
#     * Neither the name of the  nor the names of its
#       contributors may be used to endorse or promote products derived
#       from this software without specific prior written permission.
# 
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# Delays the launching of biffs so the network can get setup.
# Requires wget, zenity.

MAX_TRIES=4   # max number of attempts to verify connection
DELAY=15   # time between attmepts to verify connection
TEST_URL=http://www.google.com # the URL used to verify connection
TMP_FILE=/tmp/start-biffs-mfk # a needed temp file; must be user r-w

###########################################################################

rm -f $TMP_FILE
numTries=0
while [ "a" == "a" ]
do
if [ $numTries -ge $MAX_TRIES ] ; then
zenity --question --title "biff startup issues" --text "I haven't been able to detect an Internet connection.\n\nShould I continue trying?"
if [ "$?" == "0" ] ; then
numTries=0
else
exit 1
fi
fi
wget $TEST_URL -O $TMP_FILE
if [ -s $TMP_FILE ] ; then
break 
fi
sleep $DELAY
let numTries=numTries+1
done
rm -f $TMP_FILE

###########################################################################
sleep 5
gnubiff -n --systemtray -c ~/.gnubiffrc-gmail&
sleep 10
gnubiff -n --systemtray -c ~/.gnubiffrc-misc&
# the following isn't really a biff, but it's close enough to count as one
sleep 10
~/Apps/scripts/email-notify-mfk&

September 25, 2009

Running commands on GNOME logout

This post deals with GNOME, which disqualifies it from any reasonable "light-and-lean" discussion, but I don't exactly know where else to make a note of this.

One of the bigger omissions from GNOME is that there is no built-in mechanism for executing commands at logout. I discovered this the hard way when trying to set up MPD to run completely in userspace (to be documented in an upcoming post). However, it is possible to make GDM run arbitrary stuff at the end of the session, and that can be used to good effect as described here. In the event that that link goes bad, in summary what you do is edit /etc/gdm/PostSession/Default
and add
logoutscript="$HOME/.gdmlogout";
if [ -x "$logoutscript" ] ; then
su $USER -c "$logoutscript"
fi
to the file. Then create a file .gdmlogout in your home directory and make it executable.

You need to note that this will only work if you are using GDM and the .gdmlogout file will execute no matter what desktop environment you log into.

September 14, 2009

Use ROX-Filer to open containing folders in Firefox/Iceweasel (Part 2)

About a year ago, I wrote up a method for getting Firefox/Iceweasel to open files in ROX-filer in Debian Etch. Recently, Into.The.Void wrote up a much more sane way to accomplish the same thing in Gentoo that works with more recent versions of ROX.

ROX's -U option that Into.The.Void uses is not available in the version of ROX that's in Etch, but it is available in Lenny. (You have updated to Lenny, haven't you?) The bad news is that, the file used in Into.The.Void's script, /usr/lib/rox/ROX-Filer/AppRun, is not part of the ROX package in Lenny. But the good news is that it is trivially simple to change the script so that it does work in Lenny.

So, here is Into.The.Void's method adapted to Lenny:

As root, make a new file /usr/local/bin/roxuri and copy the following into it:
#!/bin/sh
exec rox -U "$@"
Make the new file executable for all by using ROX or by issuing the command:

chmod a+x /usr/local/bin/roxuri

Open Firefox/Iceweaswel and set it to use the script to open files with Edit -> Preferences -> Applications: file and selecting /usr/local/bin/roxuri

Enjoy.

I don't know if this will work with Ubuntu because for some strange reason Ubuntu's version of ROX in 9.04 is quite a bit older than what ships in Lenny.

August 13, 2009

SkinnyDebbie for Lenny



I just released an advanced beta (i.e., good enough for daily use) of the SkinnyDebbie light-and-lean flavorizer for Debian Lenny.

Please, do go forth and enjoy.

June 09, 2009

Xstarfish

Xstarfish is another tool you can use to set your screen's background image. However, unlike other wallpaper tools that simply paste pictures into the background, Xstarfish creates a new random image everytime it is invoked; you can also set it to periodically generate a images. I won't go into how to use it here; the man page is clear enough.

Urukrama's Weblog has a couple nice screenshots to give you an idea what it does.

A word of warning: if you go for the '-s full' option, it will eat a lot of cycles before it shows anything.

via Urukrama's Weblog

June 07, 2009

Nitrogen

Nitrogen is a friendly tool you can use to set your screen's background image (i.e., wallpaper). To select a new background image, launch nitrogen from the command line, passing it the directory in which you store your background images:

nitrogen /path/to/background/images

This brings up a GUI from which you can select, stretch, etc. your desired image.

You can restore the most recently set background image with the command:

nitrogen --restore

If you place this command in your session startup scripts, every time you login to your session nitrogen will restore your background image.

The only problem with nitrogen is that its image browser expects to be told the directory to search for images. In other words, it does not have a built-in directory browser. To that end, I wrote the following little script to wraps nitrogen inside a directory selection GUI. Enjoy.
#! /bin/bash

# Mithat Konar 2009-06-07
# Wraps nitrogen inside a directory selection GUI.
# Requires: nitrogen, zenity

ui_browseTitle="Select a directory (Cancel to quit)"

theDirectory=~

while [ "$theDirectory" != "" ]; do
theDirectory=$(zenity --file-selection --title "$ui_browseTitle"  --directory --filename="${theDirectory}/");

if [ "$theDirectory" != "" ]; then
nitrogen --no-recurse "$theDirectory"
fi
done

May 12, 2009

Thanks, Yellow Dog! :-)

Executive summary:
If you are having trouble getting Debian Lenny to give you anything other than 800x600 resolution on a Macintosh Cube, try the xorg.conf file below.

The long version:
In a previous post, I mentioned how easy it was to tweak the Etch-based version of SkinnyDebbie so it worked on a Macintosh Cube. More recently, I've directed some energy into getting Lenny up and running on the Cube as a precursor to making the upcoming Lennified version of Skinny work on it as well.

My adventure started by installing the Xfce version of Lenny on the Cube, and it worked ... sort of. As long as I was happy with 800x600 resolution, it worked fine. As far as other resolutions go, there were none. 800x600 was the only thing available. Much Googling and dinking around with /etc/X11/xorg.conf changed nothing or made the situation worse.

So, I tried a full Gnome install. Same thing. I tried building a system from the ground up, adding all the bits and pieces incrementally. I got no further than installing xserver-xorg. Groan. More Googling and I learned that the r128 driver used by the ATI Rage 128 Pro card has been relegated to legacy status. Despondency ensues.

I then turned my attention to other distributions in the hope that whatever goofy thing was responsible for this was resolved there. Ubuntu? Nope. PPC no longer officially supported, and a recent install disk wouldn't even pass Go. Fedora? Worth a shot ... I downloaded the Xfce spin and ... exact same behavior. More despondency.

Then I remembered Yellow Dog Linux. YDL is a distribution specifically targeting PPC machines, including the Sony Playstation and older Macs. The number of packages supported by YDL is fairly limited, but, hey, a 1280x1024 Cube beats a 800x600 Cube even if it means having to compile everything yourself. So I gave it a shot ... and it worked! Oh, what glory. Gnome and Enlightment only, but it worked.

Then I had an idea. What if I take the display-related stuff in YDL's xorg.conf and use it in Lenny? I was fully expecting a catastrophic video fail with this, but maybe I would learn something in the process. And, much to my surprise, it worked!

Gasp.

Hoo-ray! Full resolution Macintosh Cube Lenny at last!

Now, I know I'm not the only one with this problem. I suspect there are at least ten of us that are in this boat. So for the benefit of the remaining nine, I present below the xorg.conf file that finally did the trick. I haven't spent any time trying to figure out what the magic change is, I'm just so jazzed that it works that I wanted to share.
# xorg.conf (X.Org X Window System server configuration file)
#
# This file was generated by dexconf, the Debian X Configuration tool, using
# values from the debconf database.
#
# Edit this file with caution, and see the xorg.conf manual page.
# (Type "man xorg.conf" at the shell prompt.)
#
# This file is automatically updated on xserver-xorg package upgrades *only*
# if it has not been modified since the last upgrade of the xserver-xorg
# package.
#
# If you have edited this file but would like it to be automatically updated
# again, run the following command:
#   sudo dpkg-reconfigure -phigh xserver-xorg

Section "InputDevice"
Identifier    "Generic Keyboard"
Driver        "kbd"
Option        "XkbRules"    "xorg"
Option        "XkbModel"    "pc104"
Option        "XkbLayout"    "us"
EndSection

Section "InputDevice"
Identifier    "Configured Mouse"
Driver        "mouse"
EndSection

Section "Device"

#Option    "ShadowFB"    "true"
#Option    "fbdev"    "/dev/fb0"
#BusID    "0:0:0"
Identifier  "Card0"
Driver      "fbdev"
Option        "UseFBDev" "true"
EndSection


Section "Monitor"
### Comment all HorizSync and VertSync values to use DDC:
Identifier   "Monitor0"
ModelName    "Monitor Model"
### Comment all HorizSync and VertSync values to use DDC:
HorizSync    30.0 - 81.0
VertRefresh  56.0 - 60.0
Option        "DPMS"
EndSection

Section "Screen"
Identifier "Screen0"
Device     "Card0"
Monitor    "Monitor0"
DefaultDepth     24
SubSection "Display"
Depth     8
Modes    "1024x768"
EndSubSection
SubSection "Display"
Depth     16
Modes    "1024x768"
EndSubSection
SubSection "Display"
Depth     24
Modes    "1280x1024" "1280x960" "1152x864" "1024x768" "800x600" "640x480"
EndSubSection
SubSection "Display"
Depth     15
Modes    "1024x768"
EndSubSection
EndSection

#Section "DRI"
#    Group        0
#    Mode         0666
#EndSection

May 04, 2009

Not all Xfce's are equal

I happened by chance onto a post in the CrunchBang Linux forum that led to an interesting article comparing Debian's and Ubuntu's Xfce-based desktop installs. And now that Wicd is available in Ubuntu 9.04 as well as in Debian testing and lenny-backports, I am starting to get unreasonably excited.

A .fonts.config file

For whatever it's worth, I've been having pretty good luck with the following .fonts.conf file after installing msttcorefonts in both Debian Lenny and in Ubunty 8.10 (Intrepid). I haven't really tried it in Ubuntu 9.04 (Jaunty), but it's worth noting that msttcorefonts is called ttf-mscorefonts-installer in 9.10.
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<match target="font">
<edit mode="assign" name="autohint">
<bool>false</bool>
</edit>
</match>
<match target="font">
<edit mode="assign" name="rgba">
<const>rgb</const>
</edit>
</match>
<match target="font">
<edit mode="assign" name="hinting">
<bool>true</bool>
</edit>
</match>
<match target="font">
<edit mode="assign" name="hintstyle">
<const>hintfull</const>
</edit>
</match>
<match target="font">
<edit mode="assign" name="antialias">
<bool>true</bool>
</edit>
</match>
</fontconfig>

April 04, 2009

CrunchBang Linux

The people over at CrunchBang Linux have put together what they promise is a lightweight Ubuntu-based distribution. It comes in Standard, Lite and Eee versions. I have yet to try it, but I absolutely love the minimalist default desktop and am very impressed by what I've read.

CrunchBang's approach to implementation and design differs a bit from what I'm trying to do (ever so slowly lately) with SkinnyDebbie. Implementation-wise, CrunchBang is a full distribution that is based on a standard distribution (Ubuntu); SkinnyDebbie is a configuration that sits on top of a standard (currently Debian) distribution. In terms of design, without actually trying it I can't say for sure, but it looks as though CrunchBang is aimed at users that have at least a bit of Linux familiarity and a tiny bit of hardware headroom.; the design philosophy behind SkinnyDebbie is to make it as useful and inviting as possible to computer newbies while using the lightest-weight core options that still get the job done.

Of course neither approach is better than the other; CrunchBang and Skinny are intended for slightly different audiences/flavors of users. If you are looking for a lightweight Linux distribution, please give CrunchBank a spin and let me know what you think. If CrunchBang had been around when I started Skinny, I might never have started it. :-)

March 12, 2009

SkinnyDebbie has moved

I've moved SkinnyDebbie to a new home. Skinny's new home will be able to give the project more of the services it wants and needs. From now on, the best place to get the Skinny is http://skinny.tuxfamily.org/ .

January 29, 2009

The Joy of X



I've been doing some work with Lenny in its current pre-released state. It's actually pretty stable and usable, with one 1000-pound gorilla exception: X.

In case you are as new to Linux as I was last year, the X Window System (or simply X) is the name of the service that provides graphics in Linux. There used to be competing flavors of X, but now the world has pretty much settled on the version offered by the X.Org project. In contrast with the myriad choices for file managers, text editors, window managers, etc. that characterizes the rest of Linux, if you want graphics (i.e., GUI), you need to deal with X, and you will almost certainly be dealing with X.Org's implementation.

Right now I kinda wish you didn't.

The 1000-pound issue with the latest (i.e., found in Lenny) version of X involves automatic modes detection. In Etch, when you installed X the installer ran a script that made a reasonable guess concerning what your video system was capable of and then asked you if it got it right. Then it would write the data to /etc/X11/xorg.conf and use that data when delivering services. If you changed/added monitors or video cards you had to rerun the config routine with

# dpkg-reconfigure -phigh xserver-xorg


(as root) and that would generate a new xorg.conf file. The syntax of the xorg.conf file is really painful, especially for your grandmother, but if for some reason you needed to optimize some settings manually, you could. This hasn't been needed on any of the four SkinnyDebbie systems I use. Overall, the arrangement was not ideal, but it was workable.

Then the X people decided to make it ideal. The idea(l) is that the video system should tell the X server what the video system is capable of when the X-session starts up, and X should then use that data. If you change/add hardware, all you need to do is restart your X session. Beautiful.

Except in my Lenny experience a lot of video cards and monitors (especially slightly older ones) do not (correctly) tell the system what they are able to do. And while you can still hand-edit the xorg.conf file to force it to tell X what the video system can do, there is no way to get the data into the xorg.conf file without teaching your grandmother the painful xorg.conf syntax. In other words as near as I can tell, dpkg-reconfigure -phigh xserver-xorg doesn't have a "manual override" mode. Ugh.

Just as bad:
The standard Linux program for resizing/rotating your display is called xrandr. Among its jobs are reporting back to you what the X system says you can set for resolution and refresh rate and allowing you to select the mode you want to use. Except it hasn't worked with any setup I've used using totally autoconfigured X.

I really, really hope this one gets worked out.