FelixKratz / dotfiles

My personal macOS configuration
GNU General Public License v3.0
929 stars 92 forks source link

Return from fullscreen, space_change not triggered #21

Closed bin101 closed 1 year ago

bin101 commented 1 year ago

After returning from a fullscreen window, i.e. after pressing f on a fullscreen youtube video or image on the window bar doesn't seem to trigger the space_change event.

FelixKratz commented 1 year ago

I think it should be fixed on master.

bin101 commented 1 year ago

Now I get the event sometimes but not very reliable.

bin101 commented 1 year ago

I use your dotfiles nearly in original state and added the space change event to the yabai.sh:

case "$SENDER" in
  "mouse.clicked") mouse_clicked
  ;;
  "forced") exit 0
  ;;
  "window_focus") window_state 
  ;;
  "windows_on_spaces" | "space_change") windows_on_spaces && echo "test"
  ;;
esac

You can either count the test string output or see if the browser icon returns to the last active desktop after leaving the fullscreen mode

Edit: After starting but before stopping the fullscreen mode of youtube I heavily switch between desktop. This will reliable not return the browser icon to the source desktop.

FelixKratz commented 1 year ago

Just to be extra sure about it: 1) You have added the event to the yabai item in item/front_app.sh like this:

           --subscribe yabai window_focus      \
                             space_change      \
                             windows_on_spaces \
                             mouse.clicked     \

2) You have installed the HEAD version of sketchybar:

brew uninstall sketchybar
brew install sketchybar --head

3) You use Safari

Because with all of these things fulfilled I can't seem to reproduce.

bin101 commented 1 year ago
  1. Yes
  2. I build Sketchybar from sources (current master) and executed it from terminal after stopping the brew service
  3. I use Google Chrome and I see that Safari keeps a window on the original desktop

My result with Chrome:

image
FelixKratz commented 1 year ago

Are you able to reproduce the problem with Safari in native fullscreen mode? Because in native fullscreen mode Safari will leave the current space and when exiting fullscreen it should return to the previous desktop.

bin101 commented 1 year ago

By native you mean the fullscreen (green) icon on the window bar? Yes:

image

What I did:

  1. Enter fullscreen
  2. Switch to another desktop, stay there a while (10s seems to be enough)
  3. Switch back to Safari
  4. Stop fullscreen
FelixKratz commented 1 year ago

I know this is not productive but here is a screen capture of me trying to reproduce the issue:

https://user-images.githubusercontent.com/22680421/236026652-c7071cce-45fa-4fa8-b1fd-9d860c85e19a.mp4

It may be a race condition between the event happening in sketchybar and in yabai, but I think realistically the script execution delay should be large enough for this to not really be relevant.

Could you try with my exact dotfiles with the only difference being the space_change event in yabai.sh?

bin101 commented 1 year ago

I used your Sketchybar and Yabai plain dotfiles and they behave way differently than on your machine:

https://user-images.githubusercontent.com/12427722/236045398-e4d3c93f-9141-4f25-8d74-53b238c891b5.mp4

I am using a M2 Air with Ventura 13.2.1 maybe it's hardware/software related?

FelixKratz commented 1 year ago

I think this is purely related to the yabai.sh script not being registered properly to the space_change event, I think I will register the windows_on_spaces function for space_change as well later today, so you can try with my later update.

The space_change event is actually performed, as you can clearly see by the space indicators of space 5. If the space_change event would not work it would not create/destroy the indicator of space 5.

bin101 commented 1 year ago

In my own dotfiles I already had the space_change event registered inside yabai.sh, but I will test your dotfiles again with it.