Text

On switching to Arch Linux

So you’re thinking about switching to Arch. Here are some things you should probably know first.

(I’m assuming you already know all the great things about Arch — otherwise, you wouldn’t be thinking about switching — so I’ll skip that part).

Potential downsides to Arch

First of all, nothing works out of the box. You will have to manually set up the driver for your video card, support for your sound card (which can be a little difficult if you use USB headphones), wifi support, Xorg, your desktop environment and/or window manager of choice, etc. If this sounds horrible to you, then Arch probably isn’t for you.

You also have to make lots of choices yourself. You start with nothing and build your way up according to your own preferences, so if you’re the kind of person that doesn’t enjoy tweaking or researching and would rather just go with the flow and use whatever your distro installs for you, then Arch isn’t a good fit.

Finally, a downside of Arch pushing software updates to the repos so quickly is the potential for stability issues. I personally haven’t had any issues in the months that I’ve been running Arch, but you see some reports of issues related to running cutting edge software (often related to the wrong versions of dependencies). Note, however, that reading the Arch news on the homepage often gives you advanced warning of things to watch for.

Tips on installation

If you’ve finally decided you’re going to try it, then read on — there are some things to keep in mind when installing Arch.

Before the install

Before you start the install, make sure you’re installing it next to a 2nd computer with internet access. This way you can follow the install directions in the wiki and you can also Google any random issues that come up.

Also, go ahead and research/decide on which desktop environment and/or window manager you want to use. Arch supports pretty much all of them, so the choice is yours, and you want to have your mind made up before the install so you don’t have to stop in the middle of it to decide.

Note that the typical first-time Arch install takes somewhere around 2 hours to get everything working (maybe more if you run into issues) so make sure you have some free time.

Make sure that the computer you’re installing Arch on is hooked up to the internet via a wired connection, so you don’t have to mess with setting up wifi before the installer can begin.

Finally, Google your hardware to make sure there aren’t compatibility issues. This means everything — sound card, video card, headphones, printer, etc. There’s nothing worse than getting a working install and then realizing that your sound card isn’t supported.

During the install

Use the Beginner’s Guide like your life depends on it. It leads you through the install step by step and you do NOT want to try installing without it. Don’t skip any parts, and don’t do anything you’re unsure of; if the Beginner’s Guide doesn’t answer a question, then Google it before just guessing.

When the time comes in the install process where it asks you which packages you want installed, I recommend not installing anything at this point. Eventually, you’ll want to install and configure Xorg along with your DE or WM of choice, but that can easily be done after the install rather than during, and that way you’re taking it one step at a time. Save any apps you want installed for last.

After the install

Once the install is complete, you’ll first want to set up Xorg and make sure that’s working (the Beginner’s Guide also covers this). Then you’ll want to install your DE and WM of choice. Then you’ll want to get sound and wifi and other misc hardware working (there are usually wiki pages for whatever you’re working on). Finally, go ahead and install the apps you want and start tweaking.

Getting help

If at any point you run into issues, spend time researching and Googling before you resort to asking on the Arch forums or in IRC. The Arch community as a whole focuses on self-service and solving your own problems, and if it’s obvious that you haven’t tried, then they proably won’t be too friendly about helping you out.

Tags: Arch Linux
Text

My quest for a tiling window manager

I’ve never used a tiling window manager before, but lately I’ve been doing more and more with the command line, and I’ve been using vim-only for almost a year now, so it seems like a natural next step.

So I went through a few of them over the weekend looking for the right one. But first, some background.

What is a tiling WM?

Most computers have “floating window managers” that let windows overlap and let the user drag them around and resize them. In contrast to that, a tiling window manager stacks windows up side by side according to preset layouts and groups them into workspaces. That’s a huge oversimplification, but it’ll do for now.

Why the crap would you want that?

For one, they’re much easier to control using only the keyboard. Most of them have a “mod” key (usually either the left alt key or the windows/super key), and you control the WM doing stuff like mod+2 (switch to workspace 2), mod+j (focus on the window below the current one), mod+space (change layouts), etc.

Also, they save space since there are no window decorations and no space between windows.

Finally, lots of people like the automation this allows. You can say stuff like “open my IM client and windows in the third workspace using the three column layout” and you don’t have to arrange stuff manually or move anything around (although you can).

XMonad

I started with XMonad just because it had a really helpful page on using it as a drop in replacement for the default Gnome WM, so I could still use all the good stuff Gnome has to offer easily.

I had trouble with installation (on login, I kept getting “session not found” errors), and it turned out it was because I named one of the config files xnomad.desktop instead of xmonad.desktop without thinking. Once that was worked out, it was pretty smooth. It was basically Gnome 2 (including the panels) but with XMonad instead of Metacity.

I liked it, but I wanted to change a couple things (add a few non-core layouts and change the color of the red border on active windows, for example), and all configuration to XMonad is done in Haskell, and this threw me for a loop. Everyone said you could easily just copy and paste from sample configs on the net but I didn’t have any luck with that, and I didn’t want to have to learn Haskell just to configure my WM, so I moved on.

Awesome WM

Awesome and XMonad seem to be the two most popular nowadays, so it seemed logical to try them first. I apt-get’ted awesome and set it up to run inside of Gnome according to the instructions on the awesome wiki. This worked fine on the first try.

I didn’t really “get” awesome though. For example, awesome lets you tag windows rather than just stick them on workspaces, and each “workspace” is a tag, which means that windows can appear on multiple workspaces. I didn’t see the appeal of that. Also, I wasn’t a fan of the launcher because you couldn’t see what the remaining options are as you type like you can in dmenu and installing dmenu didn’t seem to work (hitting the key binding for it just redrew the screen). I also kept seeing weird gaps in between windows that I wasn’t able to fix. Finally, I tried switching the mod key from mod4 (windows key) to mod1, and it didn’t seem to change anything and I couldn’t figure out why. So I moved on out of frustration.

Scrot WM

Scrot WM came recommended on a couple of random forum threads so I tried it out. I apt-get’ted it and just ran it outside of Gnome since it was quicker to try out that way. I really really like Scrot WM for the most part. The default key bindings are vim-like which is great for me and it runs dmenu by default.

Unfortunately, the integrated panel doesn’t support any type of tray (I’d have to install something external like dzen2 which looked like a headache judging from the how-to’s I found), and when I tried integrating with Gnome, I couldn’t get the Gnome panel/tray to show up correctly. I’m not quite ready to leave a tray behind altogether (for stuff like chat notifications, the networking applet, etc.), so I moved on hoping to find perfection although I was sad to leave Scrot behind.

Stump WM

I didn’t try Stump WM out because the default key bindings are all very emacs-like which immediately put me off. Call it judging a book by its cover, but I wasn’t desperate yet.

dwm

I also didn’t try out dwm. It seems like the kind of thing that’s just a little too hardcore for me (you configure it by hacking the source code and recompiling), and I was looking for more of a beginner’s tiling wm for now.

Subtle WM

Subtle WM was an easy install (manually using Ruby/Rake) and it looks great by default. But it’s a manual tiling window manager, which means that you’re responsible for placing your windows where you want them, and they don’t just pop into the current layout on their own, and that wasn’t what I was after. I also had trouble figuring out how to use the thing - at first, I couldn’t do anything because the default terminal is urxvt which I didn’t have installed, and if you don’t have it, you basically can’t launch any programs. Once I installed it, the idea of clients and gravities didn’t click with me, so I gave up.

wmii, ion3, i3

All of these came recommended in a few places, but they’re all manual TWMs like subtle, so I moved on quickly, making a note to come back if/when I got desperate.

Back to XMonad

At this point, the tiny quirks I had with XMonad weren’t looking so bad, so I decided to log back into it and just give it a shot for a few days and see what I thought. That’s what I’m doing now, and so far, things are still going great. The default key bindings are vim-like (mod+j and mod+k to switch to the previous or next window, mod+h and mod+l to change the size of the master window) so it was easy to get used to quickly. There are tons of other layouts and goodies in the xmonad-contrib package but I haven’t opened that can of worms yet.

I really wanted to get xmobar and trayer going to get the full experience rather than using a Gnome panel, but for now, this’ll do. I’m really enjoying it so far.

If you have any questions or suggestions, feel free to stick ‘em in the comments.

Tags: Linux
Text

Linux: Recursive find and replace

After Googling for a bit, the easiest solution I could find uses find and sed. Here it is:

find ./ -type f -exec sed -i ’s/oldstring/newstring/’ {} \;

That will edit all the files in place and will NOT create backups so buyer beware.

Source

Text

Use `less` to view and search huge files

Every now and then I’ll have to search through a 10MB or 20MB SQL dump for something, and historically I’ve just used Gedit for this, even though it can take minutes to open it and scrolling is pretty much unusable.

Today, I discovered that if all you’re doing is viewing it and searching it, then less is definitely the way to go. It opens instantly and you can use vim syntax to search through it. Try it:

less your_huge_file.txt

Then just type /searchterm and hit enter to search, then n to cycle through the results.

Text

Some lesser known Ubuntu/GNOME apps

I’m going to try and limit this to apps that everybody hasn’t already heard of. Most of these you can just apt-get, and most of these I use at least daily.

  • Shutter - A screenshot program. Supports windows, selections, the desktop, uploading to online image hosts, inline image editing, etc. Really slick.
  • Midori - A GTK + WebKit based browser. Extremely lightweight/fast and finally stable with the latest (0.2.x) versions.
  • Parcellite - A clipboard manager that sits in the tray and saves a history of your copies. Has saved my butt MANY times.
  • gpick - A color picking tool that lets you grab a color from anywhere on your desktop and has support for building color schemes.
  • Mirage - A really quick image viewer with a layout that makes more sense than EOG or gThumb. Has support for really basic editing.
  • GMate - If you’re a coder, GMate will install and configure a bunch of plugins for gEdit
  • Guake - This borders on well-known, but whatever. It’s a really cool dropdown terminal that I use about every 10 seconds.
  • Microblog Purple - Integrates microblog platforms like Twitter into libpurple messengers, like Pidgin.
  • Getting Things GNOME - A nice little task manager with some cool plugins. I don’t use it anymore, but that’s just because I’m too lazy.
  • PDF Mod - Pretty simple PDF editing app that lets you rotate, remove pages, add pages, reorder, etc.
Tags: Ubuntu Apps Linux
Text

Linux: Recursively search through files for a pattern

I’ve been using a horrific monstrosity of a find command for this, and I just found out that grep can handle this by itself. Watch:

grep -rl 'your pattern' your_directory

For example, say you’re in the web root and you need to find every file which calls a certain function. You’d run:

grep -rl 'function_name' *

So easy. I’m so dumb.

By the way, the ‘-r’ makes it recursive and the ‘-l’ makes it just list the filename (instead of the filename and the context of the match).

Text

Parcellite: A GNOME Clipboard Manager

So Ubuntu/GNOME still has a pretty annoying bug where if you copy something to the clipboard, and then exit the program it was copied from, you lose your copy. This may seem petty but, fair readers, think again! I can’t tell you how many times I have copied some important code out of an unsaved file, exited the unsaved file, and then was unable to paste it into the new file, losing the code FOREVER!

Enter Parcellite, a clipboard manager which fixes that and also adds a history of copied things. So not only will you not lose what you just copied, but you can also look at the last 25 or so things you copied and grab one of them again.

For those of you in the know, it basically does the same thing as Glipper, but it’s much more lightweight and seems a little more reliable/stable on my box.

Anyways, check ‘er out.

Tags: Linux Ubuntu Apps