Note to Self: Customizing Buttons in CrunchBang / Openbox

I have a plan to write a pretty in-depth post about how happy CrunchBang makes me one of these days weeks, but I want to post the following just so I don’t forget it. I also post in the hopes that it will be useful for random Googlers, but I provide no guarantees.

The Problem

The volume control buttons (Up, Down, Mute) on my Dell Latitude D610 don’t work. Also, I want to add a few more keyboard shortcuts, like having Meta-P launch a terminal with Python already running, and Meta-Q close a window (it’s easier to reach than Alt-F4).

Note: It would be pretty hard to make a grievous error with this, but it’s never a bad idea to back config files up before editing them.

The Volume Solution

Er, Google. Oh, right, I’m posting this so that that isn’t required… For the volume buttons, you need to find out what their names are. To do this, open up a terminal and run xev. Click in the black square of the window that pops up, and then press one of the buttons you need. Then, find it’s name in the terminal output. Like so:

So for this button, the name is XF86AudioRaiseVolume. Remember that  and repeat with the other ones. For me, the three names were XF86AudioRaiseVolume, XF86AudioLowerVolume, and XF86AudioMute.

Now, open up your rc.xml file in a text editor. It’s here: ~/.config/openbox/rc.xml .

Locate the section between <keyboard> and </keyboard>, and paste in the following being sure not to splice other tags:

<keybind key="XF86AudioMute">
      <action name="Execute">
         <execute>amixer sset Master toggle</execute>
      </action>
      <action name="Execute">
         <execute>amixer sset Headphone toggle</execute>
      </action>
    </keybind>
    <keybind key="XF86AudioRaiseVolume">
      <action name="Execute">
         <execute>amixer sset Master 5+</execute>
      </action>
      <action name="Execute">
         <execute>amixer sset Headphone 5+</execute>
      </action>
    </keybind>
    <keybind key="XF86AudioLowerVolume">
      <action name="Execute">
         <execute>amixer sset Master 5-</execute>
      </action>
      <action name="Execute">
         <execute>amixer sset Headphone 5-</execute>
      </action>
    </keybind>

(Obviously if your buttons have different names, or if you want to accomplish something other than twiddling with the volume, you’ll have to edit as needed.)

The Other Solution

If you’re kind of impatient, you can just look at rc.xml and figure out how to do everything else you want. But here are a few protips:

  • Use your head: I wanted to add a new keybinding for launching an application, so I found the section with a whole bunch of other keybindings for launching applications…hard, no? It even had this nifty comment/title at the top: <!-- Keybindings for running applications -->
    Also, you probably figured out that C, A, S and W stand for Control, Alt, Shift and Meta (Windows key). And that you can chain them together with hyphens.
  • Copy and paste are your friend: Copy an existing entry, change the key value of the <keybind> tag, and change all the unique parts into whatever you want.

So, for my relatively low-key example of adding binding for Python (W-p) and closing the window (W-q), I added:

<keybind key="W-q">
      <action name="Close"/>
</keybind>

<keybind key="W-p">
      <action name="Execute">
        <startupnotify>
          <enabled>true</enabled>
          <name>Python!</name>
        </startupnotify>
        <command>terminator --command=python</command>
      </action>
</keybind>

I also changed the bindings for moving windows between workspaces: editing these lines:

<keybind key="S-C-A-Left">
      <action name="SendToDesktopLeft">
        <dialog>no</dialog>
        <wrap>no</wrap>
      </action>
    </keybind>
    <keybind key="S-C-A-Right">
      <action name="SendToDesktopRight">
        <dialog>no</dialog>
        <wrap>no</wrap>
      </action>
    </keybind>
    <keybind key="S-C-A-Up">
      <action name="SendToDesktopUp">
        <dialog>no</dialog>
        <wrap>no</wrap>
      </action>
    </keybind>
    <keybind key="S-C-A-Down">
      <action name="SendToDesktopDown">
        <dialog>no</dialog>
        <wrap>no</wrap>
      </action>
    </keybind>

Then just save rc.xml, and restart Openbox.

Again, this really isn’t that hard, but I’d rather trust my writing than my memory.

Share/Save/Bookmark

Leave a Comment

Using Vim for Python

In the Worth Passing On department, this article explains how to set up tab-completion (which I don’t use, but you might), syntax highlighting and execution (as in: pressing F5 and having the program run) in Vim for Python.

VIM as a Python IDE

Share/Save/Bookmark

Leave a Comment

Computer Science in Middle School

First, this thread comes up on Reddit about the failings of early computer education.

Then, Google tweets a link to “Getting Computer Science Into Middle School,” which talks about how MS students should, er, learn computer science–as in programming, not word processing.

I think that programming will only become more and more useful–even if the programmers never take a CS class in college or go into a career in development. Like Calculus, French, and being in the musical, learning how to program is great for the process involved, not just the end result. Critical thinking, creative thinking, problem solving, etcetera, etcetera, etcetera.

And I can even boast that a Python interpreter has helped me in almost all of my classes. Yes, it’s a good calculator, but it also lets you define a function (like Hooke’s Law) and then just plug different numbers into it. And sometimes I need specific documents–like a template involving the numbers 8-36 with four newlines between each one. That would be pretty annoying with a word processor, but it was a four line Python script. And one time I needed flashcards, and didn’t have paper or the internet. Ten minutes later I had a perfectly satisfactory program.

But I’m drawing attention away from the main point with petty examples. Learning how to program has radically changed the way I think, and has greatly increased almost all of my cognitive abilities. Teaching people how to make schlocky animations in a PowerPoint presentation is NOT helpful, and may even turn people off computer classes forever.

…just my $.02.

Share/Save/Bookmark

Leave a Comment

Why I Don’t Think Google’s Netbook Will Be Free

LinuxJournal tried to raise a good point the other day, suggesting that ChromeOS netbooks shold be given away for free–but with built-into-the-OS ads (via). Fine. They’re entitled to their opinion. But I’m entitled to mine–and my opinion is that it’s not going to happen.

The first issue is cost. Glyn Moody spends just under half the article building up to this sentence:

I’m no engineer, so I find it hard to come up with an exact build cost for a minimalist Chromium OS netbook, but I imagine we’re talking ten or twenty dollars, rather than one or two hundred.

Eh…excuse me? I’m no engineer, I find it hard, I imagine…Where the heck did that figure come from? Mr. Moody, I would forgive you if you were a blogger, but you’re a journalist! Investigate! Find out facts! I’ll even give you some: From various interviews, I have learned that there is almost no profit in the sale of actual computers–retailers make the bulk of their money on extended warranties and accessories. And even if we disregard that, selling computers for “one or two hundred” dollars when they cost “ten or twenty” is a one thousand percent profit. I find it very hard to believe that that’s being pulled off.

I could end this right here. I could say, “There’s no way Google’s giving away netbooks, because netbooks are just too darn expensive.” But there’s a few other points too:

Number two: Permanence. As in: ChromeOS cannot be grafted onto a device permanently. If the netbook has a USB port and a BIOS worth its electrons, it would take any reasonably technical person about thirty minutes to put, say, Ubuntu Netbook Remix on their free netbook. Good bye ads, hello profit loss. And even if Google tries to get tricky, I predict it will take the cracker/homebrew community less than a week to get ChromeOS off of there. Remember the DirecTV card cracking?

Numbers three and four: Quantity and use. Maybe you can correct me in the comments, but I really can’t think of a system in which Google could assure that every person could receive one–but not more than one–device. People would not be above faking their name, using a PO Box, borrowing their neighbor’s address or stealing someone’s identity. Which in and of itself wouldn’t be a problem, except that having multiple devices would result in using an individual device less frequently–meaning less ad views per netbook. I’m a blogger. I know how ads work, and you’d be surprised about how many impressions are needed for one person to accumulate ten to twenty dollars (using Mr. Moody’s estimate) or even more than that (my deduction). Then multiply that by two, three or six devices, and you’ve got a big chunk of cash that needs to be accumulated by one person seeing non-maddening ads in order for Google to break even, never mind profit.

Footnote: Keep in mind that part of Google’s mantra is having low-key, not-too-intrusive ads. Which just makes monetization harder.

So I really don’t think we’re on the Eve of the Free Netbook. But in case I’m wrong…can I have one?

—–

If you thought this blog was dead, read the New Deal.

Share/Save/Bookmark

Comments (1)

Happy Birthday, Happy Deathday

Today this blog turns one year old.

It’s gone through three different domain names (wordpress.com, tmac.andrewmin.com and now tsmacdonald.com).

It had an identity chrisis when it was a few weeks old, where it was transformed from a personal blog about what I was doing to a techy blog about what I thought.

It’s had 39,635 visits when it was on tsmacdonald.com and 7,633 on tmac.andrewmin.com, for a total of 47,268 (nothing significant happened on wordpress.com).

The most-viewed post was the “Response to ’9 features Ubuntu should implement’,” which made the Digg Linux/Unix front page and currently has 855 Diggs. I’m also reasonably sure it’s the most Reddited, with 41 (60 up, 19 down).

I got comments from people who loved me, people who thought I was brilliant, and people who were surprised I had the mental faculties to type.

I learned that good articles don’t always attract traffic, and traffic doesn’t always come to good articles.

I learned how to use WordPress well. Which is a good skill.

I learned that if you don’t know what you’re saying, people will call you on it, and mock you for it.

I learned what bad writing is, and how to avoid it, and am still learning good writing.

And I learned that you’re probably reading the last post to appear on this blog.

Why?

  • I was really running out of things I wanted to write about. Dedicated readers probably noticed that both the frequency and originality of posts experienced a sharp decline in the past six months.
  • There’s other things I would like to do–stuff IRL, but I’d also like to spend more time coding, helping software out at Launchpad and learning about the guts of Linux.
  • If I do get a brilliant idea for something to write, it makes a lot more sense to polish it up and submit it to a magazine–for many hundreds of dollars ad fame–than to post it here, get a thousand visitors, and an extra eight cents (on a good day. It could be three.) from advertising. I’m currently paying money to write this blog–ads don’t cover the domain name registration (and I’m fortunate enough to get free hosting).

So thanks for reading, but good bye.

Share/Save/Bookmark

Comments (1)

Why Drivers are Key to Linux

A few months ago, I was messing around with my Thinkpad, trying to make it fast yet usable. Arch seemed the way to go, but X was uncooperative (note to self: try Arch again). Why? It didn’t get the driver right for my video card. Next up was SliTaz, and after that Ubuntu Server. Both of which wouldn’t recognize my PCMCIA network card (which Arch did). Ubuntu GTK 1.2 Remix also got the wired card down, but no amount of coaxing on my part would convince it to recognize my wireless card. I finally ended up putting Xubuntu on it, which was too slow despite swapping in Fluxbox (which was hideous) for Xfce.

In addition to problems like mine, people have all manner of trouble getting wireless cards, graphics cards and dual monitors to work. And most just give up on extra buttons on laptops (out of the four on my Vaio, only one worked). Forums and IRC are sometimes helpful–and sometimes not. Googling works fairly well for common problems…which are probably less than half of all problems. Unlike Windows, where you can get a 90% success rate by going to the manufacturer’s website and downloading and installing the right driver, there’s no clear method for solving driver problems in Linux. And even if there was, some hardware just doesn’t work in Linux.

Now let’s not get  pessimistic–a lot of things do work, and they work out of the box, no less. Millions of people are having an absolutely charming time with Linux and their hardware. All of my “modern” (made on this side of the year 2000) computers work somewhere between great and flawlessly with some version of Ubuntu (Hardy, Intrepid, Jaunty, Xubuntu, CrunchBang…).

But on the other hand, it is really offputting to not be able to interact with your computer the way you want to.

“Linux is the answer!” people cry. “It even has Skype!”

And the answers:

“That sounds great. But my webcam doesn’t work.”

“Mine does, but my microphone’s out.”

“At least you can connect to the Internet.”

“Yeah, well be happy X doesn’t bork for you, and leave you at a bash prompt.”

A lack of hardware support is limiting people’s ability to properly use (and enjoy) Linux.

It’s like test driving a Ferrari with bad brakes. You should be able to have a nice ride, but you don’t even get to experience it properly since you can’t stop.

And if people were able to use Linux the way it’s meant to be used, they would be able to form a fair opinion on it, developers would be able to focus on real problems, and I would be able to sleep calmly, since I wouldn’t have to put up with idiotic reviews and forum posts that exclusively focus on how badly Linux stinks because it doesn’t work for them.

I can’t wait.

——-

Further reading: How I think the driver problem should be solved.

Share/Save/Bookmark

Leave a Comment

Popups are getting more…interesting

Today, Google linked to a site that had changed hands, so I got bait-and-switched to…I don’t even know what, but there was this large popup:

Screenshot

It might’ve been convincing if I wasn’t using Ubuntu (and hadn’t looked at the window decoration or left pane, and was completely ignorant of how anti-virus software worked). So I tried to close it, and got a lot of wonderful error messages:

popup

(Hmm…didn’t really give me a choice there, buddy (I actually just Xed it out)).

So I guess the moral of the story is that Timmy encountered a ridiculous website.

And if you wan’t to get philosophical and/or upset, you could say that it’s for reasons like this that computer-ignorant people shouldn’t use Windows–that could’ve been a mess of nasty viruses. Even a Mac is better*.

*Unrelated: I had the chance to use a Mac for a few hours last week, to use the Internet and also write music in ABC. I won’t say it was unpleasant, but I did have quite a few what the heck? moments. So I remain unconvinced, but I might be beginning to understand why normal people like them.

Share/Save/Bookmark

Comments (1)

Microsoft Contributes Code to Linux

Everyone in the Linux world has been in shock over the past few days over the fact that Microsoft contributed 20,000 lines of GPL-licensed code to Linux.

I’m not saying it’s a bad thing, but for everyone who’s excited: read this.

Share/Save/Bookmark

Leave a Comment

Response to “12 ideas Ubuntu should steal from Windows 7″

I really don’t want to build a reputation as some kind of bulldog guarding the gates of Ubuntu from articles from Digg’s Linux/Unix front page that try to point out Ubuntu’s deficiencies. We’ve already had this one, and I’m reluctant to write the one I’m starting right now.

But I would feel dirty inside if I let the “12 ideas Ubuntu should steal from Windows 7” slide by without a comment.

Before I get started, though, keep in mind that part of my problem is that Ubuntu “should” steal the ideas, and that it should be from “Windows 7.”

  1. Better boot time: We already have this. Jaunty has an excellent boot time, and if Canonical says that Karmic’s going to have a better one, I wholeheartedly agree with them. Ubuntu should steal this from Windows 7? Why steal what you already have? Ubuntu: 1. Windows: 0.
  2. Improved suspend and hibernate: Three things: 1) I’m the first to agree that it’s still a problem. 2) It has gotten a lot better with each new release. 3) With a 25-second boot time, the problem is less pressing, but still inexcusable. Ubuntu: 1. Windows: 1.
  3. The taskbar: I agree that gnome-panel isn’t as pretty* as 7′s taskbar (unless you theme it heavily), but I think the question of functionality is more subjective (it’s dependent on what you need and how much work you’re willing to put into setting things up).  And Oxford (the author) even points out that you can get a great experience with Avant (he calls it combined with the panel “the best user interface of all three major OSes”). *That said, if your panel in Ubuntu isn’t both more functional and more attractive than XP’s, you’re doing something wrong. Ubuntu: 1.5. Windows: 1.5
  4. Kid control: This is another matter of opinion. I’m in the camp that says “Ubuntu should have core functionality such that it will do anything the average user wants, out of the box.” So I think parental controls should be something you add (and they’re in the repositories–Dan’s Guardian is one for censoring the Internet, for example), not something you get. If you disagree, you could get them out of the box with a remix of Ubuntu, like Ubuntu Christian Edition. In conclusion: Something nice? Yes. Something Ubuntu should steal? I don’t think so. Ubuntu: 2.5. Windows: 1.5.
  5. Help! : I’ve never been completely impressed with Windows’ Help, but I’ll agree that troubleshooting is something it has and Ubuntu doesn’t. There’s a lot to be said for using the Internet (Ubuntu’s online documentation, Ubuntu forums, Google…), but there should definitely be stuff available outside of the cloud. Ubuntu: 2.5. Windows: 2.5.
  6. Drive encryption: Yeah… Ubuntu: 2.5. Windows: 3.5.
    I really hate it when websites put one article on multiple pages. It’s downright sleazy. </rant>—
  7. Side by side view: …is a Compiz plugin. And has been. Kind of like workspaces, expo, annotation, the cube…Windows just can’t seem to catch up. Ubuntu: 3.5. Windows: 3.5.
  8. Better sound system: Media–and everything related to it–is my Achilles’ Heel of computing, so I’ll admit openly that I don’t feel qualified to discuss this. Sorry.
  9. Windows Media Player: Again, I’m not good with media. But in my limited experience, Rhythmbox has always “just worked,” and WMP has had random issues. To quote OA commenter thinkdave: “….have you even used Rhythmbox? I just changed the genre tag for a bunch of songs by right clicking the song and going to properties you know exactly the same way as all other media players. And you think ticking ‘share my music’ in the music sharing plugin is convoluted.” Ubuntu: 4.5. Windows: 3.5.
  10. That syncing feeling: …isn’t strictly Ubuntu’s fault, but it’s still a weakness. Ubuntu: 4.5. Windows: 4.5.
  11. Better back-up: Ubuntu has a number of good backup solutions in the repositories, and the choice to include one by default or not is purely a matter of opinion. Ubuntu: 5. Windows: 5.
  12. User Access Control: (Psst! Mr. Oxford! UAC stands for User Account Control…) And I don’t even want to hear about it. UAC is a poorly executed knockoff of *nix’s super users. UAC should try to learn from sudo/gksu, not the other way around. Why? There’s a consensus that sudo/gksu improve security, and are not intrusive, whereas UAC is marginally better than useless, and is extremely annoying to boot. Just for fun, let’s try doing things without enough privileges.
    $ aptitude install thunderbird
    ...
    E: Could not open lock file /var/lib/dpkg/lock - open (13 Permission denied)
    E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?

    gksu

Final score: Ubuntu: 6. Windows: 5. On issues that were supposed to play to Windows’ strengths and Ubuntu’s weaknesses. Sigh.

Disclaimer: This is not a comparison of OSes. The numbers really don’t reflect anything significant about Windows–and are a greater indicator of Oxford’s decision-making when deciding what to include in his article.

Share/Save/Bookmark

Comments (12)

Timmy: Digest Edition

The big news is that I’m leaving tomorrow, and will be gone until July 18th. Thanks to the wonders of Akismet, blog maintenance hasn’t been a problem recedntly: hopefully it won’t become one.

In other news, I’ve been having an epic struggle with the Thinkpad. Ubuntu and CrunchBang are way too slow. SliTaz and USE won’t recognize my wired network card. Arch flatly refused to make X cooperate, although I’m wondering if that wasn’t a human-based error…I might try that again once I get back. And currently it has Ubuntu GTK 1.2 Remix, which does recognize the network card, and let me very easily install Wine–let there be much LANing.

I’ve also been plugging away at Twirminal, a terminal-based Twitter client written in Python with curses. It’s looking kind of promising–if it enters Alpha, I’ll either make a Subversion branch here, or else just host it on Launchpad. And even if it doesn’t work, it’s very nice to be writing in Python, not Java. My brain is smiling.

Share/Save/Bookmark

Leave a Comment