Zsh Login Script

about | blog | config | notes | github

This is the login script for Zsh which is used to create different environments in different tty.

1. Login Script

Need a logger just to keep track of things

source $HOME/org/config/lib/shell/logger
LOGGER=$(get_logger zsh.profile)

Setup the Herbstluftwm Tiling Window Manager during login

if [ -z "$DISPLAY" ] && [ "$(fgconsole 2>/dev/null)" -eq 1 ]; then
    $LOGGER "Starting xinitrc parameterized on herbstluftwm"
    export WINDOW_MANAGER='herbstluftwm'
    exec startx $HOME/.config/xinitrc herbstluftwm
fi

The remaining tty are for testing or recovery purposes. I primarily use tty2 for testing new window managers. In the case below, I'm trying out GNU/Emacs as a window manager.

if [ -z "$DISPLAY" ] && [ "$(fgconsole 2>/dev/null)" -eq 2 ]; then
    $LOGGER "Starting xinitrc parameterized on emacs"
    export WINDOW_MANAGER='exwm'
    exec startx $HOME/.config/xinitrc exwm
fi

Lets make tty3 the shell version of emacs which can be useful in certain situations

if [ -z "$DISPLAY" ] && [ "$(fgconsole 2>/dev/null)" -eq 3 ]; then
    $LOGGER "Starting Emacs CLI"
    export WINDOW_MANAGER='emacs-cli'
    exec emacs
fi

The remaining tty will drop into the system shell.

Created: 2021-11-13

Emacs 26.1 (Org mode 9.5)