aboutsummaryrefslogtreecommitdiffstats
path: root/_zlogin
blob: 0d73512d881b62f9513af1278d1c698eaccc32da (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#
# ~/.zlogin
# *finally* executed by a *login* zsh shell
# see man zsh(1)
#
# Credits:
# [1] Gentoo Wiki - X without Display Manager
#     https://wiki.gentoo.org/wiki/X_without_Display_Manager
#
# Aaron LI
# 2016-01-31
#

## Start `gpg-agent' on login (non-SSH connections)
GPG_AGENT_SOCKET="${XDG_RUNTIME_DIR}/gnupg/S.gpg-agent"
if [[ -z ${SSH_CONNECTION} ]] && [[ ! -S "${GPG_AGENT_SOCKET}" ]]; then
    gpg-agent --daemon --enable-ssh-support \
        --pinentry-program ${HOME}/bin/pinentry >/dev/null 2>&1
fi

## Auto start X if login on tty6
if (( ${EUID} != 0 )) && [[ -z ${DISPLAY} ]] && [[ ${TTY} = "/dev/tty6" ]]; then
    if [ -e ~/.xsession-errors ]; then
        mv -f ~/.xsession-errors ~/.xsession-errors.old
    fi
    exec startx ~/.xinitrc openbox >~/.xsession-errors 2>&1
fi

# vim: set ts=8 sw=4 tw=0 fenc=utf-8 ft=zsh: #