From 584c900e84996154ce150ff7f8f3aa7b5baf4077 Mon Sep 17 00:00:00 2001 From: crater2150 <crater@qwertyuiop.de> Date: Tue, 19 Sep 2023 10:48:15 +0200 Subject: [PATCH] Fix scripts using import env always exiting --- barrierc/run | 2 +- barriers/run | 2 +- import-env.zsh | 5 ++++- picom/run | 4 ++-- xss-lock/run | 2 +- 5 files changed, 9 insertions(+), 6 deletions(-) diff --git a/barrierc/run b/barrierc/run index e5cea40..4d2b4ce 100755 --- a/barrierc/run +++ b/barrierc/run @@ -7,5 +7,5 @@ if [[ ! -e ${0:a:h}/server ]] then exit 1 fi source ${0:a:h:h}/import-env.zsh -import-env awesome | exit 1 +import-env awesome || exit 1 exec barrierc --no-daemon $(<${0:a:h}/server) diff --git a/barriers/run b/barriers/run index 09c9756..a624eec 100755 --- a/barriers/run +++ b/barriers/run @@ -1,4 +1,4 @@ #!/bin/zsh source ${0:a:h:h}/import-env.zsh -import-env awesome | exit 1 +import-env awesome || exit 1 exec barriers --no-daemon -c ${XDG_CONFIG_HOME:-$HOME/.config}/Debauchee/home.conf diff --git a/import-env.zsh b/import-env.zsh index f6a2662..762d4cc 100644 --- a/import-env.zsh +++ b/import-env.zsh @@ -3,7 +3,10 @@ import-env() { SOURCE_PID=$(pgrep $source_name | head -n 1) if [[ -n $SOURCE_PID ]]; then break; fi done - if [[ -z $SOURCE_PID ]]; then return 1; fi + if [[ -z $SOURCE_PID ]]; then + echo "import-env: No matching process for: $*" + return 1; + fi SOURCE_ENV=("${(@ps:\000:)$(</proc/${SOURCE_PID}/environ)}") export ${SOURCE_ENV[@]:#} diff --git a/picom/run b/picom/run index 6fab42a..43562fd 100755 --- a/picom/run +++ b/picom/run @@ -1,4 +1,4 @@ #!/bin/zsh -source ${0:a:h:h}/import-env.zsh -import-env awesome | exit 1 +source ${0:A:h:h}/import-env.zsh +import-env awesome || exit 1 exec picom diff --git a/xss-lock/run b/xss-lock/run index 61701ce..156f7a4 100755 --- a/xss-lock/run +++ b/xss-lock/run @@ -1,4 +1,4 @@ #!/bin/zsh source ${0:a:h:h}/import-env.zsh -import-env awesome | exit 1 +import-env awesome || exit 1 exec xss-lock -l -- xsecurelock-wrapper 2>&1