Screenshotting in i3

It took me a while to find a screenshot tool as useful as the built in screenshotting tool in OS X. I looked again today and found the import tool that comes as part of ImageMagick.

$ import screenshot.png

You can use it to capture an area on the screen with the above command or you can capture a whole window.

$ import -window root screenshot.png

I will probably throw this into a script and bind it to a key for ease of use.

Adding a TrueType font

I needed to add a .ttf font for a presentation I was working on, it turned out to be a lot more hassle than it needed to be.

$ mkdir ~/.font  
$ cp font.ttf ~/.font/
$ mkfontdir ~/.font  
$ fc-cache

I read a lot about editing xorg.conf to change font paths, in the end it was a matter of refreshing the font cache and restarting evince.

wait_on

I have been working on stuff in latex recently and wanted something to trigger regeneration of pdfs without manual intervention. At first I thought about doing so in a loop every so often, but it didn't seem like the best approach.

Knowing about the cool kqueue framework I looked to see if there was a utility to watch files for me. I found the wait_on command via a FreeBSD forums post.

The wait on command will wait until the watched file has been changed and then exit. It is meant to be used within a loop. I through this together in zsh. Now when I :wq in vim wait on exists and my document rebuilds, evinces picks up on this and refreshes the display.

$ while true; do wait_on pres.tex; xelatex pres.tex; sleep 5; done

I have the sleep at the end to stop the document being built too often.

Controlling keyboard leds

I have just finished reading Cryptonomicon , without any spoilers I can say that at a certain point a character controls the led's on his keyboard. This morning I found the kbdled utility via a forum post. It looks like a nice simple way to make the keyboard do something useful.

Using portmaster to bulk install ports

As I write this there are not any packages available for FreeBSD arm. That means on the Raspberry Pi I have to build the things I need from ports. Ports gives a lot of control about how the software is built, but right now I just want the tools I need installed.

It is hard to set up ports to install a collection of tools in a oner, but we can use portmaster to do this for us. The Pi is quite slow and will take a long time to build a small number of tools and their dependencies.

Normally portmaster will prompt for configuration for each package as it builds, it will then build a list of packages and prompt again to install these. The following line will install the listed tools without any prompting.

$ portmaster -mBATCH=yes --no-confirm -y sysutils/tmux editors/vim
  • The -m flag will pass options to make
  • --no-confirm will disable the 'install' prompt
  • -y will answer yes to any prompts