Saturday, February 11, 2012

The Case of the Dormant Function Keys

There's an intermittent problem on my home PC (Linux Mint) that's been driving me slightly buggy (okay, slightly buggier).  My mail client is Thunderbird, and when composing messages I frequently hit the F9 key, which should open the "Contacts Sidebar", from which I can select recipients.  Usually it does.  On my office PC and laptop it always does.  At home, though, it sometimes doesn't -- the F9 key goes mysteriously dead in T-bird.  I can work around it by opening the contacts sidebar from a menu, and eventually the problem disappears (for a while).

Today, though, it happened again and I decided to try to sort it out.  Testing with other programs showed that all the function keys, not just F9, were dead, and in all applications.  I checked system settings in the control panel, and could find nothing that would be remapping the F keys.  A bit of work with Google, though, turned up the culprit: my keyboard.

I have a Microsoft ergonomic keyboard at home (and only on the home PC). Microsoft decided to assign alternate functions to all the F keys, so that, for example, F9 does double duty as the "Send" key (with a different key code).  At the end of the row of function keys is an "F Lock" key.  (For reasons that will become clear, I cannot get out of my head another name for it, also starting with "F" and ending with "ck".)  The F Lock key toggles function keys between their normal key codes and the alternate codes.  It apparently cannot be controlled by the operating system -- or at least nobody has figured out how.  Microsoft being Microsoft, they decided that the F Lock key has to be on for function keys to act as function keys (which seems to suggest that the being a function key is not the normal role of the function key).  Whatever.

The problem, as reported by various people, is that the F Lock apparently toggles randomly, without the key being struck.  In my case, this may mean that the state of the function keys at startup is random -- the keyboard sometimes wakes with F Lock on and sometimes with F Lock off.  With the culprit identified, there are two possible resolutions.  For now, I'll try the lazy approach: do nothing special, but keep an eye on the F Lock status light.  If it becomes too hard for me to remember this (the problem is, after all, intermittent), the more involved solution is to use the xev utility (which displays keyboard events, including key codes) to make a list of the key codes of the 12 function keys, both with and without F Lock engaged, and then use the xmodmap utility to map the key codes for the non-standard functions (undo, redo, reply, send, ...) back to the same virtual keys as the function keys (so that F9 looks like F9 to the system, regardless of the status of F Lock).

No comments:

Post a Comment

Due to intermittent spamming, comments are being moderated. If this is your first time commenting on the blog, please read the Ground Rules for Comments. In particular, if you want to ask an operations research-related question not relevant to this post, consider asking it on Operations Research Stack Exchange.