koekeishiya / yabai

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

When moving an unmanaged/floating window to next display, it disappears #2341

Open alber70g opened 4 months ago

alber70g commented 4 months ago

I'm using skhd with yabai. Among other things, I use it to move windows across screens and spaces

Since a few weeks now, whenever I move a screen from one display to the other it's gone.

I've tried to record a video, but that's hard across screens, so I'll try to describe it.

  1. open a new window (let's say iTerm2)
  2. hit shortcut for ctrl+shift+up yabai -m window --display next; yabai -m display --focus next
  3. window disappears
  4. without moving mouse (to prevent loss of focus) hit shortcut alt+t for yabai -m window --toggle float --sub-layer below
  5. window reappears

So it appears that "floating" windows aren't moved properly. When they're managed, they will behave as expected.

Logs of what happens in the video when starting yabai with `SHELL=/bin/sh yabai --verbose` ```log EVENT_HANDLER_WINDOW_MINIMIZED: KeyCastr 55778 EVENT_HANDLER_APPLICATION_FRONT_SWITCHED: iTerm2 (732) EVENT_HANDLER_MOUSE_DOWN: 1669.76, 713.52 EVENT_HANDLER_MOUSE_UP: 1669.76, 713.52 EVENT_HANDLER_DAEMON_MESSAGE: window --display next EVENT_HANDLER_APPLICATION_FRONT_SWITCHED: Finder (749) EVENT_HANDLER_DAEMON_MESSAGE: display --focus next EVENT_HANDLER_APPLICATION_FRONT_SWITCHED: iTerm2 (732) EVENT_HANDLER_DISPLAY_CHANGED: 1 318 space_manager_refresh_application_windows: Google Chrome has windows that are not yet resolved space_manager_refresh_application_windows: Telegram has windows that are not yet resolved space_manager_refresh_application_windows: Slack has windows that are not yet resolved EVENT_HANDLER_DAEMON_MESSAGE: query --windows EVENT_HANDLER_DAEMON_MESSAGE: query --displays EVENT_HANDLER_DAEMON_MESSAGE: query --displays EVENT_HANDLER_DAEMON_MESSAGE: query --windows EVENT_HANDLER_DAEMON_MESSAGE: window --toggle float --sub-layer below EVENT_HANDLER_WINDOW_TITLE_CHANGED: iTerm2 55691 EVENT_HANDLER_WINDOW_RESIZED: iTerm2 55691 EVENT_HANDLER_WINDOW_MOVED:DEBOUNCED iTerm2 55691 EVENT_HANDLER_DISPLAY_CHANGED: newly activated display 1 was already active (1)! ignoring event.. EVENT_HANDLER_DISPLAY_CHANGED: newly activated display 1 was already active (1)! ignoring event.. EVENT_HANDLER_WINDOW_RESIZED:DEBOUNCED iTerm2 55691 EVENT_HANDLER_WINDOW_TITLE_CHANGED: iTerm2 55691 EVENT_HANDLER_DAEMON_MESSAGE: window --grid 12:10:2:2:6:8 EVENT_HANDLER_WINDOW_TITLE_CHANGED: iTerm2 55691 EVENT_HANDLER_DAEMON_MESSAGE: query --windows EVENT_HANDLER_DAEMON_MESSAGE: query --displays EVENT_HANDLER_DAEMON_MESSAGE: query --displays EVENT_HANDLER_DAEMON_MESSAGE: query --windows EVENT_HANDLER_DAEMON_MESSAGE: window --toggle float --sub-layer below EVENT_HANDLER_DAEMON_MESSAGE: window --grid 12:10:2:2:6:8 EVENT_HANDLER_WINDOW_TITLE_CHANGED: iTerm2 55691 EVENT_HANDLER_WINDOW_RESIZED: iTerm2 55691 EVENT_HANDLER_WINDOW_MOVED:DEBOUNCED iTerm2 55691 EVENT_HANDLER_WINDOW_TITLE_CHANGED: iTerm2 55691 EVENT_HANDLER_DAEMON_MESSAGE: query --displays EVENT_HANDLER_DAEMON_MESSAGE: query --windows EVENT_HANDLER_DAEMON_MESSAGE: query --displays EVENT_HANDLER_DAEMON_MESSAGE: query --windows EVENT_HANDLER_DAEMON_MESSAGE: window --toggle float --sub-layer below EVENT_HANDLER_WINDOW_TITLE_CHANGED: iTerm2 55691 EVENT_HANDLER_WINDOW_RESIZED: iTerm2 55691 EVENT_HANDLER_DAEMON_MESSAGE: window --grid 12:10:2:2:6:8 EVENT_HANDLER_WINDOW_MOVED:DEBOUNCED iTerm2 55691 EVENT_HANDLER_WINDOW_RESIZED:DEBOUNCED iTerm2 55691 EVENT_HANDLER_WINDOW_TITLE_CHANGED: iTerm2 55691 EVENT_HANDLER_DAEMON_MESSAGE: window --display prev EVENT_HANDLER_APPLICATION_FRONT_SWITCHED: Finder (749) EVENT_HANDLER_WINDOW_TITLE_CHANGED: iTerm2 55691 EVENT_HANDLER_WINDOW_RESIZED: iTerm2 55691 EVENT_HANDLER_DAEMON_MESSAGE: display --focus prev EVENT_HANDLER_WINDOW_MOVED:DEBOUNCED iTerm2 55691 EVENT_HANDLER_WINDOW_RESIZED:DEBOUNCED iTerm2 55691 EVENT_HANDLER_WINDOW_TITLE_CHANGED: iTerm2 55691 EVENT_HANDLER_APPLICATION_FRONT_SWITCHED: iTerm2 (732) EVENT_HANDLER_DISPLAY_CHANGED: 3 192 space_manager_refresh_application_windows: Google Chrome has windows that are not yet resolved space_manager_refresh_application_windows: Telegram has windows that are not yet resolved space_manager_refresh_application_windows: Slack has windows that are not yet resolved EVENT_HANDLER_WINDOW_TITLE_CHANGED: iTerm2 55691 EVENT_HANDLER_DAEMON_MESSAGE: window --display next EVENT_HANDLER_APPLICATION_FRONT_SWITCHED: Finder (749) EVENT_HANDLER_WINDOW_TITLE_CHANGED: iTerm2 55691 EVENT_HANDLER_WINDOW_RESIZED: iTerm2 55691 EVENT_HANDLER_WINDOW_RESIZED: iTerm2 55691 EVENT_HANDLER_WINDOW_RESIZED:DEBOUNCED iTerm2 55691 EVENT_HANDLER_DAEMON_MESSAGE: display --focus next EVENT_HANDLER_WINDOW_TITLE_CHANGED: iTerm2 55691 EVENT_HANDLER_WINDOW_MOVED:DEBOUNCED iTerm2 55691 EVENT_HANDLER_APPLICATION_FRONT_SWITCHED: iTerm2 (732) EVENT_HANDLER_DISPLAY_CHANGED: 1 318 space_manager_refresh_application_windows: Google Chrome has windows that are not yet resolved space_manager_refresh_application_windows: Telegram has windows that are not yet resolved space_manager_refresh_application_windows: Slack has windows that are not yet resolved EVENT_HANDLER_WINDOW_TITLE_CHANGED: iTerm2 55691 EVENT_HANDLER_DAEMON_MESSAGE: window --display prev EVENT_HANDLER_APPLICATION_FRONT_SWITCHED: Finder (749) EVENT_HANDLER_WINDOW_TITLE_CHANGED: iTerm2 55691 EVENT_HANDLER_WINDOW_RESIZED: iTerm2 55691 EVENT_HANDLER_WINDOW_MOVED:DEBOUNCED iTerm2 55691 EVENT_HANDLER_WINDOW_RESIZED:DEBOUNCED iTerm2 55691 EVENT_HANDLER_DAEMON_MESSAGE: display --focus prev EVENT_HANDLER_APPLICATION_FRONT_SWITCHED: iTerm2 (732) EVENT_HANDLER_WINDOW_TITLE_CHANGED: iTerm2 55691 EVENT_HANDLER_DISPLAY_CHANGED: 3 192 space_manager_refresh_application_windows: Google Chrome has windows that are not yet resolved space_manager_refresh_application_windows: Telegram has windows that are not yet resolved space_manager_refresh_application_windows: Slack has windows that are not yet resolved EVENT_HANDLER_DAEMON_MESSAGE: query --windows EVENT_HANDLER_DAEMON_MESSAGE: query --displays EVENT_HANDLER_DAEMON_MESSAGE: query --displays EVENT_HANDLER_DAEMON_MESSAGE: query --windows EVENT_HANDLER_DAEMON_MESSAGE: window --toggle float --sub-layer below EVENT_HANDLER_DAEMON_MESSAGE: window --grid 12:12:3:2:6:10 EVENT_HANDLER_WINDOW_TITLE_CHANGED: iTerm2 55691 EVENT_HANDLER_WINDOW_RESIZED: iTerm2 55691 EVENT_HANDLER_WINDOW_MOVED:DEBOUNCED iTerm2 55691 EVENT_HANDLER_WINDOW_TITLE_CHANGED: iTerm2 55691 EVENT_HANDLER_DAEMON_MESSAGE: window --display next EVENT_HANDLER_APPLICATION_FRONT_SWITCHED: Finder (749) EVENT_HANDLER_DAEMON_MESSAGE: display --focus next EVENT_HANDLER_APPLICATION_FRONT_SWITCHED: iTerm2 (732) EVENT_HANDLER_DISPLAY_CHANGED: 1 318 space_manager_refresh_application_windows: Google Chrome has windows that are not yet resolved space_manager_refresh_application_windows: Telegram has windows that are not yet resolved space_manager_refresh_application_windows: Slack has windows that are not yet resolved EVENT_HANDLER_DAEMON_MESSAGE: query --displays EVENT_HANDLER_DAEMON_MESSAGE: query --windows EVENT_HANDLER_DAEMON_MESSAGE: query --displays EVENT_HANDLER_DAEMON_MESSAGE: query --windows EVENT_HANDLER_DAEMON_MESSAGE: window --toggle float --sub-layer below EVENT_HANDLER_WINDOW_TITLE_CHANGED: iTerm2 55691 EVENT_HANDLER_WINDOW_RESIZED: iTerm2 55691 EVENT_HANDLER_DAEMON_MESSAGE: window --grid 12:10:2:2:6:8 EVENT_HANDLER_WINDOW_MOVED:DEBOUNCED iTerm2 55691 EVENT_HANDLER_DISPLAY_CHANGED: newly activated display 1 was already active (1)! ignoring event.. EVENT_HANDLER_WINDOW_RESIZED:DEBOUNCED iTerm2 55691 EVENT_HANDLER_DISPLAY_CHANGED: newly activated display 1 was already active (1)! ignoring event.. EVENT_HANDLER_WINDOW_TITLE_CHANGED: iTerm2 55691 EVENT_HANDLER_WINDOW_TITLE_CHANGED: iTerm2 55691 EVENT_HANDLER_DAEMON_MESSAGE: query --displays EVENT_HANDLER_DAEMON_MESSAGE: query --windows EVENT_HANDLER_DAEMON_MESSAGE: query --windows EVENT_HANDLER_DAEMON_MESSAGE: query --displays EVENT_HANDLER_DAEMON_MESSAGE: window --toggle float --sub-layer below EVENT_HANDLER_DAEMON_MESSAGE: window --grid 12:10:2:2:6:8 EVENT_HANDLER_WINDOW_TITLE_CHANGED: iTerm2 55691 EVENT_HANDLER_WINDOW_RESIZED: iTerm2 55691 EVENT_HANDLER_WINDOW_MOVED:DEBOUNCED iTerm2 55691 EVENT_HANDLER_WINDOW_TITLE_CHANGED: iTerm2 55691 EVENT_HANDLER_DAEMON_MESSAGE: query --windows EVENT_HANDLER_DAEMON_MESSAGE: window --grid 1:1:0:0:1:1 EVENT_HANDLER_WINDOW_TITLE_CHANGED: iTerm2 55691 EVENT_HANDLER_WINDOW_RESIZED: iTerm2 55691 EVENT_HANDLER_WINDOW_MOVED:DEBOUNCED iTerm2 55691 EVENT_HANDLER_WINDOW_RESIZED:DEBOUNCED iTerm2 55691 EVENT_HANDLER_WINDOW_TITLE_CHANGED: iTerm2 55691 EVENT_HANDLER_DAEMON_MESSAGE: window --display prev EVENT_HANDLER_APPLICATION_FRONT_SWITCHED: Finder (749) EVENT_HANDLER_DAEMON_MESSAGE: display --focus prev EVENT_HANDLER_APPLICATION_FRONT_SWITCHED: iTerm2 (732) EVENT_HANDLER_DISPLAY_CHANGED: 3 192 space_manager_refresh_application_windows: Google Chrome has windows that are not yet resolved space_manager_refresh_application_windows: Telegram has windows that are not yet resolved space_manager_refresh_application_windows: Slack has windows that are not yet resolved EVENT_HANDLER_WINDOW_TITLE_CHANGED: iTerm2 55691 EVENT_HANDLER_DAEMON_MESSAGE: query --windows EVENT_HANDLER_DAEMON_MESSAGE: query --displays EVENT_HANDLER_DAEMON_MESSAGE: query --displays EVENT_HANDLER_DAEMON_MESSAGE: query --windows EVENT_HANDLER_DAEMON_MESSAGE: window --toggle float --sub-layer below EVENT_HANDLER_WINDOW_TITLE_CHANGED: iTerm2 55691 EVENT_HANDLER_WINDOW_RESIZED: iTerm2 55691 EVENT_HANDLER_WINDOW_MOVED:DEBOUNCED iTerm2 55691 EVENT_HANDLER_DAEMON_MESSAGE: window --grid 12:12:3:2:6:10 EVENT_HANDLER_DISPLAY_CHANGED: newly activated display 3 was already active (3)! ignoring event.. EVENT_HANDLER_DISPLAY_CHANGED: newly activated display 3 was already active (3)! ignoring event.. EVENT_HANDLER_WINDOW_RESIZED:DEBOUNCED iTerm2 55691 EVENT_HANDLER_WINDOW_TITLE_CHANGED: iTerm2 55691 EVENT_HANDLER_WINDOW_TITLE_CHANGED: iTerm2 55691 EVENT_HANDLER_DAEMON_MESSAGE: query --windows EVENT_HANDLER_DAEMON_MESSAGE: query --displays EVENT_HANDLER_DAEMON_MESSAGE: query --windows EVENT_HANDLER_DAEMON_MESSAGE: query --displays EVENT_HANDLER_DAEMON_MESSAGE: window --toggle float --sub-layer below EVENT_HANDLER_DAEMON_MESSAGE: window --grid 12:12:3:2:6:10 EVENT_HANDLER_WINDOW_TITLE_CHANGED: iTerm2 55691 EVENT_HANDLER_WINDOW_RESIZED: iTerm2 55691 EVENT_HANDLER_WINDOW_MOVED:DEBOUNCED iTerm2 55691 EVENT_HANDLER_DAEMON_MESSAGE: query --windows EVENT_HANDLER_DAEMON_MESSAGE: query --displays EVENT_HANDLER_DAEMON_MESSAGE: query --windows EVENT_HANDLER_DAEMON_MESSAGE: query --displays EVENT_HANDLER_DAEMON_MESSAGE: window --toggle float --sub-layer below EVENT_HANDLER_WINDOW_TITLE_CHANGED: iTerm2 55691 EVENT_HANDLER_WINDOW_RESIZED: iTerm2 55691 EVENT_HANDLER_WINDOW_MOVED:DEBOUNCED iTerm2 55691 EVENT_HANDLER_DAEMON_MESSAGE: window --grid 12:12:3:2:6:10 EVENT_HANDLER_WINDOW_RESIZED:DEBOUNCED iTerm2 55691 EVENT_HANDLER_WINDOW_TITLE_CHANGED: iTerm2 55691 EVENT_HANDLER_WINDOW_TITLE_CHANGED: iTerm2 55691 EVENT_HANDLER_DAEMON_MESSAGE: config focus_follows_mouse autoraise EVENT_HANDLER_DAEMON_MESSAGE: config focus_follows_mouse autoraise EVENT_HANDLER_MOUSE_DOWN: 1755.00, 730.00 EVENT_HANDLER_MOUSE_UP: 1755.00, 730.00 EVENT_HANDLER_DAEMON_MESSAGE: query --displays EVENT_HANDLER_DAEMON_MESSAGE: query --windows EVENT_HANDLER_DAEMON_MESSAGE: query --windows EVENT_HANDLER_DAEMON_MESSAGE: query --displays EVENT_HANDLER_DAEMON_MESSAGE: window --toggle float --sub-layer below EVENT_HANDLER_DAEMON_MESSAGE: window --grid 12:12:3:2:6:10 EVENT_HANDLER_WINDOW_TITLE_CHANGED: iTerm2 55691 EVENT_HANDLER_WINDOW_RESIZED: iTerm2 55691 EVENT_HANDLER_WINDOW_MOVED:DEBOUNCED iTerm2 55691 EVENT_HANDLER_WINDOW_TITLE_CHANGED: iTerm2 55691 EVENT_HANDLER_DAEMON_MESSAGE: window --display next EVENT_HANDLER_APPLICATION_FRONT_SWITCHED: Finder (749) EVENT_HANDLER_DAEMON_MESSAGE: display --focus next EVENT_HANDLER_APPLICATION_FRONT_SWITCHED: iTerm2 (732) EVENT_HANDLER_DISPLAY_CHANGED: 1 318 space_manager_refresh_application_windows: Google Chrome has windows that are not yet resolved space_manager_refresh_application_windows: Telegram has windows that are not yet resolved space_manager_refresh_application_windows: Slack has windows that are not yet resolved EVENT_HANDLER_DAEMON_MESSAGE: query --windows EVENT_HANDLER_DAEMON_MESSAGE: query --displays EVENT_HANDLER_DAEMON_MESSAGE: query --displays EVENT_HANDLER_DAEMON_MESSAGE: query --windows EVENT_HANDLER_DAEMON_MESSAGE: window --toggle float --sub-layer below EVENT_HANDLER_WINDOW_TITLE_CHANGED: iTerm2 55691 EVENT_HANDLER_WINDOW_RESIZED: iTerm2 55691 EVENT_HANDLER_DAEMON_MESSAGE: window --grid 12:10:2:2:6:8 EVENT_HANDLER_WINDOW_MOVED:DEBOUNCED iTerm2 55691 EVENT_HANDLER_DISPLAY_CHANGED: newly activated display 1 was already active (1)! ignoring event.. EVENT_HANDLER_DISPLAY_CHANGED: newly activated display 1 was already active (1)! ignoring event.. EVENT_HANDLER_WINDOW_RESIZED:DEBOUNCED iTerm2 55691 EVENT_HANDLER_WINDOW_TITLE_CHANGED: iTerm2 55691 EVENT_HANDLER_WINDOW_TITLE_CHANGED: iTerm2 55691 EVENT_HANDLER_APPLICATION_FRONT_SWITCHED: Google Chrome (11244) EVENT_HANDLER_APPLICATION_FRONT_SWITCHED: Google Chrome has windows that are not yet resolved EVENT_HANDLER_APPLICATION_FRONT_SWITCHED: Finder (749) window_manager_create_and_add_window:55825 Finder - Downloads (AXWindow:AXStandardWindow:1) EVENT_HANDLER_WINDOW_TITLE_CHANGED: Finder 55825 EVENT_HANDLER_WINDOW_FOCUSED: Finder 55825 EVENT_HANDLER_WINDOW_FOCUSED: iTerm2 55691 EVENT_HANDLER_WINDOW_FOCUSED: iTerm2 55691 EVENT_HANDLER_APPLICATION_FRONT_SWITCHED: iTerm2 (732) EVENT_HANDLER_APPLICATION_FRONT_SWITCHED: Google Chrome (11244) EVENT_HANDLER_APPLICATION_FRONT_SWITCHED: Google Chrome has windows that are not yet resolved EVENT_HANDLER_DAEMON_MESSAGE: query --displays EVENT_HANDLER_DAEMON_MESSAGE: query --windows EVENT_HANDLER_DAEMON_MESSAGE: query --windows EVENT_HANDLER_DAEMON_MESSAGE: query --displays EVENT_HANDLER_DAEMON_MESSAGE: window --toggle float --sub-layer below ```
This is the relevant part from `.skhdrc`: ``` # make window floating and fill screen shift + alt - up : yabai -m query --windows |\ jq 'map(select(."has-focus" == true and ."is-floating" == false))[0]' -e && \ yabai -m window --toggle float --sub-layer below ;\ yabai -m window --grid 1:1:0:0:1:1 # float / unfloat window and center # use different settings for < 16:9 and > 16:9 alt - t : screen_width=$(yabai -m query --displays | jq "map(select(.index == $(yabai -m query --windows | jq 'map(select(."has-focus" == true))[0].display')))[0].frame.w"); \ screen_height=$(yabai -m query --displays | jq "map(select(.index == $(yabai -m query --windows | jq 'map(select(."has-focus" == true))[0].display')))[0].frame.h"); \ screen_ratio=$(echo "scale=2; $screen_width / $screen_height" | bc); \ yabai -m window --toggle float --sub-layer below; \ echo "$screen_ratio"; \ if [[ $(echo "$screen_ratio > 1.78" | bc) -eq 1 ]] ; then \ echo '> 16:9';\ yabai -m window --grid 12:12:3:2:6:10; \ else \ echo '< 16:9';\ yabai -m window --grid 12:10:2:2:6:8; \ fi # send window to monitor and follow focus ctrl + shift - down : yabai -m window --display next; yabai -m display --focus next ctrl + shift - up : yabai -m window --display prev; yabai -m display --focus prev ```
And my `.yabairc`: ``` #!/bin/sh # sudo yabai --load-sa # global settings yabai -m config \ mouse_follows_focus on \ focus_follows_mouse autoraise \ window_placement second_child \ window_shadow float # opacity yabai -m config \ window_opacity off \ window_opacity_duration 0.2 \ window_animation_duration 0.15 \ window_animation_frame_rate 60 \ active_window_opacity 1.0 \ normal_window_opacity 0.85 # window yabai -m config \ split_ratio 0.58 \ auto_balance on \ mouse_modifier ctrl \ mouse_action1 move \ mouse_action2 resize # general space settings yabai -m config \ layout bsp \ top_padding 35 \ bottom_padding 40 \ left_padding 5 \ right_padding 5 \ window_gap 5 echo "yabai configuration loaded.." echo "yabai setting up desktop/window rules" # sticky windows yabai -m rule --add app=iTerm2 sticky=on # designated spaces # yabai -m rule --add app=Outlook space=4 # yabai -m rule --add app="(WhatsApp|Spotify|Mattermost)" space=6 # yabai -m rule --add app="(Microsoft Teams|Slack)" space=7 # yabai -m rule --add app="(Code)" space=8 # unmanaged windows yabai -m rule\ --add app="(QuickTime Player|System Preferences|System Settings|Music|Finder|Sublime Text|Company Portal|Steam)"\ manage=off sub-layer=below # blanket rule to get old 'layerless' behaviour #yabai -m rule --add app=".*" layer=normal sub-layer=below echo "yabai rules loaded.." ```
sasha-id commented 4 months ago

Having the same issue. And I can see the window if I reveal all windows using mission control

Bellavene commented 4 months ago

Just a thought, maybe you have migrated parts of settings from much older OSX version?

I encountered a bug with that, where was an additional invisible desktop in the system, which in fact was a left over from OSX's old dashboard...

Try to query the number of desktops while having just one.

capitanBOBO commented 4 months ago

Same issue. When you change layout of disappeared window from float to bsd it's immediately appear. BUT if you change space for floating window - everything work just fine

capitanBOBO commented 4 months ago

Just a thought, maybe you have migrated parts of settings from much older OSX version?

I encountered a bug with that, where was an additional invisible desktop in the system, which in fact was a left over from OSX's old dashboard...

Try to query the number of desktops while having just one.

checked query info, only two displays

summereasy commented 3 months ago

Same here. Move a floating window to another display, it will "GONE"...

Fisher-Wang commented 3 months ago

Same here. My workaround is this

alber70g commented 3 months ago

Same here. My workaround is this

Yes, basically what I said in step 4

  • without moving mouse (to prevent loss of focus) hit shortcut alt+t for yabai -m window --toggle float --sub-layer below
chasonyu commented 3 months ago

Use like this /usr/local/bin/yabai -m display --focus $index && /usr/local/bin/yabai -m window --grid 6:6:1:1:4:4