Fix preexec and postexec conditions in zsh_hooks

Uses $GDMSESSION to determine if we're in tty or X. We don't want set_running_app() to
run in tty because it causes input to be printed to output.
Refactor login logic for fbterm support in tty
Use "case" testing for setting $TERM variable