0

How can I bring a specific window or program forward (and "active) with a single keyboard shortcut?

I wrote an AHK script to do this on Windows: I would hotkey a window to Win+1 for example, and then whenever I pressed Win+1, I would activate that window.

I want to do the same thing in MacOS now. I have a few frequently used Windows I would like to access deterministically: "You press X hotkey, you get Y window--every time."

Example: Slack. Slack only has one window, so it should be simple.

On Windows, I got a bit fancy because sometimes I wanted one Chrome window out of the lot, so I would make Ctrl+1 "set" the currently active window to be raised whenever Ctrl+1 was pressed, but for the first iteration, I just want to do single-window applications (or every window from an application--whichever is easier).

Detail: when I bring the window "forward", I want to be able to type in that window without also having to click on it. It should be fully "active" as if I had clicked on it.

I'm aware of things like Alt+Tab and the other Apple hotkeys, but they aren't deterministic. There's no way to press a certain keyboard combo and always get the same window. I don't want to scroll through a list of my open windows or anything. I want X app, right now, immediately.

  • Why don't you use Spaces? One specific app to each Space. Then it's as simple as using the built-in key-commands to bring each Space to the front & the app will come with it. See apple.stackexchange.com/q/179376/85275 – Tetsujin May 8 at 6:45
  • I have a 32 inch 4k monitor. I don't need that whole space for, for example, Slack (when Slack's thread view is fixed width). – Gordon Fogus May 11 at 19:24
0

I made an open-source tool that does that on Windows and Linux. I had a working MacOS version a while ago but discontinued it because of a lack of experience in the MacOS ecosystem.

If you have the skills, please take a look at this : https://github.com/xurei/hyperkeys/

Like I said, it won't work for MacOS out of the box, but I made it work before, so I guess it's possible to have it back.

Feel free to fill in a Github issue if you need my help ;-)

| improve this answer | |
0

I found a method that works (for all windows for a specific program).

  1. Create an AppleScript as follows (e.g., in /Users/<username>/activate_chrome.scpt:
tell application "Google Chrome"
    reopen
    activate
end tell
  1. Grab https://github.com/deseven/icanhazshortcut (I'm currently running 1.1.0)

  2. Create the shortcut of your choice and point it to run osascript /Users/<username>/activate_chrome.scpt

I tried the same thing in the Automator app, but the there were a lot of permissions issues and it would only activate the shortcuts when I had certain apps active and not others.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.