From the Canyon Edge -- :-Dustin

Tuesday, May 24, 2011

key-mon, now in the Ubuntu Oneiric Archive


Several people have asked me about the super sweet on-screen keyboard in the bottom right corner of the Byobu video I presented at UDS...

Ted Gould introduced me to an awesome Google Code project called key-mon, by Scott Kirkwood.

He actually had Debian/Ubuntu packaging along with his source code, so I just reviewed, built it, and uploaded it to the Ubuntu Oneiric universe archive.

Once you've installed it, it's trivial to use...  You can run it directly from Applications -> Graphics -> KeyMon.  Or you can run key-mon from the command line, where there are numerous options, which are detailed in the manpage.

Big thanks to the developers of key-mon, for the useful tool!  I can this being very helpful for many Ubuntu screencasts, demonstrations, and classrooms.  Give it try ;-)


Monday, May 16, 2011 Section numbers now supported

Several comments on the introductory post about the Ubuntu URL shortener asked about support for specific manpage section numbers...

I'm pleased to say that I implemented this functionality on my flight between Austin and Newark on May 5th (en route to Budapest), and it has now been rolled out to production.

Thus, you can now use specific patterns like:
Or you can play the "I'm feeling lucky" game and leave off the "dot number" appendage.  Either way, the URL is now more adroit and precise!


Saturday, May 14, 2011

Byobu Video from UDS-O Lightning Talks

I gave a "Lightning Talk" at the Ubuntu Developer Summit in Budapest yesterday.  Well, actually, it wasn't as much of talk as it was a screen cast :-)  The room was huge, with over 500 in attendance.  I heard that some people had trouble seeing the screen, and others just wanted to see the video again, so I'm posting it here...

Byobu4 released earlier this week, with some awesome new features, including a prompt for the behavior of ctrl-a the first time you press it, vastly improved scrollback with alt-pgup and alt-pgdn, a new utility called byobu-quiet that enables you to disable all distracting eye candy (and re-enable it with --undo), and a handful of other things.

One question I get a lot, though, is for a video that demonstrates some of the most common keypresses.  Ted Gould pointed me to the Google Code project called key-mon, which I've just uploaded to Ubuntu Oneiric as a new package.  And using key-mon, xvidcap, gnome-terminal, and an SSH connection to an Ubuntu 11.04 instance in EC2 (upgraded to byobu 4.0), I've created just such a screencast.  Enjoy ;-)

The backing track is Free, by Phish, from the Billy Breathes album, available for purchase here or in the Ubuntu One Music Store (sorry, I don't know how to hyperlink to the U1 Music Store).


Tuesday, May 10, 2011

The Hardest Bug I've Ever Solved (Take 2)...

So I spoke just a little too soon yesterday.  I thought I had an elegant solution to a long standing problem.  But I needed a little peer review, and as always you, my blog readers are really quite awesome at that :-)

Within a few hours of that post, it was noted that the ASCII character I thought was unpressable and unbound in Emacs was in fact quite pressable (ctrl-p) and bound (up).  Dang.  And I was so proud...  Hubris.

In any case, I was able to do a bit more digging, and in fact, one of the commenters to that post suggested ctrl-^ as his favorite Screen escape character.  In fact, the Emacs wiki suggests the same thing.  And with that, we're back off and running!

You can read the original-but-updated post here.

Alright, so with that, I've just released Byobu 4.0 into the Byobu PPAs and Ubuntu Oneiric.  You can check the changelog if you want all the details, but here's a few highlights:
  • Users are prompted the first time they use ctrl-a, if they want that keystroke to operate in Emacs-mode or Screen-mode and the selection is permanently preserved
  • Scrollback mode is vastly improved with some new keybindings and tweaks; you can now use alt-pgup and alt-pgdn to scroll through each window's history
  • The "printscreen" functionality is much faster, and nicer, opening the buffer file in a new window using your default file viewer (try: F12 ~)
  • Added support for a BYOBU_DISABLE environment variable to Byobu's launchers; if we could get this added to OpenSSH's whitelisted environment variables, then you could locally configure your system to launch or never launch Byobu on remote systems over ssh
  • Added a utility called 'byobu-quiet', which disables all status notifications and removes the hardstatus line; perhaps attractive to people who might like Byobu's keybindings but don't go for the eye candy
Give it a shot and let us know what you think ;-)


Monday, May 9, 2011

The Hardest Bug I've Ever Solved...

EDIT: In fact, I did not solve that bug in the first run.  As the comments note below, there was a flaw in my first solution.  However, with the help of some excellent readers, I've just released a better, more suitable solution.  This post has been updated accordingly, in order to provide accurate documentation of the functionality as released.
I'm oh-so-pleased to announce that I have solved the single bug I have thought longer and harder about than any other.  Ever.  Period.  The solution actually consists of some gorgeous, unprintable ASCII art...

(Skip to the recap at the bottom if you're not interested in perhaps the best blog post I've ever written while in the awesome nation of Hungary...)

From the very earliest days of the screen-profiles package, the first and foremost objection we encountered from traditional system administrators with the proposition that we (Ubuntu) might automatically drop you into a GNU Screen managed shell was, that eats your ctrl-a, which perhaps you have been using to go to the beginning of the line since the dawn of time.

Boy, have I struggled with that.  I mean, I have literally spent many, many nights awake, hacking away at screen-profiles, and then byobu trying desperately to satisfy two diametrically opposite camps -- one class of awesome sysadmins who are emacs-mode fiends and are forever-bound to pressing ctrl-a and moving their cursor to the beginning of the line, and a second class of equally awesome sysadmins who use the HOME key to go to the beginning of a line and totally rock their world using ctrl-a as the GNU Screen escape character.

How, oh how, do we ever make two camps of equally passionate, equally awesome people happy?  Talk about a proverbial Clash of the Titans...

But for the first time ever, I think Byobu 4.0 will actually solve this problem :-)  Please, hear me out...

The irony here is perhaps that 3+ years into my Ubuntu development career, I have circled all the way back to where I began, with the very first tool I wrote for Ubuntu, to scratch a very particular itch of mine.

In Ubuntu 8.04 (and older), the nano editor was the default editor used by various utilities (crontab, dch, etc).  This always bugged me about Ubuntu.  I mean, I knew why Ubuntu needed to default to nano, but I hated being treated like a Linux/UNIX newbie when I used Ubuntu.  So I wrote the Ubuntu utility select-editor.  And from 8.10 on, the first time you encounter a situation where you're required to interact with an editor, you're prompted to choose your preferred editor first.  I dare say that this has improved my life and preserved my sanity as an advanced Ubuntu command line user.

And here we are, back to byobu, screen, and the key that some of us love to hate, and the rest of us hate to love -- ctrl-a.

As of Byobu 4.0, it will now prompt you, the first time you press ctrl-a, and ask:

Configure Byobu's ctrl-a behavior...

When you press ctrl-a in Byobu, do you want it to operate in:
    (1) Emacs mode  (go to beginning of line)
    (2) Screen mode (screen's default escape sequence)
Note that:
  - F12 also operates as Screen escape in Byobu
  - You can press F9 and choose your escape character
  - You can run 'byobu-ctrl-a' at any time to change your selection

Select [1 or 2]: 

If you select (1), from this point forward, ctrl-a will behave in Emacs mode.  And if you enter (2), well you're off and running with ctrl-a in GNU Screen mode.

Sweet!!!  So now, perhaps you Emacs experts out there ask, "what is the Byobu/Screen escape character then, if I do select (1)"?

Helluva question, my friend.  Here's where we get into super techie fun...  :-)

As of Byobu 4.0, the universal escape character is now ctrl-^.  If you choose for ctrl-a to operate in GNU Screen mode, then, ctrl-a will actually throw a ctrl-^ into your Screen session, which actually triggers the escape mode (behaving exactly as before!)  Additionally, F12 has been remapped from it's previous binding to lock-your-terminal (sorry please use ctrl-a-x or ctrl-^-x now for screen locking...) to Byobu's and Screen's escape key.  And as always, you're oh-so-welcome to choose your own escape character at any time using F9 (byobu-config).

Wow.  How about that?  Okay, so to recap:
  1. Byobu 4.0+ users will be prompted the first time they press ctrl-a to select its behavior (and they can interactively reconfigure at any time by running byobu-ctrl-a)
  2. Byobu 4.0+ uses ctrl-^ (and optionally ctrl-a) as the escape sequence, which is always bound to F12, and may optionally be bound to ctrl-a or some other user configurable escape sequence.
Finally, a huge thanks to Clint Byrum (and so many others) for the final kick in the butt that pushed me over the edge to go and fix this once, and for all ;-)


Thursday, May 5, 2011

Introducing -- an Ubuntu Manpage URL Shortener!

Three years ago today, I kicked off the Ubuntu Manpage Repository project with an RFC to the Ubuntu-Doc mailing list.  Millions of roff-to-html renderings and page views later, I'm really, really proud of the Ubuntu Manpage Repository!  It's such a convenient way to read traditional UNIX manual documentation, which may or may not be present on your local system.

Today, I would like to introduce -- a URL shortener for Ubuntu manpages, for use in IRC, mail, wikis, microblogging, etc.  Inspired by Martin Pool's excellent shortener for Launchpad, I hope you find this useful too!

Save yourself a few keystrokes, and try  Perhaps you'd like to read about bash:, or maybe man, itself:, or maybe you're just asking yourself wtf,

Note that the logic to guess which manpage you're looking for won't get it right every time, but it's usually pretty darn close.  Moreover, improvements are always welcome at lp:ubuntu-manpage-repository ;-)