yabai: [Help Please] Cannot Open kitty Window on the Focused Display
yabai version: 2.3.0 macOS version: 10.15.3
I am using two external monitors. Then I open the first kitty window on monior-1 and say Safari on monitor-2. Then I make the mouse focus on safari (i.e., monitor-2). Then I hit cmd-enter to open another kitty window (in skhdrc, I set cmd - return : /Applications/kitty.app/Contents/MacOS/kitty --single-instance -d ~ to open a kitty widow). What I expected is to open this window on monitor-2 next to the Safari window. However, it is open on monitor-1, even though the focus is not there.
How can I open a kitty window on a monitor where the focus is on, instead of the monitor where the first kitty window is created?
Thank you very much!
About this issue
- Original URL
 - State: closed
 - Created 4 years ago
 - Comments: 25 (2 by maintainers)
 
Thanks, @yanzhang0219 🙂 I updated my own script to use yabai signals which seems to work well. A few things to note about the newly launched kitty window:
Configuring
If the new kitty window is opened from an existing kitty window, my script will open the new window in the same working directory as the existing kitty window, much like what I’m used to with i3/urxvt on Linux.
Placing
Rather than moving the new window over to the focused display, I opted to:
That way, it’ll always split the previously focused window, instead of landing in a random location on the focused display.
Focusing
Regarding your comment above:
That’s because you need to escape the yabai window ID variable within the signal command—i.e.,
\$YABAI_WINDOW_IDrather than$YABAI_WINDOW_ID—so that the variable’s name is resolved when the signal command executes, rather than when the script executes. If the variable name is resolved when the script executes, no value has been assigned to$YABAI_WINDOW_IDyet which simply causes the focus command to fail.Try
yabai -m config window_origin_display focusedoryabai -m config window_origin_display cursor@noperator try to use the script below:
Thank you.
Did you consider Kitty’s instance groups?
Then you can use an instance group per display:
If Kitty Is focusing its most recently focused window before creating a new one, there’s nothing you can directly do about that.
What you can do instead, is save the index of the space you’re on before running the command to open a new Kitty window, and then move the focused window to the space you were on originally right after.
For debugging, try taking a look at the log files that yabai creates when ran in verbose mode, and look at the events that happen when you open a new Kitty instance.
Alternatively, you could also have
openforce a new application instance, but that may have unexpected side effects, as most apps are not built with this option in mind. To do so, runopen -n -a Kitty --args --single-instance -d ~, for more info onopen -nseeman 1 open. I wouldn’t recommend doing this unless you have exhausted all other options.