From 2383aa498192091f08f57576ad1bac41cf85457f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20Mei=C3=9Felbach?= Date: Fri, 19 Jun 2020 22:31:54 +0200 Subject: #22. Add some very basic logging to help investigate this bug. debug information is directed to file descriptor 3 and can be dumped using `./sway-launcher-desktop.sh 3>> ~/sway-launcher-desktop.log` --- README.md | 5 +++++ sway-launcher-desktop.sh | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 84d716c..8d305f0 100644 --- a/README.md +++ b/README.md @@ -62,3 +62,8 @@ The `launch_cmd` is fired when the user has selected one of the provider's entri Note: Pass the environment variable `PROVIDERS_FILE` to read custom providers from another file than the default `providers.conf`. The path in `PROVIDERS_FILE` can either be absolute or relative to `${HOME}/.config/sway-launcher-desktop/`. + + +## Troubleshooting + +Debug information is directed to file descriptor `3` and can be dumped using `./sway-launcher-desktop.sh 3>> ~/sway-launcher-desktop.log` \ No newline at end of file diff --git a/sway-launcher-desktop.sh b/sway-launcher-desktop.sh index 7199474..34b7313 100755 --- a/sway-launcher-desktop.sh +++ b/sway-launcher-desktop.sh @@ -138,7 +138,9 @@ function entries() { # the empty stdin is needed in case no *.desktop files } function run-desktop() { - bash -c "$("${0}" generate-command "$@")" + CMD="$("${0}" generate-command "$@")" + echo "Generated Launch command from .desktop file: ${CMD}" >&3 + bash -c "${CMD}" } function generate-command() { # Define the search pattern that specifies the block to search for within the .desktop file @@ -232,6 +234,7 @@ describe | describe-desktop | describe-command | entries | list-entries | list-c exit ;; esac +echo "Starting launcher instance with the following providers:" "${!PROVIDERS[@]}" >&3 FZFPIPE=$(mktemp -u) mkfifo "$FZFPIPE" @@ -276,4 +279,6 @@ readarray -d ${DEL} -t PROVIDER_ARGS <<<${PROVIDERS[${PARAMS[1]}]} # Substitute {1}, {2} etc with the correct values COMMAND=${PROVIDER_ARGS[2]//\{1\}/${PARAMS[0]}} COMMAND=${COMMAND//\{2\}/${PARAMS[3]}} +COMMAND=${COMMAND%%[[:space:]]} +echo "Launching command: ${COMMAND}" >&3 (exec setsid /bin/sh -c "${COMMAND}" &>/dev/null &) -- cgit v1.2.3