Tenshu posted about hacking ssh hostnames into his screen's shelltitle display since he's using hardtitle and doesn't want to see a bunch of non-descript "ssh" "ssh" "ssh" when he logs into multiple machines. We can actually accomplish the same directly in our shell without having to change our local ssh config.

ssh() {
	# we could be smarter about detecting the hostname
	host=$(echo $1 | sed -e 's/\..*//' )
	printf "\033k${host}\033\134"
	binssh=$(which ssh 2>/dev/null)
	${binssh} $*

Screen updates the hardtitle whenever you send it ESC-k ESC-\, so we just need our shell to emit ESC-k ${HOSTNAME} ESC-\ after we typed ssh ${HOSTNAME}. The snippet above shortens a possibly fully-qualified domain name (because you bash-complete ssh hostnames, right? ;) down to just the hostname, emits the screen shelltitle changing escape codes, and then calls the real ssh binary.