elkowar / eww

ElKowars wacky widgets
https://elkowar.github.io/eww
MIT License
9.15k stars 379 forks source link

[BUG] Bash scripts timeout if they sleep #965

Open jwe66 opened 10 months ago

jwe66 commented 10 months ago

Checklist before submitting an issue

Description of the bug

ERROR eww::widgets            > WARNING: command /bin/bash -c "scripts/popup spt false" timed out

This occurs if my script sleeps for more than 0.1 seconds (when the script is called from an eventbox in eww with a timeout well over the sleep period).

Reproducing the issue

#!/bin/bash
spt() {
    LOCK_FILE="/tmp/eww/spt_dashboard.lock"
    EWW_BIN="/usr/bin/eww"
    if [[ $1 == false ]]; then
        ${EWW_BIN} -c "$HOME/.config/eww" update spt_spawn="$1"
        sleep 0.5
        ${EWW_BIN} -c "$HOME/.config/eww" close spt
        rm "$LOCK_FILE"
    else
        ${EWW_BIN} -c "$HOME/.config/eww" open spt
        touch "$LOCK_FILE"
        ${EWW_BIN} -c "$HOME/.config/eww" update spt_spawn="$1"
    fi
}

if [[ "$1" = "spt" ]]; then
    spt "$2"
fi

run this script, where spt_spawn is a boolean tied to a reveler for a whole window. the point is to wait out the animation.

Expected behaviour

The window should fade away then close.

Additional context

No response

tokyob0t commented 10 months ago

try calling the script but with an ampersand at the end, e.g. :onclick "./scripts/script &" :)