lib: add import-env
This commit is contained in:
parent
6345cbdb09
commit
3eb81b9445
|
@ -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[@]:#}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue