10

A Mail window was in the Dock, and I clicked on it to restore it to my current Desktop. Instead of opening where I can see it, it went to some other Desktop, presumably the one it was in when it was minimized.

I use different Desktops for different projects, where one Desktop may have multiple browser windows, multiple text editors, etc., so I've disabled the default setting of "When switching to an application, switch to a Space with open windows for the application", because that seems to only make sense if you use an approach of one Space per Application, which makes no sense for me. As far as I can tell this is the only setting I'm using that may be relevant to this problem, but I really really don't want to have OS X forcing me to constantly switch spaces and force me into a one-space-per-app model.

Mission Control settings

Is there some way to make the window I restore (de-minimize) appear in my current Space/Desktop? It could be

  • a hidden preference that I set with defaults write;
  • an AppleScript that I have to trigger after restoring the window, to move it to my current Space/Desktop;
  • some utility application meant to handle this problem
  • some other workaround or solution I hadn't thought of.

(An AppleScript would probably be the least desirable approach, but it could be triggered with Alfred, QuicKeys, or BetterTouchTool, etc.)

It might also be worth mentioning that I'm using Yosemite because of problems between El Capitan and TotalSpaces2, but I'd like to know if upgrading solves this problem.

4 Answers 4

7

⌘ Command "click" on the minimized window in the dock, and it will restore (de-minimize) in the current workspace, regardless of which space it was on when it was minimized.

2
  • 1
    doesn't work if "Minimize windows into application icon" setting is enabled, but still upvoting this one.
    – victorlin
    Commented Jul 16, 2016 at 2:39
  • 3
    Is there any way to make this the default? I'd rather use command to put the window into "the background" (i.e. another space), much like command-clicking on a link puts the link into a background tab in a browser.
    – iconoclast
    Commented Jul 18, 2016 at 18:18
3

Possibly this helps your situation:

defaults write com.apple.Dock workspaces-auto-swoosh -bool NO; killall Dock
5
  • will this make it open in my current space, or just avoid switching spaces when it is restored?
    – iconoclast
    Commented Feb 19, 2016 at 3:08
  • somehow yes. It does not auto change to the space the window is opened again, which helps staying in context. you then can use the context menu in the dock to bring the window to this space. Commented Feb 19, 2016 at 13:56
  • Unfortunately it has a side effect. Now if I (e.g.) select a window from the Window menu, I do not switch to the space of that window.
    – iconoclast
    Commented Feb 19, 2016 at 15:15
  • Do I need to logout/login again? This doesn't work on macOS Catalina
    – muuvmuuv
    Commented Nov 19, 2019 at 7:39
  • Doesn't work in Catalina for me either Commented Dec 13, 2019 at 9:06
2

I managed to get this working with some help from koekeishiya's yabai.

First we disable the workspaces swoosh as @mahal tertin mentioned:

defaults write com.apple.Dock workspaces-auto-swoosh -bool NO; killall Dock

Then we add this bit of code to our .yabairc file:

yabai_query_current_space="\$(yabai -m query --spaces --space | jq '.index' )"
yabai -m signal --add event=window_deminimized action="yabai -m window $YABAI_WINDOW_ID --space $yabai_query_current_space"

Effectively, this instructs yabai to send a deminimizing window to the current space when it receives a deminimize event.

Depends on having yabai and jq installed.

ref: https://github.com/koekeishiya/yabai/blob/master/doc/yabai.asciidoc#signal

7
  • What's the location of the .yabairc file? Commented Oct 14, 2021 at 23:18
  • 1
    I have mine in my $HOME directory. github.com/koekeishiya/yabai/wiki/…
    – pete-may
    Commented Oct 15, 2021 at 0:29
  • 1
    I should also mention that if you don't want all the other cool features of yabai you can put yabai -m config layout float in your .yabairc file to basically disable the window tiling features.
    – pete-may
    Commented Oct 15, 2021 at 0:30
  • great find! but "System Integrity Protection needs to be (partially) disabled for yabai to inject a scripting addition into Dock.app" scares me a little 😮
    – iconoclast
    Commented Oct 15, 2021 at 21:08
  • 1
    I'm actually using it without the scripting addition! Most of the yabai features work without it. I'm on a work computer so got to have everything secure.
    – pete-may
    Commented Oct 15, 2021 at 21:36
0

You need to ensure the application is set to "Assign To All Desktops" when you second-click on the icon and go to "Options"

enter image description here

This writeup eliminated years of frustration. :)

2
  • If I were to do that for all apps, it would literally make Desktops completely useless. So that's clearly not a solution. 😅 (The whole point of Desktops is to have different windows on each Desktop. 😉 Without that, they have exactly zero purpose.)
    – iconoclast
    Commented Dec 17, 2022 at 20:08
  • Yes. Use a combination of all three settings.
    – ATSiem
    Commented Dec 19, 2022 at 1:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .