koekeishiya / yabai

A tiling window manager for macOS based on binary space partitioning

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to make windows from Litter Arc float

patrick91 opened this issue · comments

This might more be an issue with Arc, but I wonder if there's any working workaround.

The issue comes from the Little Arc feature, it basically allows to open links in a "temporary" floating window. Unfortunately when using yabai the window is not floating, and I haven't found a way to tell yabai to not manage those windows, here's what I get from querying the windows:

  1. Little arc:
{
	"id":11848,
	"pid":1220,
	"app":"Arc",
	"title":"[yabai] Now my Mac looks hecking cool but I am still very unproductive : unixporn",
	"scratchpad":"",
	"frame":{
		"x":756.0000,
		"y":510.0000,
		"w":756.0000,
		"h":472.0000
	},
	"role":"AXWindow",
	"subrole":"AXStandardWindow",
	"root-window":true,
	"display":1,
	"space":2,
	"level":0,
	"sub-level":-20,
	"layer":"normal",
	"sub-layer":"below",
	"opacity":0.9800,
	"split-type":"horizontal",
	"split-child":"second_child",
	"stack-index":0,
	"can-move":true,
	"can-resize":true,
	"has-focus":false,
	"has-shadow":true,
	"has-parent-zoom":false,
	"has-fullscreen-zoom":false,
	"has-ax-reference":true,
	"is-native-fullscreen":false,
	"is-visible":true,
	"is-minimized":false,
	"is-hidden":false,
	"is-floating":false,
	"is-sticky":false,
	"is-grabbed":false
}

Standard window

{
	"id":11819,
	"pid":1220,
	"app":"Arc",
	"title":"yabai is cool",
	"scratchpad":"",
	"frame":{
		"x":756.0000,
		"y":38.0000,
		"w":756.0000,
		"h":472.0000
	},
	"role":"AXWindow",
	"subrole":"AXStandardWindow",
	"root-window":true,
	"display":1,
	"space":2,
	"level":0,
	"sub-level":-20,
	"layer":"normal",
	"sub-layer":"below",
	"opacity":0.9800,
	"split-type":"horizontal",
	"split-child":"first_child",
	"stack-index":0,
	"can-move":true,
	"can-resize":true,
	"has-focus":false,
	"has-shadow":true,
	"has-parent-zoom":false,
	"has-fullscreen-zoom":false,
	"has-ax-reference":true,
	"is-native-fullscreen":false,
	"is-visible":true,
	"is-minimized":false,
	"is-hidden":false,
	"is-floating":false,
	"is-sticky":false,
	"is-grabbed":false
}

as you can see the windows appear to be the same, so not sure if we can target either 🤔

I've tried workarounds described in #1622 but none of them work

I'm also in the same situation.

I commented on #1622 before, but my setup has changed a bit because of updates with how Yabai was handling layers and sub-layers. I have it all working perfectly on my side, but this is definitely not for the faint of heart. You do not have to follow everything I do, but if you can understand the behavior of Little Arc (and the reason behind my rules or signals) then you can probably come up with something that works for you.

720.mp4

Options

Three ways to open Little Arc:

  1. Links outside of Arc
  2. Triggering Little Arc alone with default Shortcut (in my case is CMD + CTRL + OPT + N)
  3. Within Arc, while pressing down modifiers (set in Arc Settings)

With Yabai we can Float or Tile new windows… so those 3 actions give us 6 possible results.

For my setup I use:

  • OpenIn (for option 1).
  • Karabiner (for option 2). I use Karabiner to control Yabai, but the same should be possible with skhd.
  • Keyboard Maestro (for option 3).

Some links all the way to the bottom.

Yabairc Setup

I like all my apps to open in a normal sub-layer, so I have this rule… which is important for my entire Little Arc Setup.

yabai -m rule --add app=".*" sub-layer=normal

Specific to Arc I have:

yabai -m rule --add app="^Arc$" title="^Space [0-9]+$|ybf$" manage=off
  • Every time I trigger a Little Arc window with the default shortcut (option 2 above) a small window (bar, actually) is created with title “Space…” + number.
  • Every time I want to open a link from outside of Arc (option 1 above), I will add #ybf at the end with OpenIn. This Yabairc rule catches both of these cases.

As I mention, Little Arc windows triggered by the default shortcut will start with Space… in their title or if a link is clicked externally the window will have the URL (which can have an identifier I added with OpenIn). But then… once they open a website, the title of the window will change to the title of the website. By knowing this you could create a signal activated by name change, but my process is simpler. By default all my Arc windows are managed, so I only need to identify the ones I want to float. With this Yabairc rule alone you should be able to open Little Arc windows using Option 2 mentioned above and float them.

For option 1:

In my case, all links outside of Arc are handled by OpenIn. In OpenIn I have added Arc twice, as if it were two separate browsers, but one is for a Floating Little Arc, and the other one is for a Tiled Little Arc. In the Floating one I do a regex replacement of expression https://(.*) which is replaced by https://$1#ybf and for the tiled Little Arc I don't change anything.

In OpenIn you can setup rules, so you can click links by holding SHIFT and they will open as Float or CMD and they will open as tiled, for example. The window title will change half a second later but by then, if you insert the #ybf it has already been identified by the rule we set up in Yabairc.

For option 2:

If you don't care about ever having any Little Arc tiled, then you don't need to follow this step. I use Karabiner to control Yabai, so you will most likely need to modify this for your own setup.

I have this assigned to a Keyboard shortcut for when I want my Little Arc floating. In this case not only do I want these floating but also centered.

[:right_shift [[:yabai "signal --add label=littlearccmd event=window_title_changed action=\"~/Dropbox/2-Areas/SystemAndApps/Yabai/LittleArcCMD.sh floatcenter\""] :!TOCn]]

If you want ALL your floating Little Arcs centered, you can simply modify the Yabairc rule, or add a signal to your Yabairc and run the script that way.

When I want to create a tiled Little Arc I have:

[:!Cright_shift [[:yabai -m signal --add label=littlearccmd event=window_title_changed action=\"~/Dropbox/2-Areas/SystemAndApps/Yabai/LittleArcCMD.sh tile\""] :!TOCn]]

In my setup a script will be run when the window name change I mentioned above happens. If it's a floating window, the script will just center it. If it's supposed to be tiled, and since Little Arc windows (starting with Space... will be floating by default), the script will toggle the float making it tiled.

For option 3:

I disabled the keyboard shortcut in Arc and I did two Keyboard maestro macros that trigger the right mouse click menu, copies the url, and then opens the URL from my clipboard in Arc with either ybf or as normal depending on whether I want the window floating or tiled. No longer do I need OpenIn for this step. I do suggest you do disable the default keyboard shortcut in Arc and do it like this because windows opened with the default keyboard shortcut do not go through the same window title rename by Arc… making it virtually impossible to identify.

Conclusion

This is much more complicated than it should be, but until Arc decides to do things differently I don’t think we have many more options.

Links

My Yabairc File
LittleArcCMD.sh
Keyboard Maestro Macros for links within Arc