Sleep Display Script
Posted in Mac OS X, Shell on 11/27/2007 05:08 pm by jmccuneHere’s a quick script I cooked up to turn off the blinding light that is my iMac display when I go to bed at night.

Features:
- Runs great from Quicksilver.
- Talks to you. (May not be a feature.)
- Doesn’t require administrative rights.
#!/bin/bash # Jeff McCuneexport CURRENT_DELAY=$(pmset -g | grep displaysleep | awk '{print $2}') # Charger or Battery Flag. pmset -g | grep -q '^AC.*\*' && export MODE="-c" || export MODE="-b" say "The display will shut off in about 90 seconds" & # force allows this to work for non-admin users. pmset force $MODE displaysleep 1 # Quicksilver blocks until script completion. Fork off the reset command. bash -c 'sleep 120; pmset force $MODE displaysleep $CURRENT_DELAY' & exit 0


The DVD drive on my desktop Mac is broken, making it difficult to install the operating system. I wanted to put Leopard on this machine today, so I tried installing to the machine from my MacBook Pro.
One of the small, but incredibly useful features for me in Leopard is that ssh-agent is automatically running for each user account. This relatively small change allows me to log into remote machines without entering my password each time.


I quickly noticed that the “mate” command line tool does not work as expected under GNU Screen on Leopard. The error I get is:
So I’m finally running Mac OS X 10.5 Leopard on my portable. I’ve decided to migrate to the new sparsebundle style FileVault image, and here’s how I did it: