1

On PC: To open Chrome, the command was Win+3, a new window was Shift+Win+3.

It just occurred to me how much I relied on this. How can I have something as beautiful and simple as this on Mac? It should try to open the most recently active window, but should avoid changing Spaces as that is super disorienting. It shouldn't disorient.

Can I write a custom macro? Or program? Or command? Or ANYTHING to have this work on Mac?

0

While you know how to assign new shortcuts for opening the app I have a solution to open new "Chrome" window if it is not present on current Space or activate the "Chrome" on current space. This AppleScript will prevent you from switching the spaces:

if application "Google Chrome" is running then
    tell application "System Events" to set CurrentSpaceWindows to windows of process "Google Chrome"
    if CurrentSpaceWindows is {} then
        tell application "Google Chrome"
            make new window
            activate
        end tell
    else
        tell application "Google Chrome" to activate
    end if
else
    tell application "Google Chrome" to activate
end if

You can now assign a global shortcut to run this script and get what you want (If I understood you correctly).

I personally prefer to use BetterTouchTool to assign keyboard and other shortcuts. You can directly assign a shotcut to run this script.

BetterTouchTool settings

EDIT: add a posibility to run it from an Automator.

In order to run it via Automator Service, you have to create it like so:

Automator screen

Please note, that I've left the whole part:

on run {input, parameters}

<- Here goes the Script

    return input
end run

Later go to System Preferences -> Security & Privacy and add Automator to the Accessibility section like this:

enter image description here

Then it should work as expected, I've tested it and it works.

  • This needs to be combined with this guide apple.stackexchange.com/questions/175215/… on how to hook it in without having to pay for essential OS utility... – Shammoo Nov 29 '17 at 19:10
  • @Shammoo sure you can do it it many different ways. That's why I wrote: "While you know how to assign new shortcuts for opening the app". Main reason I've posted the answer is to prevent space switching. BTW BetterTouchTool can do much more than assigning keyboard shortcuts and is worth its price in my opinion (for "power users"). – Mateusz Szlosek Nov 29 '17 at 19:18
  • Unfortunately, financial expenditures go through procurement, making it a real hassle to pay $5 for something that doesn't deliver $500 worth of value. Not saying that this doesn't, but I or someone else are going to have to spend a half day doing that analysis. – Shammoo Nov 29 '17 at 19:35
  • In terms of automating this. The current script will run into the error action “Run AppleScript” encountered an error: “System Events got an error: com.automator.runner.xpc is not allowed assistive access.” When executed as a shortcut while an active app without Assistive access. I'm not sure I can see a way around this... Any thoughts, @mateusz-szlosek ? – Shammoo Nov 29 '17 at 19:37
  • @Shammoo please see the edit. – Mateusz Szlosek Nov 29 '17 at 19:49
0

macOS should get you up to speed a lot quicker.

See macOS Sierra: Create keyboard shortcuts for apps for creating custom keyboard short cuts:

You can create keyboard shortcuts only for existing menu commands. You can’t create keyboard shortcuts for general purpose tasks, such as opening an app.

  1. Choose Apple menu > System Preferences, click Keyboard, then click Shortcuts.
  2. Select App Shortcuts on the left, click the Add button , click the Application pop-up menu, then choose a specific app or All Applications. If you want to set a shortcut for a menu command that appears in many apps, choose All Applications.
  3. In the Menu Title field, type the menu command for which you want to create a shortcut, exactly as the command appears in the app, including the > character (type ->), ellipses (type three periods without spaces or press Option-;), or other punctuation.
  4. Click in the Keyboard Shortcut field, press the key combination that you want to use as the keyboard shortcut, then click Add.
  • Err... The text you copied explicitly says that it is impossible to fix this problem?? > You can’t create keyboard shortcuts for general purpose tasks, such as opening an app. – Shammoo Nov 29 '17 at 16:54
  • 1
    There are also macro programs and the like that allow you to automate keystrokes to do arbitrary tasks, the built-in Automator.app and things like keyboard maestro can assist in this as well. – Steve Chambers Nov 29 '17 at 17:08

You must log in to answer this question.

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