4

For example, rofi runs as _NET_WM_WINDOW_TYPE_NORMAL (or, as I think I understand from the code, otherwise inherits from a parent window), but I'd like it to be _NET_WM_WINDOW_TYPE_POPUP_MENU in order to do something more generic in i3 & picom configs than matching on its class name.

I know I can xprop -set, but how can/where should I do that having matched its class? Or is this a complete abuse, and I should do it differently?

OJFord
  • 1,838
  • 1
  • 16
  • 26

1 Answers1

0

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
Stéphane Chazelas
  • 522,931
  • 91
  • 1,010
  • 1,501
daru
  • 1
  • 2