After a talk with Emanuele Torre(emanuele6) on matrix/IRC channel he provided this solution:
rofi -show &
rofi_pid=$! rofi_wid=$(xdo id -mp "$rofi_pid") &&
xprop -id "$rofi_wid" \
-f _NET_WM_WINDOW_TYPE 32a \
-set _NET_WM_WINDOW_TYPE _NET_WM_WINDOW_TYPE_POPUP_MENU
quote emanuele6:
so basically exec rofi ... & is your rofi command rofi_pid=$!
is the pid of the new rofi process rofi_wid=$(xdo id -mp
"$rofi_pid") waits until a window with that _NET_WM_PID exists and
then outputs its wid and finally xprop sets that atom to what you want
This indeed sets _NET_WM_WINDOW_TYPE, but (at least for me) picom won't apply animations (not sure if window was already mapped).
Other option would be use rofi flag -normal-window
I use bspwm with rofi ... -normal-window, so in external_rules I have set:
# rofi set _NET_WM_WINDOW_TYPE
# bspwm doesn't manage these windows because rofi overrides redirect by default
case "$class" in
(*Rofi*)
#echo "manage=off" #this will break rofi focus don't use this
echo "layer=above"
echo "focus=on"
echo "state=floating"
xprop -id "$wid" \
-f _NET_WM_WINDOW_TYPE 32a \
-set _NET_WM_WINDOW_TYPE _NET_WM_WINDOW_TYPE_POPUP_MENU
;;
esac