The shell '>' redirect creates ACTION_FILE immediately as an empty file. The poll loop checked [ -f ] (exists) instead of [ -s ] (non-empty), so it matched on the first 0.2s iteration, found no 'cancel' string, and broke out of the loop — leaving mpv running with no listener. [ -s ] only returns true once notify-send writes 'cancel' to the file (i.e. when the user actually clicks the Abbrechen action).