All perfect praise be to Allah, The Lord of the Worlds. I testify that there is none worthy of worship except Allah, and that Muhammad is His slave and Messenger.
We have not come across any statement made by Ibn Al-Qayyim about the prohibition of greeting (someone) by means of a gesture. Rather, he stated on more than one occasion that it is permissible for the person performing prayer to return the greeting by gesturing.
As for the ruling on greeting by gesture, it was reported as forbidden in the Hadeeth of ‘Amr ibn Shu‘ayb, narrating it on the authority of his father, who narrated it from his grandfather, that the Prophet said: "He is not one of us who imitates other than us. Do not imitate the Jews or the Christians. Indeed, the greeting of the Jews is a gesture with the fingers and the greeting of the Christians is a gesture with the hand palms." [At-Tirmithi: Dha‘eef (inauthentic)]
Moreover, Jaabir ibn ‘Abdullah narrated that the Prophet said: "Do not greet the way the Jews and the Christians do: they greet by the hands, heads, and gestures." [An-Nasaa’i in As-Sunan Al-Kubra] Imaam Ahmad said about this Hadeeth, as reported by his son ‘Abdullah in Al-‘Ial: “It is a Munkar (denounced) Hadeeth that I strongly denounce.”
However, Al-Albaani classified these two Ahadeeth as Hasan.
This forbiddance denotes dislike (Karaahah) rather than prohibition (Tahreem) according to a group of leading scholars; An-Nasaai’, allocated a chapter in his book As-Sunan, entitled “Chapter: It is Disliked to Greet with a Gesture,” and so did An-Nawawi in Al-Athkaar. However, some contemporary scholars, like Ibn ‘Uthaymeen held that it denotes prohibition.
The forbiddance in this regard is confined to greeting with a gesture without uttering the greeting of peace, and also to the situation when there is no need to gesture with greeting without uttering the greeting of peace.
However, when there is a need, like in the case of a praying person returning the greeting of someone (during the prayer), then there is no prohibition as it was authentically reported that the Prophet returned the greeting with a gesture while performing the prayer.
For more benefit on returning Salaam while praying, please refer to Fatwa 362386.
Allah Knows best.