A prettier Terminal in OS-X Part 2 (urxvt and more awesomeness)
Table of Contents
Update: thanks to Sung Pae you don’t need to rename perl, you can just set the environment variable:
PERL=/usr/bin/perl ./configure --foo --bar ...
Update2: you also no longer need the system perl at all along with the
double free patch. since my own macosx-clipboard got released with urxvt
9.07 see the changelog here
it does depend on Mac-Pasteboard though.
Last time I explained a bit on how to get awesome going.
There is a few tuning settings you can do for better awesome usage…
First of all I like the snap font frome the artwiz package for my title bar:
mkdir ~/.fonts
wget http://reza.jelveh.me/blog/assets/artwiz-aleczapka-en-1.3.tar.bz2
tar xjvf artwiz-aleczapka-en-1.3.tar.bz2
mv artwiz-aleczapka-en-1.3/snap.pcf ~/.fonts
fc-cache -fv ~/.fonts
Second you might like to have the right apple key as mod and the left one as alt. That way you can have awesome use it’s hotkeys using mod2 and have programs like irssi hook the left apple key as alt while letting your option key work for apostrophes and the like. Note that I use us dvorak as default layout and thus don’t have ??? etc. directly on the keyboard… So YMMV and you might want to adjust the following to your needs. I use the following in my ~/.xmodmap
! left apple key becomes alt
! and right one stays meta
clear mod1
clear mod2
keycode 71 = Alt_L
add mod2 = Alt_L
keycode 63 = Meta_L
add mod1 = Meta_L
I have attached my Xdefaults and awesomerc. After disabling the “Enable key equivalents under X11” in Xquartz preferences you can bind awesome keys the way you want them. With my config, leaving X11 would be apple-shift-w. The reason I don’t use Apple-Q is that there is no prompt on exit and in very rare cases the Apple-Q gets passed through from another app you close on top of Xquartz. Apple-W properly closes windows and so on. You should just check the config for the hotkeys.
Oh and don’t forget to do a:
sed -i '' 's/timebomb/YOURUSER/g' ~/.Xdefaults
if you decide to use my Xdefaults.
You should also disable the xterm autolaunch in Xquartz. As the UserFAQ states the following should do the trick:
defaults write org.x.X11 app_to_run /usr/bin/true
Personally I use terminus-font for coding and terminal activity. You can install it with:
sudo port install terminus-font
Again, you might, or might not like it, in which case you will probably like to change your terminals font in the Xdefaults after copying it to ~/.Xdefaults.
Now if you look at my past post, I launch urxvtd in my xinitrc and my awesomerc refers to urxvtc and you might wonder wtf is does, as I did. Well, basically it will just launch one urxvt daemon and many clients. That way the memory usage gets cut down by a lot and the launch times drop a lot too.
Now there is a little issue with urxvt in osx. If you install it through macports it will use macports perl. Why is that such a problem? As far as I know it doesn’t include the obj-c bindings. Which means that you won’t be able to copy and paste without mouse or shift-insert(which wouldn’t be such a problem if we had insert keys on our mac keyboards). I admit there is other ways to handle it, but I settled with the following solution… Basically all you do is compile urxvt with stock perl and patch it.
Before you do the thing below you will probably want to backup ports perl5
#!/bin/sh
mv /opt/local/bin/perl5 /opt/local/bin/perl5bak
ln -s /usr/bin/perl /opt/local/bin/perl5
wget http://dist.schmorp.de/rxvt-unicode/rxvt-unicode-9.06.tar.bz2
tar xjvf rxvt-unicode-9.06.tar.bz2
cd rxvt-unicode-9.06
patch -p1 < doc/urxvt-8.2-256color.patch
patch -p0 < ../rxvtperl-objc-doublefree.diff
./configure --prefix=/opt/local --enable-xterm-colors=256
find . -name Makefile -exec sed -i '' 's/-arch ppc//g' '{}' \;
cd src
make install
cd ../doc
make install
mv /opt/local/bin/perl5bak /opt/local/bin/perl5
Of course you need to replace ppc with i386 on a g4. Stock perl will make the configure try to build urxvt as universal build and fail (rxvtperl-objc-doublefree.diff is available here).
You might wonder why the double free patch is not included in the distribution of urxvt. Well apparently it’s not that common. I haven’t tried it on other systems, but it seems to be only happening when the objc bridge is loaded in urxvt(i.e. the macosx-clipboard plugin included in urxvt).
Another nice thing I use in urxvt is Barts url-yanking plugin. You can change the hotkeys in the Xdefaults I posted above. Just copy mark-and-yank into ~/.urxvt and you’re set. Basically I can cycle through urls in my console with M-U and launch them in the default browser upon pressing enter…. nifty!