lib: add import-env

This commit is contained in:
crater2150 2023-06-01 12:08:31 +02:00
parent 6345cbdb09
commit 3eb81b9445
2 changed files with 9 additions and 4 deletions

View file

@ -64,3 +64,10 @@ pip-venv-deps() {
exit 1
fi
}
import-env() {
SOURCE_PROCESS=$1
SOURCE_PID=$(pgrep $SOURCE_PROCESS | head -n 1)
SOURCE_ENV=("${(@ps:\000:)$(</proc/${SOURCE_PID}/environ)}")
export ${SOURCE_ENV[@]:#}
}

View file

@ -1,10 +1,8 @@
#!/bin/zsh
#dep:xprintidle pgrep chronic
ALLARGS=("$@")
WINDOW_MANAGER=awesome
WM_PID=$(pgrep WINDOW_MANAGER | head -n 1)
export "${(@ps:\000:)$(</proc/${WM_PID}/environ)}"
source ${$(realpath "$0"):h:h}/lib/common.zsh
import-env awesome
zparseopts -D -maxidle:=maxidle -in-chronic=chronic l:=logfile -logfile:=logfile