aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMoritz Meißelbach <arbelzapf@gmail.com>2020-06-19 22:31:54 +0200
committerMoritz Meißelbach <arbelzapf@gmail.com>2020-06-19 22:31:54 +0200
commit2383aa498192091f08f57576ad1bac41cf85457f (patch)
treed8d0deede7b7763d49dc0c59f1a47cf3420441ee
parent7cc736d5d37f33c6b07eea15c9d220dd2ee5b7c9 (diff)
downloadsway-launcher-desktop-2383aa498192091f08f57576ad1bac41cf85457f.tar.gz
sway-launcher-desktop-2383aa498192091f08f57576ad1bac41cf85457f.zip
#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`
-rw-r--r--README.md5
-rwxr-xr-xsway-launcher-desktop.sh7
2 files changed, 11 insertions, 1 deletions
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 &)