2

Are there any shortcut for the command merge all windows feature that comes with macOS Sierra? I did not encounter about an shortcut for this command and I did not see any property in Automator app. If is it possible, it will be nice improvement for productivity when we working with tabs rather than windows.

  • Merge all windows in what application? – user3439894 Oct 23 '16 at 19:10
  • any app that supports merge all windows feature like safari, finder, maps, etc. – mathema Oct 23 '16 at 19:11
4
  1. Open System PreferencesKeyboardShortcutsApp Shortcuts.
  2. Click the + to add a new shortcut.
  3. Choose All Applications from the Application dropdown.
  4. As the Menu Title, enter Merge All Windows (*see note at the bottom).
  5. Input a key combination of your choice as the Keyboard Shortcut. I use Ctrl ^W.

Now all applications with a menu item called Merge All Windows will respond to that key combination, and collapse all your windows into one.

Starting with Sierra, it is also possible to open documents in new tabs rather than in new windows. This is enabled by going into System PreferencesDock and setting Prefer tabs when opening documents to Always.

If you would like new Terminal sessions to open as new tabs as well, you can achieve this by placing a file named .bashrc in ~ (your Home folder), with the following line in it:

osascript -e 'tell application "System Events" to click menu item "Merge All Windows" of menu "Window" of menu bar 1 of process "Terminal"' >/dev/null 2>&1

Note: Merge All Windows may differ based on your operating system's language. If you are not using the English (US) locale, open Finder, and click the Window menu to determine the name of that command in your locale.

  • 1
    Thanks, it's very good approach. Could you note that 'Merge All Windows' defined as system's default language? – mathema Oct 23 '16 at 21:10
0

This one works for me just fine for Safari and Finder:

tell application "Safari"
    activate
    tell application "System Events"
        tell process "Safari"
            click menu item "Merge All Windows" of menu "Window" of menu bar 1
        end tell
    end tell
end tell

Let me know if this solves your issue.

edit: This script works for any active app that supports "Merge all windows":

try
    tell application "System Events" to tell (first process where it is frontmost) to click menu item "Merge All Windows" of menu "Window" of menu bar 1
end try
  • it solves mostly thanks but I must implement this feature every app that support this feature. Can I specify tell applicaion "Safari" or "Evernote" or "Maps" for supporting all apps with single shortcut? Otherwise, I must create different shortcuts for every Automator script for supporting different apps. – mathema Oct 23 '16 at 20:14
  • I've added a universal script to my answer. – oa- Oct 23 '16 at 20:58
  • Well, let's go a step further. When I open a new tab, is this script can be trigger the merge all windows automatically? – mathema Oct 23 '16 at 21:14
  • I'm glad that it works for you. Regarding the tabs: Unfortunately that's not possible. – oa- Oct 23 '16 at 21:48

You must log in to answer this question.

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