Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

empty space on desktop after waking from sleep mode #159

Closed
hrvstr opened this issue Jul 26, 2019 · 12 comments
Closed

empty space on desktop after waking from sleep mode #159

hrvstr opened this issue Jul 26, 2019 · 12 comments
Labels
bug Something isn't working

Comments

@hrvstr
Copy link

hrvstr commented Jul 26, 2019

Hi, I have an issue when I wake my computer from sleep mode where yabai won't fill all available space on my desktop. I then have to create another space and kill the first to get it to use all available space again. How can I fix this?

Setup:

  • mac OS 10.13.6 (17G7024)
  • ultrawide monitor (3440x1440px)
  • yabai (stable - not github) running as a brew service
  • scripting-additions not installed - SIP enabled

Steps to reproduce

  • Go to sleep mode with a couple of windows tiled
  • Wake computer up -> not all available space is filled
  • Create new space and kill the old one
  • All available space is used again

bug 2019-07-26 21_48_51

Config file:

#!/usr/bin/env sh

# global settings

yabai -m config mouse_follows_focus          off
yabai -m config focus_follows_mouse          off
yabai -m config window_placement             second_child
yabai -m config split_ratio                  0.50
yabai -m config auto_balance                 off
yabai -m config mouse_modifier               fn
yabai -m config mouse_action1                move
yabai -m config mouse_action2                resize

# 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                   20
@koekeishiya koekeishiya added the bug Something isn't working label Jul 28, 2019
@dominiklohmann
Copy link
Collaborator

I've been having a very similar issue lately which I can't reliably reproduce, where yabai loses some of its managed windows so new windows tile over them. Here's a screencast: https://streamable.com/h6fau

Your idea of resetting the space by destroying the current one works quite smoothly, so I wrote a small script that creates a new space, moves it so it's right next to the current one and then destroys the current one, thus moving all windows over to the newly created space and keeping the order of spaces as if nothing ever happened.

# reset current (non-fullscreen) space
yabai -m query --spaces --space | jq -er '."native-fullscreen" == 0' > /dev/null && \
    yabai -m space --create && \
    seq "$(yabai -m query --spaces --display | jq -r 'map(select(."native-fullscreen" == 0).index)[-1]')" \
        "$(yabai -m query --spaces --space | jq -r '.index + 1')" \
        | sed '$d' \
        | xargs -I{} yabai -m space {} --move prev && \
    yabai -m space --destroy

I have this set to a keyboard shortcut in skhd so I can easily reset the current space.

It's not a fix, but it's at least a working bandaid.

@hrvstr
Copy link
Author

hrvstr commented Aug 16, 2019

I wanted to add that it's not only happening when waking up from sleep. It can reproduce it now by opening a new tab in Terminal.app.

2019-08-16 11-26-19 2019-08-16 11_29_37

@dominiklohmann
Copy link
Collaborator

See #68 for that.

@koekeishiya
Copy link
Owner

Can you reproduce the wake from sleep issue on master? I can't reproduce this..

@alextes
Copy link

alextes commented Aug 17, 2019

Hmm, I do get empty spaces, not after sleep, and not from tabs. It sounds like it may be an unrelated issue but I'll subscribe here and wait for this to pan out first.

Thanks dominik for the workaround.

If I find a way to reliably reproduce I'll share.

@hrvstr
Copy link
Author

hrvstr commented Aug 20, 2019

Can you reproduce the wake from sleep issue on master? I can't reproduce this..

I uninstalled the stable version yesterday and installed again with brew install --HEAD yabai.

After sleeping the computer over night I woke it up this morning and the bug appeared again. I could not reproduce it when going to sleep mode for a short time so it might not be related to sleep mode after all. I will try to keep track of what windows are open when I experience it.

@dominiklohmann
Copy link
Collaborator

In the Energy Saver system preferences, do you have "Enable Power Nap while plugged into a power adapter" enabled? That setting causes the NSWorkspaceDidWakeNotification to fire every so often while the computer is asleep.

@hrvstr
Copy link
Author

hrvstr commented Aug 23, 2019

Nope, Power Nap is disabled. I observed the bug the last couple of days and I am 90% sure it's related to the Mail.app. I experience the bug mostly when I open the Mail.app window when it was previously minimized. Still can't really reproduce it reliably because it doesn't happen always...

@alextes
Copy link

alextes commented Sep 2, 2019

I found a way to reproduce my issue, but it seems unrelated, let me know if you'd like me to create a separate issue.

I have an app Kitty. Which I open using:

cmd - return : /Applications/Kitty.app/Contents/MacOS/kitty --single-instance -d ~

If I hide Kitty and trigger a new window to be created, the app unhides, and creates a new window. This results in two windows but three spaces, one of them being empty.
yabai -m query --windows --space

[{
        "id":10655,
        "pid":51886,
        "app":"kitty",
        "title":"alextes: yabai -m query --windows --space",
        "frame":{
                "x":1285.0000,
                "y":20.0000,
                "w":1255.0000,
                "h":1400.0000
        },
        "level":0,
        "role":"AXWindow",
        "subrole":"AXStandardWindow",
        "movable":1,
        "resizable":1,
        "display":1,
        "space":1,
        "visible":1,
        "focused":1,
        "split":"horizontal",
        "floating":0,
        "sticky":0,
        "border":0,
        "shadow":1,
        "zoom-parent":0,
        "zoom-fullscreen":0,
        "native-fullscreen":0
},{
        "id":3404,
        "pid":51886,
        "app":"kitty",
        "title":"sweetspot:2:api - \"api: nvim ~/.skhdrc\" 1#,3#,4#,5#",
        "frame":{
                "x":20.0000,
                "y":725.0000,
                "w":1255.0000,
                "h":695.0000
        },
        "level":0,
        "role":"AXWindow",
        "subrole":"AXStandardWindow",
        "movable":1,
        "resizable":1,
        "display":1,
        "space":1,
        "visible":1,
        "focused":0,
        "split":"horizontal",
        "floating":0,
        "sticky":0,
        "border":0,
        "shadow":1,
        "zoom-parent":0,
        "zoom-fullscreen":0,
        "native-fullscreen":0
}]

Screen Shot 2019-09-02 at 10 53 02

Restarting yabai makes the empty space disappear. Same as recreating the desktop.

@koekeishiya
Copy link
Owner

koekeishiya commented Sep 2, 2019

@alextes I can see how that could be a problem. Would you mind creating a separate issue for that? Thanks.

Edit: I created a separate issue and copy-pasted your post, see #233

@hrvstr
Copy link
Author

hrvstr commented Oct 9, 2019

Just wanted to give a small update on this issue:

I now switched from using the default Mail.app to Spark and the problem mostly went away. I still have the problem sometimes so it seems like other apps are triggering this bug as well but it's not every day like it used to be.

@koekeishiya
Copy link
Owner

I think this issue has got somewhat derailed, and I have yet to have this problem occur for me.
There has also been some changes to try and deal with 4k/5k displays in the latest version, and that may catch this issue as well. Closing this.

Feel free to create a new issue if you still experience this on the latest version. It would be nice if you could include the result of yabai -m query --windows --space and a debug log dump if that happens (run as yabai --verbose or add yabai -m config debug_output on in your config-file. If you run through brew you need to specify path to logfiles for stdout and stderr in the service .plist file).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants