From d59b574b67e36ec5420cfedcbf489d9184b3a691 Mon Sep 17 00:00:00 2001 From: David Runge Date: Tue, 23 May 2023 09:15:04 +0200 Subject: zsh: move configs to XDG_CONFIG_HOME with the help of ZDOTDIR --- .config/zsh/.zprofile | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 .config/zsh/.zprofile (limited to '.config/zsh/.zprofile') diff --git a/.config/zsh/.zprofile b/.config/zsh/.zprofile new file mode 100644 index 0000000..4ec678f --- /dev/null +++ b/.config/zsh/.zprofile @@ -0,0 +1,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 -- cgit v1.2.3-70-g09d2