Hi,I want to make the JetBrains application sub window be float.I config it by following configuration.
yabai -m rule --add title='.*Welcome*.|Checkout*.|.*Configurations|Choose*.|Import*.|.*Charges|Tip*.|Rename*.' manage=off
Is there any other better way?
Is there any other better way?
If you're running current master, you can do this with the yet unreleased changes to signals:
Try the opposite way: float all windows, then unfloat all windows that are the only window of the application when they are created.
# regex that matches JetBrains apps
apps='^(IntelliJ IDEA|WebStorm|CLion)$'
# float all JetBrains apps
yabai -m rule --add app="${apps}" manage=off
# add a signal that floats a window created by these apps when it's the only window
yabai -m signal --add event=window_created app="${apps}" action='/path/to/some/script'
Now the action would need to be contained in an external, executable file (remember to chmod +x it), and should look something like this:
# check if there is exactly one window belonging to the process of the window that was just created
if yabai -m query --windows \
| jq -er 'map(select(.id == env.YABAI_WINDOW_ID).pid)[0] as $pid | map(select(.pid == $pid)) | length == 1' > /dev/null
then
# unfloat the window
yabai -m window "${YABAI_WINDOW_ID}" --toggle float
fi
The reason the script needs to be in an external file is that the daemon message length is limited, and this script exceeds that length by a bit. That limit will likely be removed in the future, making this a bit easier.
yabai -m rule --add app="PhpStorm" manage=off
yabai -m rule --add app="PhpStorm" title="~/dev/" manage=on
If all your projects stem from one directory like mine you can do something like that.
Is there any other better way?
If you're running current master, you can do this with the yet unreleased changes to signals:
Try the opposite way: float all windows, then unfloat all windows that are the only window of the application when they are created.
# regex that matches JetBrains apps apps='^(IntelliJ IDEA|WebStorm|CLion)$' # float all JetBrains apps yabai -m rule --add app="${apps}" manage=off # add a signal that floats a window created by these apps when it's the only window yabai -m signal --add event=window_created app="${apps}" action='/path/to/some/script'Now the action would need to be contained in an external, executable file (remember to
chmod +xit), and should look something like this:# check if there is exactly one window belonging to the process of the window that was just created if yabai -m query --windows \ | jq -er 'map(select(.id == env.YABAI_WINDOW_ID).pid)[0] as $pid | map(select(.pid == $pid)) | length == 1' > /dev/null then # unfloat the window yabai -m window "${YABAI_WINDOW_ID}" --toggle float fiThe reason the script needs to be in an external file is that the daemon message length is limited, and this script exceeds that length by a bit. That limit will likely be removed in the future, making this a bit easier.
@dominiklohmann 如果你打开多个项目,那么他们的PID是相同的


我觉得我们应该使用Title来判断这个文件是否存在:
~ >>> yabai -m query --windows --window 1443 | jq .title
"rds-console [~/Documents/jingdong/daasfe/rds-console] - .../client/.eslintrc.js"
~ >>> yabai -m query --windows --window 2145 | jq .title
"App.vue [/private/var/folders/3k/vs18p5xd7y145l5vq0m587640000gn/T/App.vue] - ~/Downloads/App.vue"
yabairc (use master branch)
# regex that matches JetBrains apps
JetBrainsApp='^(IntelliJ IDEA|WebStorm|GoLand)$'
yabai -m rule --add app="${JetBrainsApp}" manage=off
yabai -m signal --add event=window_created app="${JetBrainsApp}" action="${XDG_CONFIG_HOME}/yabai/JetBrainsApp.sh"
JetBrainsApp.sh
#!/bin/sh
title=$(yabai -m query --windows --window ${YABAI_WINDOW_ID} | jq .title | cut -d [ -f 2 | cut -d ] -f 1)
title="${title/\~/$HOME}"
if [ "$title" == "." ]; then
absolute=$(pwd)
elif [ "$title" == ".." ]; then
absolute=$(dirname "$(pwd)")
else
absolute=$(cd "$(dirname "$title")"; pwd)/$(basename "$title")
fi
if [ -e $absolute ];then
yabai -m window ${YABAI_WINDOW_ID} --toggle float
fi
@dominiklohmann interestingly I have to restart yabai while the IDE is running before this gets applied to the IDE windows. If I start the IDE after yabai all windows are floating... 🤔
Seems this broke with the latest release. All Jetbrains windows are floating now for me. :(
Any updates on this?
The commented scripts don't work on my machine, except for the OP one.
Can we reopen this issue?
The proposed solutions don't seem to work :/
@cake808 I fresh installed Catalina and experienced the issue also.
I investigated with yabai -m query --windows and saw that the title property was no longer outputting the path within it, which is what my solution hooked onto.
One thing I love about JetBrains is that they have a setting to revert to the original functionality.
Go to PHPStorm > Preferences > Appearance & behavior > Appearance > UI Options > Always show full path in window header. You might not need to do the following but I did it anyway and it started working like before: Restart PHPStorm and Yabai.
Most helpful comment
If you're running current master, you can do this with the yet unreleased changes to signals:
Try the opposite way: float all windows, then unfloat all windows that are the only window of the application when they are created.
Now the action would need to be contained in an external, executable file (remember to
chmod +xit), and should look something like this:The reason the script needs to be in an external file is that the daemon message length is limited, and this script exceeds that length by a bit. That limit will likely be removed in the future, making this a bit easier.