Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to make JetBrains products sub-window float? #194

Closed
kuhnpeng opened this issue Aug 6, 2019 · 28 comments
Closed

How to make JetBrains products sub-window float? #194

kuhnpeng opened this issue Aug 6, 2019 · 28 comments
Labels
help wanted Community help appreciated question Request for information or help, not an issue

Comments

@kuhnpeng
Copy link

kuhnpeng commented Aug 6, 2019

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?

@dominiklohmann
Copy link
Collaborator

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.

@kerryj89
Copy link

kerryj89 commented Aug 7, 2019

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.

@imshenshen
Copy link

imshenshen commented Aug 28, 2019

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.

@dominiklohmann 如果你打开多个项目,那么他们的PID是相同的
image
屏幕快照 2019-08-28 上午11 42 16

我觉得我们应该使用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

@koekeishiya koekeishiya added help wanted Community help appreciated question Request for information or help, not an issue labels Sep 3, 2019
@ubuntudroid
Copy link

@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... 🤔

@ubuntudroid
Copy link

Seems this broke with the latest release. All Jetbrains windows are floating now for me. :(

@kevincali
Copy link

Any updates on this?
The commented scripts don't work on my machine, except for the OP one.

@kevincali
Copy link

Can we reopen this issue?
The proposed solutions don't seem to work :/

@kerryj89
Copy link

@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.

@shepherdjerred
Copy link

I was able to achieve it with this for IntelliJ:

yabai -m rule --add app="IntelliJ IDEA" manage=off
yabai -m rule --add app="IntelliJ IDEA" title=".*\[(.*)\].*" manage=on

And, as @kerryj89 said:

Go to IntelliJ IDEA > Preferences > Appearance & behavior > Appearance > UI Options > Always show full path in window header

@ubuntudroid
Copy link

ubuntudroid commented Jun 22, 2021

@shepherdjerred I've slightly modified your rules to match gradle files in Android Studio (their title doesn't seem to be affected by the "Always show full path in window header"):

yabai -m rule --add app="^Android Studio" manage=off
yabai -m rule --add app="^Android Studio" title="(.*\[(.*)\].*)|(.*\(\:.*\).*)" manage=on

@carlosflorencio
Copy link

I just want to add that is useful to have the config window_topmost off to prevent having some IDE action popups being inacessible.

yabai -m config window_topmost off Brings these type of popups to the front of the application:

image

@shepherdjerred
Copy link

@ubuntudroid I think your rules work even better than mine. Thanks for contributing!

@carlosuno
Copy link

@shepherdjerred I've slightly modified your rules to match gradle files in Android Studio (their title doesn't seem to be affected by the "Always show full path in window header"):

yabai -m rule --add app="^Android Studio" manage=off
yabai -m rule --add app="^Android Studio" title="(.*\[(.*)\].*)|(.*\(\:.*\).*)" manage=on

Thank you @ubuntudroid for your solution.
You can also do it on one line by reversing the search on the title [!]
yabai -m rule --add app="^Android Studio" title!="(.*\[(.*)\].*)|(.*\(\:.*\).*)" manage=off

@ubuntudroid
Copy link

@carlosuno Neat, didn't know about that reverse operator! Many thanks! 🙏

@kodokoto
Copy link

kodokoto commented Aug 15, 2021

I am trying to do the same for Ableton and 3rd party plugins, unfortunately Ableton does not have an option to show the full path in the title, therefore the latest solution does not work.

I did find that there is an option for Ableton called -ShowFullVersionInTitle from this list however i cant seem to find a way to get it working. Therefore the title for the main window is always the name of the project or Untitled.

Here is an example of what I get when I use yabai -m query --windows:

{
	"id":981,
	"pid":13984,
	"app":"Live",
	"title":"Untitled",
	"frame":{
		"x":20.0000,
		"y":20.0000,
		"w":1890.0000,
		"h":1560.0000
	},
	"level":0,
	"role":"AXUnknown",
	"subrole":"AXStandardWindow",
	"movable":1,
	"resizable":1,
	"display":1,
	"space":2,
	"visible":0,
	"focused":0,
	"split":"vertical",
	"floating":0,
	"sticky":0,
	"minimized":0,
	"topmost":0,
	"opacity":1.0000,
	"shadow":1,
	"border":0,
	"stack-index":0,
	"zoom-parent":0,
	"zoom-fullscreen":0,
	"native-fullscreen":0
},{
	"id":1010,
	"pid":13984,
	"app":"Live",
	"title":"FF Pro-L 2/Master",
	"frame":{
		"x":1930.0000,
		"y":20.0000,
		"w":950.0000,
		"h":589.0000
	},
	"level":3,
	"role":"AXWindow",
	"subrole":"AXFloatingWindow",
	"movable":1,
	"resizable":0,
	"display":1,
	"space":2,
	"visible":0,
	"focused":0,
	"split":"vertical",
	"floating":0,
	"sticky":0,
	"minimized":0,
	"topmost":1,
	"opacity":1.0000,
	"shadow":1,
	"border":0,
	"stack-index":0,
	"zoom-parent":0,
	"zoom-fullscreen":0,
	"native-fullscreen":0
}

Unfortunately I cant seem to do something like yabai -m rule --add app="^Live$" role="AXUnknown" manage=on.

I also tried the initial solution used in this thread but that does not seem to work anymore.

Please let me know if this is the wrong place to be asking for help.

@hld0
Copy link

hld0 commented Oct 14, 2021

Unfortunately yabai doesn't manage my IntelliJ after using the solution provided by @carlosuno - does anyone have a configuration specifically for IntelliJ IDEA?

@Frankcs96
Copy link

my intellij is also not managed by yabai, only if I restart with the IDE open :(

@tshu-w
Copy link

tshu-w commented Dec 23, 2021

@Frankcs96 Maybe the reason is like stated here

@iantanwx
Copy link

iantanwx commented Apr 9, 2022

Unfortunately yabai doesn't manage my IntelliJ after using the solution provided by @carlosuno - does anyone have a configuration specifically for IntelliJ IDEA?

Works for me:

yabai -m rule --add app="^IntelliJ IDEA$" manage=off
yabai -m rule --add app="^IntelliJ IDEA$" title="( – )" space=7 manage=on

@kuhnpeng
Copy link
Author

Unfortunately yabai doesn't manage my IntelliJ after using the solution provided by @carlosuno - does anyone have a configuration specifically for IntelliJ IDEA?

Works for me:

yabai -m rule --add app="^IntelliJ IDEA$" manage=off
yabai -m rule --add app="^IntelliJ IDEA$" title="( – )" space=7 manage=on

Great!It's working again,🤪。

yabai -m rule --add app="^IntelliJ IDEA-EAP$" manage=off
yabai -m rule --add app="^IntelliJ IDEA-EAP$" title="( – )"  manage=on

@proskehy
Copy link

proskehy commented Nov 24, 2022

my intellij is also not managed by yabai, only if I restart with the IDE open :(

I'm still experiencing this issue.
Neither this:

yabai -m rule --add app="^IntelliJ IDEA$" manage=off
yabai -m rule --add app="^IntelliJ IDEA$" title="( – )" manage=on

nor this

yabai -m rule --add app="IntelliJ IDEA" manage=off
yabai -m rule --add app="IntelliJ IDEA" title=".*\[(.*)\].*" manage=on

or this

yabai -m rule --add app="^IntelliJ IDEA$" title!=".*\[(.*)\].*" manage=off

seems to work.

Am I doing something wrong or is the mentioned issue still present?

a-peyrard added a commit to a-peyrard/dotfiles that referenced this issue Dec 23, 2022
a-peyrard added a commit to a-peyrard/dotfiles that referenced this issue Dec 24, 2022
@persiyanov
Copy link

my intellij is also not managed by yabai, only if I restart with the IDE open :(

I'm still experiencing this issue. Neither this:

yabai -m rule --add app="^IntelliJ IDEA$" manage=off
yabai -m rule --add app="^IntelliJ IDEA$" title="( – )" manage=on

nor this

yabai -m rule --add app="IntelliJ IDEA" manage=off
yabai -m rule --add app="IntelliJ IDEA" title=".*\[(.*)\].*" manage=on

or this

yabai -m rule --add app="^IntelliJ IDEA$" title!=".*\[(.*)\].*" manage=off

seems to work.

Am I doing something wrong or is the mentioned issue still present?

Same. By applying these changes (I'm using app="PyCharm"), all IDE windows become floating. PyCharm 2022.3.1, yabai-v5.0.2, macos Monterey 12.6.3.

@Kurounin
Copy link

my intellij is also not managed by yabai, only if I restart with the IDE open :(

I'm still experiencing this issue. Neither this:

yabai -m rule --add app="^IntelliJ IDEA$" manage=off
yabai -m rule --add app="^IntelliJ IDEA$" title="( – )" manage=on

nor this

yabai -m rule --add app="IntelliJ IDEA" manage=off
yabai -m rule --add app="IntelliJ IDEA" title=".*\[(.*)\].*" manage=on

or this

yabai -m rule --add app="^IntelliJ IDEA$" title!=".*\[(.*)\].*" manage=off

seems to work.
Am I doing something wrong or is the mentioned issue still present?

Same. By applying these changes (I'm using app="PyCharm"), all IDE windows become floating. PyCharm 2022.3.1, yabai-v5.0.2, macos Monterey 12.6.3.

I'm using the following config and it works on MacOS Ventura 13.2.1 and yabai-v5.0.2:

# make JetBrains products popup windows float
apps='^(IntelliJ IDEA|WebStorm|GoLand|PyCharm)$'
yabai -m rule --add app="JetBrains Toolbox" manage=off
yabai -m rule --add app="${apps}" manage=off
yabai -m rule --add app="${apps}" title="( – )" manage=on

@ubuntudroid
Copy link

The following skhd shortcut might help as a workaround:

# float / unfloat window and center on screen
shift + alt - t : yabai -m window --toggle float;\
          yabai -m window --grid 4:4:1:1:2:2

Essentially, whenever there is a window that behaves oddly (e.g., float even if it shouldn't), select that window and invoke that shortcut once to toggle floating for it. Works like a charm for me every time.

The center part (second line) of the command is optional. Feel free to remove it if you don't need it.

Disclosure: I don't remember whether this command was part of skhd's default configuration, or if I copied it somewhere else. One thing I'm sure is, that it's certainly not mine. 😅

@Apolsus
Copy link

Apolsus commented Mar 31, 2023

@Kurounin
Your code works well.

# make JetBrains products popup windows float
apps='^(IntelliJ IDEA|WebStorm|GoLand|PyCharm)$'
yabai -m rule --add app="JetBrains Toolbox" manage=off
yabai -m rule --add app="${apps}" manage=off
yabai -m rule --add app="${apps}" title="( – )" manage=on

However, when the project was first opened, this seemed not work.

CleanShot 2023-04-01 at 05 20 25

@Apolsus
Copy link

Apolsus commented Apr 1, 2023

I have solved this in #1687 (comment)

@gldtn
Copy link

gldtn commented Feb 2, 2024

Unfortunately yabai doesn't manage my IntelliJ after using the solution provided by @carlosuno - does anyone have a configuration specifically for IntelliJ IDEA?

Works for me:

yabai -m rule --add app="^IntelliJ IDEA$" manage=off
yabai -m rule --add app="^IntelliJ IDEA$" title="( – )" space=7 manage=on

This works for me in PhpStorm, my only issue now is with the popups are being very annoying where Yabai thinks it's a new window for every small popup that appears in the IDE.

phpstorm-yabai

Has anyone else encountered this? Any idea on how I can try to manipulate these popups from being detected as a new window?

Thanks!

@florentsorel
Copy link

florentsorel commented Feb 6, 2024

@gldtn I have the same issue. I use this for border.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Community help appreciated question Request for information or help, not an issue
Projects
None yet
Development

No branches or pull requests