diff --git a/README.md b/README.md index 7712704..dac8fa4 100644 --- a/README.md +++ b/README.md @@ -73,7 +73,7 @@ Firestarter, in addition to spawning the programs in the default configs, also i * The `wm` config file is special; if it exists and a target can be found for it, firestarter will watch the `_NET_WM_NAME` atom on the root window, waiting for it to initialize before starting XDG autostarts. This prevents applications from being started before the WM is ready to manage them. You can disable this by setting `FS_NOWAITWM`. -* In addition to this, setting the `FS_DIEONWM` variable makes firestarter automatically end the session if the WM were to die for any reason. This requires that the target be a simple invocation of the WM; `TERMINAL=urxvt i3` will not work. +* In addition to this, setting the `FS_DIEONWM` variable makes firestarter automatically end the session if the WM were to die for any reason. This requires that the target not contain any environment variable declarations; `TERMINAL=urxvt i3` would not work. Arguments are okay. ## Contribution diff --git a/firestarter b/firestarter index 1dce433..3f0d219 100755 --- a/firestarter +++ b/firestarter @@ -325,10 +325,11 @@ step_wait() { [ -n "$_optdryrun" ] && exit 0 trap step_logout EXIT log "Checking for window manager" 2 - if [ -n "$FS_DIEONWM" ] && gettarget "$_optconfigdir/wm"; then + if [ -n "$FS_DIEONWM" ] && gettarget "$_optconfigdir/wm" && has strings; then target="$_return" for job in $(jobs -p); do - if [ "$target" = "$(cat /proc/$job/cmdline)" ]; then + # Trailing space here is due to an idiosyncracy with strings + if [ "$target " = "$(cat /proc/$job/cmdline | strings -1 -s ' ')" ]; then log "Waiting for WM to exit: \"$target\"" wait "$job" exit 0