Yabai: manage=off setting not being applied for title= field

Created on 16 Jan 2020  路  5Comments  路  Source: koekeishiya/yabai

I have the following setting in my yabairc:

yabai -m rule --add app="Google Chrome" title="MetaMask Notification" manage=off

However these windows with that title still get tiled.

My app-specific rules work fine, however, like this one:

yabai -m rule --add app="System Preferences" manage=off
question

Most helpful comment

Rules don't get triggered when a window title changes. Use a signal instead with event=window_title_changed.

For a quick and simple hack, this should work just fine:

yabai -m signal --add app='Google Chrome' event='window_title_changed' \
  action="yabai -m rule --add label=$(uuidgen) app='Google Chrome' title='MetaMask Notification' manage=off"'

All 5 comments

Rules don't get triggered when a window title changes. Use a signal instead with event=window_title_changed.

For a quick and simple hack, this should work just fine:

yabai -m signal --add app='Google Chrome' event='window_title_changed' \
  action="yabai -m rule --add label=$(uuidgen) app='Google Chrome' title='MetaMask Notification' manage=off"'

Thanks, that seemed to work!

After your comment, I tried this too, but it didn't work, do you know why?

yabai -m signal --add event=window_created \
  app="Google Chrome" \
  title="MetaMask Notification" \
  action=`yabai -m window \${YABAI_PROCESS_ID} --toggle float`

The PID is not a valid window selector.

Makes sense, however now I am trying to get the window selector, and running into an issue (on 2.1.3).

yabai -m signal --add \
  label=keep-metamask-small \
  event=window_created \
  app="Google Chrome" \
  title="MetaMask Notification" \
  action="
    yabai -m query --windows \
    | jq -r '.[] | select(.pid | tostring == env.YABAI_PROCESS_ID).id' \
    | xargs -I{} yabai -m window {} --toggle float
  "

Look at the docs for the signal events: https://github.com/koekeishiya/yabai/blob/master/doc/yabai.asciidoc#673-event

window_title_changed
Triggered when a window changes its title. Eligible for both app= and title= filter. Passes one argument: $YABAI_WINDOW_ID

The signal doesn't carry the process id of the windows application, but rather the window id of the window whose title changed.

The query itself is already a valid window selector, although you'd still have to check whether the window already is floating before toggling it.

Full snippet (can't test right now):

yabai -m signal --add \
  label=keep-metamask-small \
  event=window_created \
  app='^Google Chrome$' \
  title='^MetaMask Notification$' \
  action='
    yabai -m query --windows --window $YABAI_WINDOW_ID \
    | jq -re ".floating == 0" \
    && yabai -m window $YABAI_WINDOW_ID --toggle float
  '

Note that I've intentionally added ^ and $ to the regular expressions to get exact matches, and you need to either use single quotes for the actions for the env variable to work or use \$YABAI_WINDOW_ID instead, so it doesn't get evaluated outside of the signal itself.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

imjma picture imjma  路  3Comments

brentd picture brentd  路  4Comments

Hum4n01d picture Hum4n01d  路  4Comments

eraserhd picture eraserhd  路  4Comments

ThiagoFacchini picture ThiagoFacchini  路  4Comments