aboutsummaryrefslogtreecommitdiffstats
path: root/.config/zsh/.zprofile
blob: 4ec678fb7bba5f67147a59035955f40ff39a4737 (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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#
# Executes commands at login pre-zshrc.

#
# Paths
#

# Ensure path arrays do not contain duplicates.
typeset -gU cdpath fpath mailpath path

# Set the the list of directories that cd searches.
# cdpath=(
#   $cdpath
# )

# Set the list of directories that Zsh searches for programs.
path=(
  /usr/local/{bin,sbin}
  $path
)


#
# Temporary Files
#

if [[ ! -d "$TMPDIR" ]]; then
  if [[ $USER == "root" ]]; then
    export TMPDIR="/tmp/$USER"
  else
    export TMPDIR="$XDG_RUNTIME_DIR"
  fi
  mkdir -p -m 700 "$TMPDIR"
fi

TMPPREFIX="${TMPDIR%/}/zsh"
if [[ ! -d "$TMPPREFIX" ]]; then
  mkdir -p "$TMPPREFIX"
fi


[[ "$TTY" == /dev/tty* ]] || return 0

if command -v systemctl > /dev/null; then
  export $(systemctl --user show-environment)
  if [[ -z $DISPLAY && "$TTY" == "/dev/tty1" ]]; then
    systemd-cat -t sway sway
    systemctl --user stop sway-session.target
    systemctl --user unset-environment DISPLAY WAYLAND_DISPLAY SWAYSOCK
  fi
fi