koekeishiya / yabai

A tiling window manager for macOS based on binary space partitioning
MIT License
23.52k stars 647 forks source link

iTerm2 + Yabai: floating hotkey window is not getting ignored by Yabai #1604

Closed BlkPingu closed 1 year ago

BlkPingu commented 1 year ago

Issue description

What could cause the currently focused window to get influenced by Yabai when triggering the iTerm hotkey window and how to prevent this? I want the hotkey window to be entirely ignored. Since it's floating that should apply anyways, but it does not.

Expected behavior: When triggering the hotkey window, all currently by Yabai managed windows should stay the same.

Actual behavior: When triggering the hotkey window, space is claimed by Yabai for an "invisible" window.

Yaban Version: v5.0.2 MacOS Version: 13.1

Video displaying the unexpected behavior

https://user-images.githubusercontent.com/28692167/214208098-e6990c59-cdbe-4aff-a570-ca6a9d6c35e1.mov

iTerm configuration for the hotkey window

Screenshot 2023-01-24 at 04 50 57

.yabairc

# sudo yabai --load-sa
# yabai -m signal --add event=dock_did_restart action="sudo yabai --load-sa"

#!/usr/bin/env sh

# the scripting-addition must be loaded manually if
# you are running yabai on macOS Big Sur. Uncomment
# the following line to have the injection performed
# when the config is executed during startup.
#
# for this to work you must configure sudo such that
# it will be able to run the command without password
#
# see this wiki page for information:
#  - https://github.com/koekeishiya/yabai/wiki/Installing-yabai-(latest-release)
#
# sudo yabai --load-sa
# yabai -m signal --add event=dock_did_restart action="sudo yabai --load-sa"

#!/usr/bin/env sh

# the scripting-addition must be loaded manually if
# you are running yabai on macOS Big Sur. Uncomment
# the following line to have the injection performed
# when the config is executed during startup.
#
# for this to work you must configure sudo such that
# it will be able to run the command without password
#
# see this wiki page for information:
#  - https://github.com/koekeishiya/yabai/wiki/Installing-yabai-(latest-release)
#
# sudo yabai --load-sa
# yabai -m signal --add event=dock_did_restart action="sudo yabai --load-sa"

# float system preferences. Most of these just diable Yabai form resizing them.
yabai -m rule --add app="^1Password 7$" manage=off
yabai -m rule --add app="^Adobe Creative Cloud$" manage=off
yabai -m rule --add app="^Adobe Media Encoder CC 2018$" manage=off
yabai -m rule --add app="^Audio Hijack$" manage=off
yabai -m rule --add app="^BrowserStackLocal$" manage=off
yabai -m rule --add app="^CodeKit$" manage=off
yabai -m rule --add app="^ColorSlurp$" manage=off
yabai -m rule --add app="^CraftManager$" manage=off
yabai -m rule --add app="^Dash$" manage=off
yabai -m rule --add app="^Docker Desktop$" manage=off
yabai -m rule --add app="^Dropbox$" manage=off
yabai -m rule --add app="^GIPHY CAPTURE$" manage=off
yabai -m rule --add app="^GlobalProtect$" manage=off
yabai -m rule --add app="^GoToMeeting$" manage=off
yabai -m rule --add app="^Hidden Bar$" manage=off
yabai -m rule --add app="^ImageOptim$" manage=off
yabai -m rule --add app="^Karabiner-Elements$" manage=off
yabai -m rule --add app="^Karabiner-EventViewer$" manage=off
yabai -m rule --add app="^Kitematic$" manage=off
yabai -m rule --add app="^Loopback$" manage=off
yabai -m rule --add app="^MAMP PRO$" manage=off
yabai -m rule --add app="^Microsoft Remote Desktop$" manage=off
yabai -m rule --add app="^Microsoft Teams$" manage=off
yabai -m rule --add app="^NextDNS$" manage=off
yabai -m rule --add app="^Postman$" manage=off
yabai -m rule --add app="^Sequel Pro$" manage=off
yabai -m rule --add app="^The Unarchiver$" manage=off
# yabai -m rule --add app="^Tower$" manage=off
# yabai -m rule --add app="^Transmit$" manage=off
yabai -m rule --add app="^TunnelBear$" manage=off
yabai -m rule --add app="^VMware Fusion$" manage=off
yabai -m rule --add app="^Logitech G HUB$" manage=off
yabai -m rule --add app="^p4merge$" manage=off
# yabai -m rule --add app="^zoom.us$" manage=off
# yabai -m rule --add app="^Finder$" manage=off
yabai -m rule --add app="^Disk Utility$" manage=off
yabai -m rule --add app="^Activity Monitor$" manage=off
yabai -m rule --add app="^Path Finder$" manage=off
yabai -m rule --add app="^TeamViewer$" manage=off
yabai -m rule --add app="^Private Internet Access$" manage=off
#yabai -m rule --add app="^Discord$" manage=off
#yabai -m rule --add app="^Calendar$" manage=off
yabai -m rule --add app="^Calculator$" manage=off
#yabai -m rule --add app="^Podcasts$" manage=off
#yabai -m rule --add app="^Music$" manage=off
yabai -m rule --add app="^mastonaut$" title="^Opening .*$" manage=off layer=above
yabai -m rule --add app="^libreoffice$"  manage=on layer=above
yabai -m rule --add app="^Visual Studio Code$" manage=on

# float system preferences
yabai -m rule --add app="^System Information$" manage=off
yabai -m rule --add app="^System Preferences$" manage=off
yabai -m rule --add title='Preferences$' manage=off
yabai -m rule --add title='^Archive Utility$' manage=off
yabai -m rule --add title='Settings$' manage=off
yabai -m rule --add app="iTerm2" manage=on
yabai -m rule --add app="^Element$" manage=on

# global settings
yabai -m config mouse_follows_focus          off

# focus_follows_mouse: off, autoraise, autofocus
yabai -m config focus_follows_mouse          off
yabai -m config window_placement             second_child
yabai -m config window_topmost               off
yabai -m config window_shadow                on
yabai -m config window_opacity               off
yabai -m config window_opacity_duration      0.0
yabai -m config active_window_opacity        1.0
yabai -m config normal_window_opacity        0.90
yabai -m config window_border                off
yabai -m config window_border_width          6
yabai -m config active_window_border_color   0xff775759
yabai -m config normal_window_border_color   0xff555555
yabai -m config insert_feedback_color        0xffd75f5f
yabai -m config split_ratio                  .447
yabai -m config auto_balance                 off
yabai -m config mouse_modifier               fn
yabai -m config mouse_action1                move
yabai -m config mouse_action2                resize
yabai -m config mouse_drop_action            swap

# general space settings
yabai -m config layout                       bsp
yabai -m config top_padding                  0
yabai -m config bottom_padding               0
yabai -m config left_padding                 0
yabai -m config right_padding                0
yabai -m config window_gap                   0

# yabai -m config --space 5 right_padding 30

yabai -m config --space $(yabai -m query --displays | jq 'map(select(.index==2)) | .[0].spaces[0]') left_padding 0
yabai -m config --space $(yabai -m query --displays | jq 'map(select(.index==2)) | .[0].spaces[0]') right_padding 0
yabai -m config --space $(yabai -m query --displays | jq 'map(select(.index==2)) | .[0].spaces[1]') left_padding 0
yabai -m config --space $(yabai -m query --displays | jq 'map(select(.index==2)) | .[0].spaces[1]') right_padding 0

# killall limelight &> /dev/null
# limelight &> /dev/null &

yabai -m signal --add event=application_activated action="zsh ~/.config/yabai/application-activated.zsh"
yabai -m signal --add event=window_created action="zsh ~/.config/yabai/window-created.zsh"

# Signals
# yabai -m signal --add event=window_created action='yabai -m query --windows --window $YABAI_WINDOW_ID | jq -er ".\"can-resize\" or .\"is-floating\"" || yabai -m window $YABAI_WINDOW_ID --toggle float'

echo "yabai configuration loaded.."
koekeishiya commented 1 year ago

Remove yabai -m rule --add app="iTerm2" manage=on from your config.

BlkPingu commented 1 year ago

Doesn't this affect all windows? I want iTerm to be managed, just not the floating hotkey window.

koekeishiya commented 1 year ago

yabai will automatically manage all applications/windows given that the layout is set to bsp/stack. The rule is specifically to target applications/windows that misbehave. This usually applies to cross-platform software where macOS is not the primar target.

manage=<BOOL_SEL>
Window should be managed (tile vs float).
Most windows will be managed automatically, so this should mainly be used to make a window float.

I no longer use iTerm, but last time I did it was detected without having to register any rules to make it work. The rule you use will make yabai force the tiling algorithm to apply to all ui-elements created by iTerm that is classified as a window by the OS, regardless of other properties.

BlkPingu commented 1 year ago

holy shit that worked. Thanks you so much!

wdanilo commented 1 year ago

This issue seems resolved, so it should be closed @BlkPingu :)

AlJohri commented 1 year ago

I'm running into this same issue with the iTerm2 visor hotkey window.

https://github.com/koekeishiya/yabai/assets/2790092/a3b1e164-18eb-42b8-94f8-b95d31ff600e

My yabairc file is the same as the default installation as you can see at the end of the video so I don't have manage=on set.

Any ideas what might be going on?

dantaeyoung commented 11 months ago

@AlJohri I have no idea why, but adding yabai -m rule --add app="iTerm2" manage=off to yabairc, then restarting yabai (by killall yabai), then removing the above line, then restarting yabai fixed it. Strange.