Tag Archives: keyboard

pdmenu: The bane of geek showoffs

Most of the console fanatics I know would sooner chop off all ten of their digits one-by-one with a rusty grapefruit spoon than surrender their blinky blinky cursor to something like pdmenu.


But pdmenu is really quite nifty, and if I may be so bold, no less supergeekcool than the slmenu gimmick I foisted upon the world last year.

Multicolor, full-screen, customizable, hooks itself neatly into Debian’s menu tool, has sane controls and defaults … what’s not to like?

Oh, that’s not dialectics, I actually know the answer. The bleary-eyed console addicts are addicted to showing off their 80 words-per-minute typing rate for core Unix commands, and pdmenu makes the blinky blinky cursor accessible to everyone. The horror! 😯

No more elitist machine-gunner hunt-and-peck console gurus while pdmenu is around. No more grand bearded Linux wizards, if triggering the application du jour is as easy as down-arrow-down-arrow-return. The knuckles will atrophy!

We all need our little spheres of control, I guess.

pdmenu will take you about a minute and a half to configure with the tools you prefer for text-only applications. If you can configure something like Openbox or IceWM, you can definitely handle pdmenu.

And best of all, you can whip the throne out from under your local condescending Unix computer genius. Here’s a nickel, kid. Get yourself a better computer.

kbd: So terribly important

I ran into a few logistical problems today, all the more complicated by the holiday season.

Nothing worthy of relating here, but it did eat a lot of the time I would have spent picking around in software.

And as luck would have it, the first tool in the K section is a really important one — kbd.


kbd is a suite of programs really, that all roll around the idea of managing your keyboard.

That could mean setting an international keyboard, setting fonts, handling key repeat rates, digging out keycodes for extended or special keyboard keys, and so forth.

Which means it is terribly important if you want to live life in a text-only arrangement.

kbd is no slouch; by most accounts there are probably 25 or more smaller applications that are installed in the packet (in Arch, at least 😉 ). Including such classics as:

  • kbdinfo, which is dandy for getting the state of LEDs and so forth,
  • kbdrate, which lets you set the delay and repeat rate,
  • loadkeys, good for setting a keymap,
  • resizecons, which sets the lines on the screen, but doesn’t quite work like you think it does,
  • setfont, to get a better shape of letters, or special characters,
  • setleds, which turns lamps on and off,
  • showkey, which is important for pinning down special keys, and …
  • vlock, as a basic and straightforward console lock.

That’s just a small sample of what you’ll get. For only three monthly installments of only $0.00 per month. :mrgreen:

Joking aside, I should mention that a lot of those — and others in kbd — won’t work from a terminal emulator in X. So don’t go pounding out an angry e-mail to me because setfont doesn’t quite work inside rxvt-unicode. 🙄

kbd has been around for such a long time that there is tons of documentation available on it.

man pages are all a good place to start, but look here, and here too for more info. You’re bound to find what you’re looking for.

P.S., Debian handles console fonts a little differently from Arch; try dpkg-reconfigure console-setup for starters. After that, see what the Debian gurus suggest.

Bonus: slmenu in action

There are very few things re: “life at the console” that truly surprise me any more, and even fewer that completely reshuffle the way I work on a daily basis.

But that stunt with slmenu from a few weeks ago has proven not only useful, but utterly addictive. If you missed it, here it is, animated.


Later on you can inquire after how I made an animated gif of my X-less desktop. If you ask nicely, I might tell you. Bribes are also accepted. 😈

Right now, try to focus on quick switches between programs, two-key and three-key startups without aliases, tab completion and so forth.

A couple of things have stood out since then.

First, the order of the items in the list makes no difference to slmenu. So you can arrange the order in any fashion, alphabetical or not, and slmenu works just the same.

You can also include aliases, scripts or commands nested in directories.

Again, slmenu doesn’t seem to care, and since you’re pumping it all back through to bash, it’s no different than a command typed at the prompt.

But best of all, it means you can stack your favorite programs at the top, and execute with Super_L and Enter. It’s almost a two-key macro.

I put alpine at the top of my list there only because it’s alphabetically first. but I also can fire it up immediately, at two keypresses.

For some applications, it’s only a little more inconvenient though. For example, it’s just quicker to type mc, than go through slmenu.

But for others, like some long-name applications, this is perfect.

If you haven’t tried it yet, give it a go. It might prove addictive to you too.

Now, about that gif … 😀

Bonus: slmenu, and some seriously wicked console wizardry

Whenever I use Musca, I learn to reappreciate dmenu.

You can keep your Unity, your Gnome3, even your gmrun or Kupfer. dmenu is a keypress and a half away and does only one teeny thing.

Too bad there’s not something like that for the console.

There is line completion, usually with the tab key. And some more advanced shells than bash do something similar to dmenu, I suppose, if you think about it.

Still, one keypress and a few letters to cue up the most popular programs on your computer … that might be useful, I suppose, if you think about it.

The suckless gang are rock-and-roll stars when it comes to featherweight software, so it should be no surprise that dmenu is in their stable.

Imitation is the sincerest form of flattery, and the author of slmenu acknowledges that a large proportion of its code was lifted straight from dmenu.

But slmenu, when prompted, looks … different?


What gives? Not much to work with there, K.Mandla! What’s it waiting for? Well, I can tell you.

Type in a couple of names of programs, then feed it the end-of-file key — CTRL+D.


Well, yes, that’s the general idea. Now you have a dmenu-esque line of applications that you can sift through either with tab completion or arrow keys.

But … that’s hardly helpful, you say. Who wants to type in the entire possible list of programs each time? That doesn’t just defeat the purpose, that’s the complete antithesis of what we’re chasing.

Fair enough. Suppose we had a list pre-made, with the most common software on the machine, in line-by-line format.


Would that do the trick? Now we just need to redirect that list back into slmenu, which is easier done than said.

slmenu < .progs.txt


Bingo. That’s exactly the behavior we’re after. So select a program and …


Crap. It just dumps the menu entry into stdout. It doesn’t execute it. Now how in the heck could we … wait:

eval `slmenu < .progs.txt`


Knock me over with a feather. It worked. 😯

But now … that is a heckuva line to have to type each time, just to get a single program started. You’re much better off with the original situation, you say.

True, but suppose we could create some kind of shortcut to that command … some kind of … alias. …

alias xe='eval `slmenu < .progs.txt`'


That should do the trick. I’ve been using xe because apparently nothing else starts with xe, and that’s sort of like “execute” in my mind. 🙄

Do that once and it’s good for your whole bash session. Drop it into your .bashrc and it’s there each time you log in.

Well, that’s nice, you say. But really, it’s still not very dmenu-ish. After all, you could just hotwire your entire .bashrc to cue your favorite software at a single character and an enter key, and skip the whole slmenu thing altogether. It’s just simpler to stick with the original, K.Mandla. 😐

All right. That stuffs it. The gloves are off. Here you go. Here’s the whole business, start to finish, cued up with one key press. Top this:

First we’re going to need a free key. Something that isn’t otherwise used by other software, and dedicate it to cueing that whole line, or at least the alias.

Lucky me, I have an extra key on my keyboard, painted with the logo of The Evil One.

The Microsoft key (or the Super_L key, or the Mod4 key, or whatever you want to call it) is tied to keycode 125 on my machine. I know this because showkey told me, when I tried it.

So now I need a copy of my console keymap, which is located in /usr/share/kbd/keymaps/i386/qwerty/, but is going to depend on your machine and architecture. Choose wisely.

cp /usr/share/kbd/keymaps/i386/qwerty/jp106.map.gz ~/jp106-SuperL.map.gz
gunzip jp106-SuperL.map.gz

Now we edit, adding these two lines at the end:

keycode 125 = F70
string F70 = "xe\n"

Save and close. On my Arch machine, only the root user can change the keymap, so:

sudo loadkeys jp106-SuperL.map

And there it is, with the -b option to force the display line to the end of the screen.

One. Key. Press.

Now you’re not allowed to complain about getting that into place or needing root access to assign a command to that keypress. And yes, I know it means any time your finger grazes that key you’ll get the slmenu display. Learn not to make that mistake.

And enjoy the one-key popup line-completion start menu you just installed for your text-only console system. Cue mad scientist laughter! 😈

As always, there may be easier ways or shorter aliases that will streamline this. And maybe there is a better way to put slmenu to use. Please let me know; I enjoy learning new tricks. 🙂