CrunchBang 11, Apple Extended Keyboard

[If you don’t know who or what these (*) are, check the Glossary page.]

I’m surprised by the things that capture Robofrog’s* attention. I came into the RoboFrog Computing Center (RFCC) this morning and HE’s* hopping up and down all over the place.

“You gotta see this!”

Do I really want to know? It’s too early for this.

“Whatcha got?,” I ask.

“Look. I searched for [apple extended keyboard insert f13] and there we are at the top of Google’s search results.”

Forgive my vanity. There on HIS screen was The Robotic Frog right at the top of the Google search list. Trust me on this one. The first time you see your web site pop up on a Google search is pretty cool. You get a little tingle that runs all the way up your back. And, there’s Lazy Robot close at hand.

I’ve already lost TheFrog’s attention. Looking over HIS shoulder, I see that HE’s entering another search. It’s the same search except he removes the f13 keyword. Now, we’re nowhere in sight. RoboFrog clicks through a couple of pages and there we are on the third search-result page. Lazy Robot is gone altogether (at least as far as we checked…6-7 pages).

This post isn’t about how to do a Google search, but I can see that look on RoboFrog’s face. You know the one I told you about. HE’s frozen in place with knitted brow and I can see the wheels turning. Google knows about us. Google knows about Lazy Robot. So, why did Lazy Robot disappear and why did we drop so far back in the search results? For now, I’ll let TheFrog do HIS thing and I’ll tell you what HE comes up with another time.

Update: RoboFrog left one really important keyword out of his search: Linux! That’s a big oversight. It’s usually HIS first keyword when searching for information to solve a problem on a Linux system. HE got lucky with the f13 thing , but if HE had included ‘Linux’, HE wouldn’t have needed the f13. I’m thinking search is as much art as science.

More Apple Extended Keyboard

Apple Aluminum Keyboard

Apple Aluminum Keyboard (Photo credit: jgarber)

RoboFrog forgot to include ‘linux’ in HIS keywords and fortuitously threw in f13. What if the f13 had not occurred to HIM? Could HE still have assigned Insert to the F13 function key? Sure. The information from the ArchWiki combined with the man pages was enough to fix this problem.

From our previous post:

********************

Reading down the ArchWiki page, we find a few more clues. Under the Media Keys section are the following:

  • ~/.Xmodmap
  • keycode 49 = less greater less greater bar brokenbar
  • “Then run xmodmap ~/.Xmodmap. This command can also go into ~/.bashrc.”
  • xev

It’s rare that we get a perfectly tailored post like the one from Lazy Robot. More often, we get clues like those from the Arch Linux Wiki. All of the clues we need to assign Insert to F13 are contained in those four bullet-points.

First, we need to find the keycode for our F13 function key. We learned from the ArchWiki that xev is a command line utility that displays keycode information. xev is already installed on our systems; we suspect that’s the case with most Linux distributions. On Debian-based systems, it’s included in the x11-utils. So, let’s fire up xev and see what we get.

  • Open a terminal window.
  • Execute xev.
  • Press the F13 key.

In the terminal window you’ll see a description of two events: KeyPress, KeyRelease. Most of the information is of no use to us, but under both KeyPress and KeyRelease we see keycode 191. This agrees exactly with Lazy Robot’s information. So far, so good.

The Dreaded Man Pages

We don’t really need the man pages. With the information from the ArchWiki, xev, and a common-sense guess, we can get the job done. It is a mistake to avoid the man pages, though. They’re difficult to read for Newbies and early HAC (Have-A-Clue) Linux-ers, but the only way to get comfortable with them is to struggle with them a bit. In the case of xmodmap, the man pages have some important stuff.

In a terminal window, type ‘man xmodmap’ (without the single quotes). You’ll get something like the picture above. To navigate the man pages press <spacebar> to page down, <down-arrow> to move down a line at a time, <up-arrow> to move up a line at a time, <b> to move up a page. Let’s look at some important things that we find in this man page.

NAME
xmodmap – utility for modifying keymaps and pointer button mappings in X

Man pages are divided into sections. The first, NAME, tells us that xmodmap is a utility. So it’s a program that we’re going to run from the command line or from a script. And, it’s for modifying ‘keymaps and pointer button mappings’. When you press a key on the keyboard, it produces a number. In our case, F13, produces 191. The keymap tells the system what to do with the number 191 received from the keyboard. We need to modify the keymap so that it tells the system to do the Insert function.

Here’s an important point. I don’t know what ‘pointer button mappings’ are. I suspect it’s mapping buttons from something like a mouse, but that’s a guess. I don’t have to understand everything in a man page. There’s useful stuff in them that I do understand and the more I read them, the more I understand.

SYNOPSIS
xmodmap [-options …] [filename]

Synopsis is a pretty important section. It tells us how to use the command; it describes what we are to type on the command line. Anytime something is enclosed in square brackets, […], it means that it’s optional. You may have that thing…or, you may not have it. To execute xmodmap, we type xmodmap on the command line, a space, zero or more options, a space, and a filename…or no filename. That means that we can execute xmodmap without any options and without a filename. Try it. You’ll get some interesting information.

DESCRIPTION
The xmodmap program is used to edit and display the keyboard modifier map and keymap table that are used by client applications to convert event keycodes into keysyms. It is usually run from the user’s session startup script to configure the keyboard according to
personal tastes.

Exactly what we want to do, and something really important. It runs from our startup script. This is why we lost our Insert key when we rebooted (see previous post). The ArchWiki gave us the same information when it said that this can be included in ~/.bashrc.

OPTIONS
The following options may be used with xmodmap:

  •  
  •  
  •  

The filename specifies a file containing xmodmap expressions to be executed. This file is usually kept in the user’s home directory with a name like .xmodmaprc.

We know from the information from the ArchWiki that we don’t need any options. We just need the filename of our configuration file (.Xmodmap). The man page recommends a name like .xmodmaprc. We like that suggestion because the rc on the end of the filename reminds us that it’s a configuration file. On our systems, we’re taking the man page recommendation and naming our configuration file .xmodmaprc. Use what feels best to you.

Finally, there is interesting (and potentially important) information in the next section.

EXPRESSION GRAMMAR

The list of keysym names may be found in the header file <X11/keysymdef.h> (without the XK_ prefix), supplemented by the keysym database /usr/share/X11/XKeysymDB. Keysyms matching Unicode characters may be specified as “U0020” to “U007E” and “U00A0” to “U10FFFF” for all possible Unicode characters.

keycode NUMBER = KEYSYMNAME
The list of keysyms is assigned to the indicated keycode (which may be specified in decimal, hex or octal and can be determined by running the xev program). Up to eight keysyms may be attached to a key, however the last four are not used in any major X server implementation. The first keysym is used when no modifier key is pressed in conjunction with this key, the second with Shift, the third when the Mode_switch key is used with this key and the fourth when both the Mode_switch and Shift keys are used.

  •  
  •  
  •  

Remember that I said that I would have guessed at Insert for the keysymname? We don’t have to guess, though. The man page tells us that the keysym names are defined in the file keysyndef.h, that they are prefixed with XK_, and that we use the name without the XK_ when we assign the name to a number.

Tip: Do yourself a favor. CrunchBang doesn’t install the locate command. I find this command particularly helpful when trying to find a file like keysymdef.h. No problem; just install it.

aptitude install locate

or

apt-get install locate

Then:

sudo updatedb

To see locate in action: locate keysymdef.h. Now, it’s easy to open keysymdef.h in a text editor and find the definition of the Insert function (XK_Insert). Cool.

The only thing left is to put it all together. We end up with the same solution we had in our previous post:

  • create a configuration text file in our home directory (/home/robofrog/.Xmodmap)
  • Add a line to the file: keycode 191 = Insert
  • From the command line execute: xmodmap ~/.Xmodmap
  • Add ‘xmodmap ~/.Xmodmap &’ to our autostart script (see previous post)

That’s it for the Insert key. Next time, a couple of other tweaks to our Apple Extended Keyboard and we’re finished. The perfect keyboard. Thanks CrunchBang!

Chance favors the prepared mind

I have a small zippered pouch that I wanted to hang around my neck. It has two eyelets, so all I needed was a piece of string. I searched the house over and couldn’t find any heavy string or twine. What kind of home doesn’t have a ball of twine around? Finally, I pulled the lanyard off my iPod Shuffle, pushed the cord through one of the eyeletts and hung the pouch around my neck.

I have a morning routine. I get up at oh-dark-thirty (very early). The first thing I do is make myself a cup of tea. I heat a cup of water in the microwave for two minutes and ten seconds, drop my tea bag in, and let it steep for three minutes. I set the timer on the microwave for both stages of this process. This is five of the most creative minutes of my day. I have some of my wildest, craziest, best ideas. By the time I get to my desk…you guessed it! The ideas have vanished. The pouch hanging around my neck (Did you think I wouldn’t get back to it?) is just large enough to hold a small notebook and pen. I want this to be the first thing I put on in the morning so that I have a way to capture my ideas anytime and anywhere they come to me. Ideas are the lifeblood of any creative endeavor. They’re precious things that must be protected and nurtured. I don’t want to lose them. (Okay, I haven’t figured out how to capture them in the shower…another very productive place.) I also have an idea notebook that I transfer everything to so that I have it all in one place. If you don’t already have a way to capture your ideas, I encourage you to give it some consideration.

Today, I’m planning for 2012.

Things in which I’m interested: writing, music, reading mathematics, teaching, computers, Linux, Arch Linux, programming, computer graphics, creating tutorials, open-source software, home repair and remodeling, bicycling, homebrewing, quality assurcnce, process improvement, manufacturing, small business, blogging, productive failure, trading stocks, creativity, work, jobs.

That’s quite a list. It took only a couple of minutes to come up with it. I do this exercise a couple of times a year just to see what shows up. Some things are always on the list, but there’s usually a surprise or two. It’s important to know what you’re interested in. Barbara Sher (author) says that winning means getting what you want. I think that’s a good definition. I also think it’s interesting that she didn’t say success is getting what you want; she said winning is getting what you want. The things that you’re interested in should point the way to the things you want.

[NOTE] Failure is NOT the opposite of success!

What are you interested in? What do you want? I’m going to try to answer these questions for myself over the next few days.

None of us is as good as all of us!

The Steve(s) Jobs and Wozniak starting Apple Computer in their garage makes for wonderful mythical tale. The reality, though, is that the idea may have come out of that garage, but it took many more people to get to a thriving business. Business is a team sport. I don’t want to take anything away from the inspired minds that come up with amazing ideas or the determination and motivation that fuels dreams. Ideas and dreams are the precursor of all that follows. To turn our dreams and ideas into reality, though, we need many partners along the way. What human resources do you have available?

Family: 3 carpenters, an electrician, 2 administrators, an attorney, a chemist, thespian (actor), dentist, teacher, graphic artist

Friends: electrical engineer, human resources professional, musician, quality assurance consultant, sales / marketing professional

Other: bloggers?

It’s surprising the number skill sets that are represented. How can these resources help me get the things that I want? Perhaps more important: How can I help them get what they want? Each of us has dreams, desires, wants. We can all win if we just choose to play the game that way (Stephen Covey: Win-win or no deal.). I find that I usually get more of what I want and have a lot more fun when I’m helping others with what they want.

I’m trying to find at least one or two blogs every day that I find particularly interesting. This one’s inspirational.

http://www.customink.com/about/our_story

Looks like a good resource too.

Direction for 2012

WordPress

In Tris Hussey‘s book Creste Your Own Blog: 6 Easy Projects to Start Blogging Like a Pro (recommended), he talks about turning comments off for some of your pages. I’ve been trying to figure out how to do that. Finally! this morning I got it. From Dashboard do Pages->All Pages and then choose Quick Edit for the page you want to Enable/Disable comments. A screen will come up with a checkbox that allows you to turn on/off comments.

My inclination is to leave comments on for all of my pages. I have three pages other than my main page. About tells you a little bit about me and the blog; Scratchpad is a place for me to throw things that I don’t want to forget. Scanning through it might give you a little more feel for who I am; Glossary is a place I try to explain what I mean by some of the words I use. Feel free to check out those pages and leave comments or send me something to add to them.

Direction for 2012

This is not a techie blog, though there will be techie posts for awhile because there seems to be an endless stream of tools that I need to embrace to create the kind of blog that I want. I’m spending a lot of time learning the system (WordPress) and trying to figure out how to add graphics, pictures, and videos. Since those are the things I’m doing, those are the things I’m talking about.

In 2012, I’m going to concentrate on the idea of Multiple Streams of Income, a concept that I got from author and businessman Robert Allen. He wrote a book by that title. There are a number of interesting ideas in his book, but it feels a bit like an infomercial for some of his other stuff. I do find the idea of multiple streams intriguing. I want to apply my concept of productive failure with his of multiple streams and see where it takes me.

How hard is it to create a stream of income? How do I find ideas for creating streams? How much start-up capital does it take? How quickly can I get a stream started? How much effort does it take to keep one going? How much specialize knowledge or education do I need? What new things do I need to learn? What resources are available?

This is just a start to the questions that I have, but it’ll give you an idea of what is rattling around in my head.

I hope that everyone had a terrific Christmas (or holiday). We have one more eat-fest to go to today and then all will be quiet until new year’s eve. After that, I really want to get into productive failure mode.