Seth Milliken

Words, Thoughts, Tech

categories: /
tags: blog server
mac os x instant display sleep rant [Permalink]
Wed Oct 31 17:29:51 PDT 2007
Category [tech/]

Why is it so freaking hard to bind a keyboard shortcut to putting the displays to sleep immediately in Mac OS X? In the classic Mac OS, there was a hot key that did just this, at least on PowerBooks (I can't remember exactly what it was, and I don't think it was remappable, but it was there). Whenever I stepped away from my PowerBook or didn't anticipate needing to use it right away, I could tap those keys and the backlight would instantly shut off, saving some precious juice. Nowadays, my laptop usage patterns are a bit different and I don't tend to need to squeeze out every last minute of battery life anymore. But on the desktop machines I use regularly, which have no fewer than four displays connected to them, I want to be able to put all of those displays into power saving mode immediately. The main reason is so that my bedroom isn't lit up like a Christmas tree when I want to go to sleep, but I also prefer not to waste power needlessly and hope to maybe get a little more life out of the LCD backlights by turning them off when I'm not actually using them. Let me note here that even with a black screen, LCD backlights still generate a fair amount of light; the displays really need to be off. Another factor is that not all of the displays can be plugged into the same power strip, enabling me to turn them all off and on with a single flip of a switch (e.g. Apple Cinema Displays get their power directly from the computer they are plugged into). And anyway I prefer to have a uniform mechanism for controlling display sleep regardless of which machine I'm using and whether the energy saver settings have put the displays to sleep or I have done so explicitly. Besides, it's nice to be able to just hit a key on the keyboard to wake up the displays. I think that covers the reasons why I want this feature, and hopefully preempts some of the not so helpful suggestions I've seen other netfolk offer in response to similar pleas.

Prior to Leopard, I had a shell script that looked like this:

#!/bin/sh
  
MAGIC_NUMBER=107374183
PMSET=/usr/bin/pmset
GREP=/usr/bin/grep
AWK=/usr/bin/awk
SLEEP=/bin/sleep
    
$PMSET force -a displaysleep $MAGIC_NUMBER
$SLEEP 1
$PMSET force -a displaysleep `$PMSET -g | $GREP displaysleep | $AWK '{print $2}'`
$SLEEP 1

I was able to use a QuickSilver to bind execution of this script to a function key and I was mostly happy. It executed very quickly, and did just what I wanted it to do.

But as you can see, this script relies on a magic number—one that is undocumented and is possibly even the result of a bug. Now that I've upgraded to 10.5, this magic number no longer works; the script does nothing. Without a working magic number, the best you can do with a script like this is have the display sleep after one minute (the lowest effective pmset displaysleep argument is 1; 0 disables display sleep altogether).

Leopard introduces a new feature that allows you to bind a screen corner to "Sleep Display". So now this instant display sleep feature is explicitly supported in the operating system. Sort of. As far as I can tell, there is absolutely no way other than the hot corner to access this feature. Nothing in AppleScript, nothing in pmset, nothing in keyboard shortcuts, no menu item, no hot keys documented or otherwise, nor even a system level API that I could use to write a stupid little Cocoa app. I hope I am wrong; this omission aggravates me much more than it really ought to.

UPDATE: Malcolm Hall has come to the rescue with SleepDisplay.app. Thank you, Malc!

Posted by: Seth Milliken Comments [1]  Trackbacks [0]
universal access zoom feature finally fixed [Permalink]
Wed Oct 31 17:53:50 PDT 2007
Category [tech/]

Prior to Mac OS X 10.5 (Leopard), there was a bug that made using the Universal Access zoom feature (accessible by default with Option-Command-8) useless in a multiple display configuration in which the virtual heights of the arranged displays differed. As soon as you activated the zoom feature, the portal created by your displays would lock essentially to the height of the primary display, making it impossible to scroll to the portions of the virtual screen that mapped to the higher or lower displays, and in some cases you couldn't even see the menu bar. Basically, you could pan horizontally across your virtual screen, but not vertically.

This might not make any sense to you if you never tried this yourself, but they fixed this in Leopard and I'm happy about that.

Posted by: Seth Milliken Comments [0]  Trackbacks [0]
apache customizations [Permalink]
Mon Feb 26 23:55:17 PST 2007
Category [tech/]

I wanted to set up a second site on a machine that was already hosting, so I looked into setting up VirtualHosts. Here are some bits that I learned that were not in the documentation or clear from the documentation. Everything outside of the VirtualHost containers are default settings for all containers. The first container is the default; if no container matches the requested host exactly, the first one will be used. So don't use a servername or serveralias in that container if you want a last resort default. You'll want to specify ServerName, ServerAlias, and DocumentRoot as minimum settings in your subsequent containers.

# Main configuration
# Example settings...
ServerName default.mydomain
ServerAdmin admin_address@mydomain

User www
Group www

DocumentRoot "/default/docroot"
<Directory "/default/docroot">
	Options Indexes FollowSymLinks
	AllowOverride None
	Order allow,deny
	Allow from all
</Directory>

IndexOptions FancyIndexing VersionSort
IndexOptions NameWidth=*
IndexOptions IconWidth=16
IndexOptions IconHeight=16
IndexOptions SuppressDescription
# ... other index settings

# ... many other settings

# Use name-based virtual hosting.
NameVirtualHost *

# Default host
<VirtualHost *>
	# no ServerName directive
	ErrorLog "logs/default-host-error.log"
	CustomLog "logs/default-host-access.log" common
	# These lines let us use the rewrite rules defined in the main configuration.
	RewriteEngine on
	RewriteOptions inherit
</VirtualHost>

<VirtualHost *>
	ServerName virtualhost1.mydomain
	ErrorLog "logs/vh1-host-error.log"
	CustomLog "logs/vh1-host-access.log" common
	DocumentRoot "/some/other/docroot"
	<Directory "/some/other/docroot">
		Options Indexes FollowSymLinks
		AllowOverride None
		Order allow,deny
		Allow from all
	</Directory>
	# to enable serving up default "~/Sites" directories on Mac OS X
	UserDir "Sites"
</VirtualHost>

Posted by: Seth Milliken Comments [0]  Trackbacks [0]
ssh-ftp [Permalink]
Tue Aug 08 23:59:59 PDT 2006
Category [tech/]

I was poking around in iStumbler and noticed a "Secure File Sharing" option which mapped to sftp-ssh. Looking through the various directories responsible for providing services in Mac OS X, I discovered that the sftp-ssh service is provided by the ssh launchd daemon. So by enabling the "Remote Login" option in the Sharing System Preference Pane, you automatically get sftp. Cool.

Posted by: Seth Milliken Comments [0]  Trackbacks [0]
new blog software [Permalink]
Thu Jun 29 12:51:54 PDT 2006
Category [tech/]

I'm migrating blogs hosted at araxia.net from MoveableType to blojsom. I'm posting the status on the migration here.

Posted by: Seth Milliken

Technorati Tags:

Comments [0]  Trackbacks [0]
 
November 2008
Sun  Mon  Tue  Wed  Thu  Fri  Sat 
      1
2345678
9101112131415
16171819202122
23242526272829
30      
<  Oct   Nov    Dec  >
Links

Categories

Contact Information
Numbers:
(415) 395-9812 Home
(415) 247-7019 Work
(415) 710-1357 Cell
Address:
770 California St # 100
San Francisco, CA 94108
email: <seth@araxia.net> PGP
categories: /

Powered By blojsom   RSS Feed  RSS2 Feed  RDF Feed

html hits: 22714