feat(wrapper): Ability to override app executable

This commit is contained in:
Michael Carlberg 2016-06-14 12:20:18 +02:00
parent 6cae06c4dc
commit fc2a6ed795
1 changed files with 6 additions and 5 deletions

View File

@ -1,6 +1,5 @@
#!/usr/bin/env bash #!/usr/bin/env bash
#set -eux
set -eu set -eu
set -o pipefail set -o pipefail
@ -12,12 +11,14 @@ command -v lemonbar >/dev/null || {
echo "Lemonbar is not installed" ; exit 1 echo "Lemonbar is not installed" ; exit 1
} }
command -v lemonbuddy >/dev/null || { lemonbuddy="${LEMONBUDDY_EXECUTABLE:-lemonbuddy}"
command -v "$lemonbuddy" >/dev/null || {
echo "Lemonbuddy is not installed" ; exit 1 echo "Lemonbuddy is not installed" ; exit 1
} }
lemonbar="$(lemonbuddy "$@" -x)" lemonbar="$($lemonbuddy "$@" -x)"
wmname="$(lemonbuddy "$@" -w)" wmname="$($lemonbuddy "$@" -w)"
logfile="${XDG_CACHE_HOME:-$HOME/.cache}/lemonbuddy/${wmname}.log" logfile="${XDG_CACHE_HOME:-$HOME/.cache}/lemonbuddy/${wmname}.log"
logdir="$(dirname "$logfile")" logdir="$(dirname "$logfile")"
pipe="$(mktemp -u /tmp/lemonbuddy.in.XXXXX)" pipe="$(mktemp -u /tmp/lemonbuddy.in.XXXXX)"
@ -37,7 +38,7 @@ cleanup_proc() {
} }
# shellcheck disable=SC2094 # shellcheck disable=SC2094
{ lemonbuddy "$@" -p "$pipe"; kill -TERM $$ 2>/dev/null; } | $lemonbar >"$pipe" & { $lemonbuddy "$@" -p "$pipe"; kill -TERM $$ 2>/dev/null; } | $lemonbar >"$pipe" &
trap 'cleanup_proc $!' TERM INT trap 'cleanup_proc $!' TERM INT