Update for maildir-indicator

Follow-up to my post about using Maildirs -with Ubuntu's messaging menu.

Brad, the original author, has indicated that he considered his code to be essentially WTFPL. I feel the same about my bits, and have added a COPYING file specifically indicating this license instead of the previous GPL3 license.

I have made some other changes since that last version:

  • The configuration values (frequency, directories) are now loaded from separate files. Default values are in /etc/maildir-indicator.conf, user-specific in $XDG_CONFIG_HOME/maildir-indicator.conf (or more likely, $HOME/.config/maildir-indicator.conf). This allows it to be installed system-wide and have users configure their own notifications.
  • The .desktop file has been cleaned up, and is now advertising "Maildir Indicator" instead of mutt. This is what will be read in the menu as well (though of course, clicking it runs whatever mail agent you want).
  • Cleaned up some debug messages to make the output a little easier to read
  • Changed 'path' to no longer have a trailing slash. I'm not sure what happens if you have a trailing slash on your paths, I didn't test it.

The program can still be used by grabbing the source from the Maildir-Indicator repository on Gitorious and running `./maildir-indicator` in the directory you get. However, it also supports being installed system-wide, which can be done easily by installing it from the maildir-indicator PPA. Installing from the PPA will also set it to run automatically at login.

To use per-user configs, just copy the basic config to your .config directory, and edit it as needed:

    cp /etc/maildir-indicator.conf $HOME/.config/maildir-indicator.conf

    gedit $HOME/.config/maildir-indicator.conf

One minor issue is that it has no way to see that your config has changed. You need to `kill` the running version, and start a new one. I didn't worry about it since most people manually setting up maildir notifications are probably able to do that.

In the mean time, it seems that Brad has been busy as well! He's taken the version from my previous post and updated it to provide much better notifications. It now reads the message and puts the sender and subject lines in the notification bubble! Now when a message arrives you can decide whether to read it now or later without opening your mail.

There is a bit of a logic bug with how my version handled the notifications: If the number of new messages is the same or less than the last notification, then it doesn't re-notify. If you were notified of two messages, which you read, and a new one arrives before the program checked for new mail again, it won't notify you about the new message (though the icon stays lit up). It assumes you only read one of the messages. To solve this, we would need to actually check out each file -- not in-depth, just the filename is good. Brad's update goes beyond that. I'm not sure if he's filtering out already-notified messages or not, but most of the pieces are there in his new version.

The bad news is my packaging work and his notification work happened in parallel. I was away for a week and didn't see his updates until now that I'm posting this. I'll merge his notification code tomorrow and release an 0.4 package. For reference, I've imported his version in my git repository under a branch called 'brad' if you want to compare the differences (the merge should be fairly strait-forward).

I couldn't have said it better: "This is why I love Free/Open Source Software".

UPDATE 20110812: I've merged Brad's detailed notification changes (with a few changes), and made a few other fixes (Thanks Nick for pointing out an issue in the comments).

Maildir with Ubuntu's Messaging Menu

I was pretty sure I wasn't the only mutt user who missed having mail notifications in the indicator area. From a quick google search, it turns out I was in good company. Even better, a fellow by the name of Brad Mont actually wrote a basic python script to create an appindicator that would monitor a maildir. It was about 90% of what I was looking for.

Unfortunately, I didn't want another icon crowding the panel, so I adapted his script to use the messaging menu, so it shows up with chat (and any other communications programs). I made a few other changes along the way (notifications). Thanks to the folks who wrote gm-notify for being such an easy to read example of both notification and the messaging menu.

My version is available as maildir-indicator on gitorious. Hopefully it will be of use to others as well.

Review: Logitech Trackman Wheel Optical

As well as my previously mentioned Unicomp keyboard, I also decided to purchase a Logitech Trackman Wheel Optical. It’s basically a thumb-oriented trackball that resembles a standard mouse (with regards to clicking, scrolling, etc).

Adjusting to using the trackball was extremely easy. I have one at work and one at home. I haven’t been able to use it for games yet, so I’ve still got a second mouse around for that (more on that in a bit…)

I found the sensitivity to be a little low for my liking. There is a driver for Windows that allows you to adjust the sensitivity and acceleration of this mouse, but this requires running their software. Xorg has this built-in, but that level of device-specific tuning is not exposed easily. After playing around with xinput and xset, I’ve settled on some xorg.conf.d rules that accomplish the same thing:

# /usr/share/X11/xorg.conf.d/75-trackman.conf
# Configuration settings for Logitech Trackball

Section "InputClass"
        Identifier      "Logitech Trackball"
        MatchIsPointer  "on"
        MatchDevicePath "/dev/input/event*"
        MatchProduct    "Logitech Trackball"
        Driver          "evdev"
        Option          "MinSpeed"                  "2.00"
        Option          "MaxSpeed"                  "3.00"
        #Option          "AccelFactor"               "0.40"
        Option          "AccelerationNumerator"     "5"
        Option          "AccelerationDenominator"   "1"
EndSection

The biggest issue I experienced was in Windows 7. The software for this trackball, and the software for my Logitech G9 mouse are different. They have the same name, but they do not seem to be able to configure each other, requiring both the be installed and running. That said, they don’t seem to interfere with each other either. I find it somewhat sloppy, but I don’t use Windows for any serious work anyway so it hasn’t become an issue.

The ball doesn’t sit on rollers like old mechanical trackball mice, but on three slick pads. The ball movement is tracked optically. The pads seem to collect a fair amount of gunk. I clean it out every few days, though I haven’t noticed any ill effects yet (other than needing to wash my hands more often).

Pros

  • Don’t have to swing your arm all over
  • I find it quite relaxing to use
  • Can put it on your leg and lean back in your chair

Cons

  • Software required to configure for Windows
  • Windows software doesn’t work for other Logitech mice
  • Pads holding ball get dirty rather quick. Your mileage may vary.

Conclusion

For “desktop” use, it sure beats a mouse. It is definately worth $30, without question.

Review: Unicomp Customizer 104

I’ve recently purchased a Unicomp Customizer 104. It is essentially a modern version of the old IBM Model M mechanical keyboards. I do a fair amount of typing, so I thought it would be worthwhile to invest in a better keyboard.

I’ve decided not to post photos since there seems to be no shortage of those on teh interwebs already.

The feel is very nice. It reminds me of the Model M I used to have, but unfortunately, that model is long gone and I can’t do a direct comparison. The keys are very loud, which was expected from this type of mechanism (Buckling Spring). I expected the actual mechanism to buckle roughly 50-75% of the way down so that an experienced typist can stop their finger motion before they hit the backplate. It appears that these keys require almost 95% motion, at least by my rough estimate. I consider it impossible to type without moving the key completely down. Unfortunate, but no worse than any other keyboard.

The keyboard is physically large. There is a slimmer version, but I opted for the large customizer for nostalgia.

I rather like it. The folks at Unicomp were very accommodating. I originally ordered a different board, then changed my order. They corrected it and shipped it right away. Unfortunately the billing still went through for the original (more expensive) keyboard, but the difference was refunded right away when I contacted them.

Pros

  • Very clicky
  • Visually appealing keyboard
  • Fun to type on
  • Loud

Cons

  • Tactile feedback not as awesome as expected.
  • A little pricey
  • Loud

Conclusion

I quite like this keyboard. I was a little worried about paying USD$70, plus shipping, plus fees (Import via Fedex into Canada). I consider it a rather expensive keyboard, but I definitely enjoy typing on it more than the thinkpad keyboard, or the Microsoft X6 board I was using before.

Using devtodo with multiple projects

I’ve tried (and failed) to use many different pieces of software designed to manage todo lists. The main reasons I’ve failed is because the software either has a high learning curve, bad documentation, or it is cumbersome to use.

I’ve finally struck gold with devtodo. Out of the box, it is almost perfect, but there are a few little issues:

  • It expects .todo in the current directory
  • It has no ability to track what you are working on.

I’ve managed to work around both of those with some extra functions in my .bash_profile.

Where is my .todo?

I wanted a git-like approach to my todo list. If there is not one in the current directory, check the parent, the grandparent, etc. Eventually, fall-back to ‘Global’ todo list in ${HOME}.

Note: This depends on the rfind function in my previous post.

First, create a function to set the TODO_FILE variable. We’re going to set TASK_FILE here as well, this is referenced further down the page.

set_nearest_todo_file()
{   
    ntdf_file=$( rfind -name .todo -type f )
    if [[ -z "${ntdf_file}" ]]; then
        ntdf_file="${HOME}/.todo"
    fi  
    TODO_FILE="${ntdf_file}"
}

set_nearest_task_file()
{
    TASK_FILE="${TODO_FILE}-current"
}

Now, we need to call these on cd, pushd, and popd, as well as when the shell is sourced.

cd()
{
  if builtin cd "$@"; then
    set_nearest_todo_file
    set_nearest_task_file
  fi  
}
pushd()
{
  if builtin pushd "$@"; then
    set_nearest_todo_file
    set_nearest_task_file
  fi
}
popd()
{
  if builtin popd "$@"; then
    set_nearest_todo_file
    set_nearest_task_file
  fi
}

set_nearest_todo_file
set_nearest_task_file

Next, lets make an alias for td to call devtodo with our desired todo_file

td()
{
    # Don't print DB notice for .todo in current dir
    if [[ "${TODO_FILE}" != "./.todo" ]]; then
        # Output DB notice to stderr.
        # so we don't mess with output parsers
        echo "Using database ${TODO_FILE}" 1>&2
    fi
    # Specify found DB
    devtodo --database ${TODO_FILE} $@
}

Now, when we call td, we will be referencing the nearest TODO_FILE, either in the current directory, one of it’s parents, or falling back to ${HOME}.

What am I working on?

This was simple enough. devtodo has aliases for todo (devtodo), tda (todo —add) and tdd (todo —done). We also added td above. I’m going to hijack tdd, and add a new ’t' command to set a current task.

We already added the neccessary parts to get TASK_FILE above. Now we’re just going to create a function to set a task in that file.

t()
{
    if [[ "$*" == "" ]] ; then
        if [[ -f "${TASK_FILE}" ]]; then
            cat ${TASK_FILE}
        fi
    else
        td $@ | tee ${TASK_FILE}
    fi
}

You’ll notice that if we call t with a parameter, such as t 6, it run td 6, instruct td to show task 6, and copy that output to your TASK_FILE.

If we simply call t, it will cat out our TASK_FILE to the screen.

I’ve also hijacked tdd, the devtodo ‘done’ alias, to clear my TASK_FILE as well.

tdd()
{
    /usr/bin/tdd $@
    rm ${TASK_FILE}
}

My workflow

I find this very easy to manage. td to review my list, t # to select my active task, and t while I’m working to be reminded what I’m doing. The task number is still in the output of t. When I’m done, tdd # marks that task as complete, removes TASK_FILE, and I’m free to start another task.

Reverse Find

I recently had need to do a reverse find, and couldn’t discover any programs that offer this functionality. I decided to work around the issue using a bash function, loops, and find.

This function can be stuffed into your ~/.bash_profile, and referenced wherever you need it.

rfind()
{
    rfind_path="${PWD}"
    while [[ "${rfind_path}" != "/" ]]; do
        rfind_search_paths="${rfind_search_paths} ${rfind_path}"
        rfind_path=$(dirname "${rfind_path}")
    done

    find ${rfind_search_paths} / -maxdepth 1 $@ -print -quit
}

As an example, let’s say I’m in /home/user/docs, and I execute rfind somefile.txt. rfind will actually build a command and execute the following:

find /home/user/docs /home/user /home / -maxdepth 1 somefile.txt -print -quit

This will find the nearest parent directory containing a file called ‘somefile.txt’, and quit after printing the first (nearest) match.

Edit: Updated rfind to use a much simpler ‘dirname’ method.

the iPad letdown

Okay, so the ipad is just a big ipod touch, and filling the "device too large to always have on you but too limited to do lots with" between a handy with-you smartphone and a real computer. If it was an accessory to a computer, THEN it would be interesting. Put it on the dock and it acts like a second screen. If you're reading a PDF or web page, you can send it to the ipad for display, grab the ipad and continue having your reference material up. How about an example:
  1. I look up "How to do XYZ on some obscure server issue" on my computer. I do this on my computer because it takes a long time to find what I need.
  2. I read through until I find the helpful bit on page 322 of a 700 page pdf.
  3. I send that to my padd and walk to the server room where I can follow the instructions
  4. Note there was no step for manually copying a file, bookmarking, manually opening on the padd, remembering I want p322, etc. Just drag send it to the padd (whether it's a drag, a click, whatever).
For inspiration, see interesting UI interaction done on Science Fiction. Star Trek has had accessory "padd" devices that acted this way. Minority Report had this as well (which was mostly un-noticed next to the gesture UI everybody did happen to notice). Until that device comes out, I see no need for a cell phone that can't make calls, or a computer that can't run software.

For Twits and bookfacers

I've linked my blog to Twitter, Identi.ca, and Facebook via ping.fm via CR Post2Pingfm Twitterfeed. Whew. Hopefully this means that I will update my blog more often as there is a slight, remote chance that somebody might actually see it. I've got two LUG presentations coming up: DIY debian packaging for LOLUG and KVM+libvirt for KWLUG. I'll post slides when I present. Update: I've decided to use twitterfeed instead of the wordpress plugin I was using. It manages to post a little nicer to facebook. The only down-side is it is a timed rss-pull mechanism instead of a nice push, but I'll live.