Is there a shortcut or such to send the currently active window to the back of the screen while still keeping it open (so that it ends up "beneath" all other open windows)?

  • 2
    H will send the current app (inc all its windows) to the back and hide it until you bring it back to the front (from the dock or by -TAB to reselect the app). In most applications Shift--~ will cycle through the current app's windows, which is probably closest to what you're looking for. – Mic Channel Apr 4 '16 at 18:37
  • I know about it, it's not what I want. – user178294 Apr 4 '16 at 20:42
  • 1
    If you want to send it all the way to the back, which window should be your focused? The previous selected window? – sayzlim Nov 24 '16 at 1:02

Short answer: No, Apple does not provide an API that allows you to alter an application window index except by bringing a window to the front (index 1). There are no elegant solutions. But:

Long answer: Yes, You can use AppleScript to effectively move a window to the back of a stack of AppleScript-able windows by collecting a list of windows, then rapidly moving each one (except the frontmost) to the front, leaving the chosen window at the back.

Here is an example of an AppleScript which sends the frontmost Finder Window to the back.

tell application "Finder"
    set winList to every window whose visible is true
    if not winList = {} then
        repeat with oWin in (items 1 through -2 of reverse of winList)
            set index of oWin to 1
        end repeat
    end if
end tell

This script is based on a solution by JMichaelTX discussed on the KeyboardMaestro forum.

The reshuffling is incredibly fast, but in the Script Editor you can inspect how it works, leaving "506" on the bottom and popping "502-505" up in a way that preserves their order:

get every window whose visible = true
    --> {Finder window id 506, Finder window id 505, Finder window id 504, Finder window id 503, Finder window id 502}
set index of Finder window id 502 to 1
    --> 1
set index of Finder window id 503 to 1
    --> 1
set index of Finder window id 504 to 1
    --> 1
set index of Finder window id 505 to 1
    --> 1

You can map this AppleScript to a service or keyboard shortcut, either by a) putting the script into a Run AppleScript action inside an Automator service, or b) using a launcher (Alfred, Keyboard Maestro etc.). For details on Applescript keyboard assignment see: How do I assign a keyboard shortcut to an AppleScript I wrote?

This may satisfy OPs needs -- it is unclear from the original post. This solution can also be extended to multiple AppleScript-able applications. I am not, however, aware of a solution to make it work effectively with a mix of scriptable and non-scriptable windows, due to the fact that in AppleScript, System Events addressable windows for non-scriptable applications do not have a set index verb/property. There exists an "AXRaise" action for some windows when assistive devices / accessibility is turned on, but this also does not apply to all windows. Elaborate hacks exist that involve walking through each active application and show/hiding or minimizing/restoring windows, but they are a mess.

Related discussions:

  • Is it possible to send window of any app to the back, instead of the window of a specific app? – Di Liu Jun 22 '19 at 21:32
  • Sadly, as of Mojave, this seems to no longer work. – Edward Falk Nov 21 '19 at 20:12
  • Since Mojave, my understanding is that controlling Finder with AppleScript now needs permissions to run (untested). If you are getting errors like errAEEventNotPermitted then there are solutions to add these permissions -- see related discussions: forums.developer.apple.com/thread/106949 – JeremyDouglass Nov 22 '19 at 15:24

Your question isn't very clear, but if what you want is a shortcut to cycle through all windows of the currently active app, you should be able to do this with the Command~ keyboard shortcut.

The ~ key is usually located at left of the 1 key.

Just to clarify, what the Command~ keyboard shortcut does is cycle through all windows of the current app you're in. For example, if you're using MS Word and have three documents open, it will cycle through those three documents.

However, the Command~ keyboard shortcut does not cycle through Tabs. For example, if you have Safari open with three windows and each window has five tabs open, using this shortcut will cycle through the three windows, not through the individual tabs.

Another option that may achieve what you want is the CommandM keyboard shortcut. However this minimises the currently active window to the Dock, so I suspect that's not what you want.

If I've misunderstood your question totally, please clarify.

  • I think that this is the use case that the OP wants: say I have the messages app open in front of my mail app and I want to quickly bring the mail app to the foreground and send messages to the background, I can do a keyboard shortcut and the messages app will be behind my mail app. I tried your keyboard shortcut and this did not accomplish that. – owlswipe Nov 28 '16 at 22:06
  • I think you mean the ` key. ~ is the only printed when Shift is held and ` is pressed – Crowder Mar 23 '19 at 20:49

You must log in to answer this question.