Delaying the execution of a command substitution for after the terminal window has opened

Hello !
I met an issue with the shell, that is absolutely normal functioning, but I noticed it only now because I started using comand substitution more.
I wanted that binding: bindsym $mod+o exec footclient micro (fzf)
to open a foot terminal, which would then run “micro (fzf)”
But … of course it runs first (fzf), then “footclient micro”. And that really opens nothing.
I’m sure there is a way to the shell to execute the command substitution only after the footclient window has opened.
I’m not an expert on shell… I tried escaping a few characters etc, to no avail. Same on other terminals, which isn’t a surprise.

Thanks !

ps: btw, fzf is love, fzf is life, long live fzf

alacritty -e micro $(ls -a -1 | fzf)

Is that what you mean? Replace alacritty obvs :smiley:

And it doesn’t work: identical command as the one I wrote. When you execute that in a terminal, does it produce another terminal, in which fzf runs ? Or it doesn’t run fzf in the same terminal as you ran the whole command in (as is does on mine) ?

For me it opens another terminal after I make a selection:
2021-12-30_21-35_2

WTF
I don’t understand. Foot’s developper said my behavior was the normal one with shells…
At some point I’ll change back to alacritty and/or bash and see.
btw: please send by mp your config giving that beautiful $ line in your term…

It’s spaceship it is in AUR.

13 aur/spaceship-prompt-git v3.11.2.r13.g50e371f-1 [+14 ~0.07] [Installed: v3.11.2.r351.gfc29884-1]
    A Zsh prompt for Astronauts

These are my modifications:

SPACESHIP_PROMPT_ADD_NEWLINE=false
SPACESHIP_PROMPT_SEPARATE_LINE=false
SPACESHIP_PROMPT_DEFAULT_PREFIX=
SPACESHIP_TIME_SHOW=true
SPACESHIP_DIR_PREFIX=$SPACESHIP_CHAR_SYMBOL
SPACESHIP_EXEC_TIME_ELAPSED=10
SPACESHIP_DIR_COLOR=093
#SPACESHIP_TIME_COLOR=red
SPACESHIP_GIT_SHOW=false
SPACESHIP_NODE_SHOW=false
SPACESHIP_TIME_FORMAT="%D{%Y-%m-%d} %B%F{blue}%T"

The rest is tmux oh-my-tmux: