MACROS: Desktop Spaces • Macros to Improve Navigation and Window Management, v4.0

Hi, @blfarris. I'm sorry to hear that you are seeing some odd behavior. I've never seen any consistent issues, but occasionally I've seen some sluggishness with WhichSpace. Stopping and starting doesn't always address the problem, so a reboot might be necessary.

With that said, please continue to report any issues you see. Thanks!

Just installed this on Sequoia. It works for switching spaces, but not for moving windows between Spaces. KM has permissions, so it’s not that.

Hi, @chelseyblair; sorry you are having problems moving windows with the macros.

I'm able to move windows as expected on my system:

• Keyboard Maestro 11.0.3
• Sequoia 15.1 (24B5055e)/MacBookPro18,2


To troubleshoot, I have a few questions/suggestions:

  • Is this a new problem for you? That is, were the macros moving windows before upgrading to Sequoia?

  • What application windows are you trying to move? Finder? Have you tried other applications?

  • When attempting to move a window, do you see the arrow cursor move to the upper-left of foreground window?

If you haven't already, please restart your mac and try again.


2024-10-21 Update: I'm about to share an updated version of the macros (v4.0) that work better with macOS Sequoia. If you are still interested in troubleshooting the problem you encountered, please first upgrade to v4.0.


Keyboard Maestro Version 11+ Required

I've updated the OP with Version 4.0 of Desktop Spaces • Macros to Improve Navigation and Window Management:

Summary of Improvements

Since I don't have the need to remember the "previous" desktop in my workflows, i.e., I just need the window to move to the desktop-N, I had modified the "25) to 1", "26) to 2", etc. macros to remove everything other than the call to "sub Move Window to Desktop N". This looks like the below screenshot.

This worked for the last few days, but all of a sudden Cmd-Ctrl-2 stopped throwing windows to Desktop-2. Any idea what could be causing this?

Only logical explanation that comes to mind is that another app grabeed the Cmd-Ctrll-2 shortcut away from Keyboard Maestro.

Does anyone know how this could fixed, OR if there is a way to know "WHO" owns Cmd-Ctrl-2 (o any given key combination, for that matter) ?

Sure. Just disable your other running apps, perhaps one at a time, until the problematic app stops taking ownership of that key. Or check the log files of the other apps to see which one is capturing the key.

1 Like

Or try ShortcutDetective, which can often name the offending app. (Often it can't, but it's worth a shot.)

-rob.

1 Like

Right, I was hoping for a programmatic way. With all the various apps there is, it is a very painful process. Was being lazy :slight_smile:

I coined this: "Necessity may be the mother of invention, but laziness is its father."

I'm one of the laziest people on earth, which is what makes me a great programmer.

1 Like

And as luck would have it, my shortcut, Cmd-Ctrl-2 is the one that the app cannot detect .. more like, it crashes when I use that shortcut.

That's a bummer. When it works, it's great, but it doesn't always work. Looks like you're stuck with the non-programmatic solution.

-rob.

1 Like

Hi, @HanSooloo. Let’s start by trying to confirm your theory.

  1. In Keyboard Maestro, select Help>Open Logs Folder.

  2. Double-click Engine.log to open the log in Console.app.

  3. Select Action>Clear. Then attempt to use the macro by pressing ⌃⌘2.

If the macro is being triggered, you should see an entry similar to this:

2024-11-20 09:47:09 Execute macro “26)to 2” from trigger The Hot Key ⌃⌘2 is pressed

If you don’t see a new Engine.log entry, then Keyboard Maestro Engine is not seeing the hot key press.

If you do see the entry, then in Keyboard Maestro try:

  1. File>Quit Engine

  2. File>Launch Engine

If that doesn’t work, I’d try an account log off and log back in. If that doesn’t work, I’d finally try a mac restart.


Regardless of the testing, please report back. Thanks!

Thanks much for the detailed instructions. With Cmd-Ctrl-2, I see the following:

2024-11-20 20:42:45 Execute macro “26)to 2” from trigger The Hot Key ⌃⌘2 is pressed

With all other "working" shortcuts, e.g., Cmd-Ctrl-3, I see one more line:

2024-11-20 20:42:38 Execute macro “27)to 3” from trigger The Hot Key ⌃⌘3 is pressed
2024-11-20 20:42:39 Execute macro “Go to Previous Desktop” from trigger Space Changed

@HanSooloo, thanks for reporting back!

Are you able to navigate to Desktop 2 using ⌃2? If so, what do you see in the Engine.log?

If not, I suspect one of two issues:

  • Somehow your macOS Keyboard Shortcut (for movement to Desktop 2) has changed. (Refer to the OP for configuration instructions.)

  • Macro sub—Type Keystroke for Switch to Desktop N has somehow changed.


Upon closer inspection of your first message, based on those numbers (25 and 26) it appears that you have not installed the latest version of the macro set.

Please delete the current macros (by deleting the macro group), then download install the latest version.

With that set, you'll see:

  • 25)to 1 [^+click] ⌃⌘1 [2t]
  • 26)to 2
  • 27)to 3
  • etc.

Not that an update will address any issue that I suspect is causing this issue; it will just facilitate continued troubleshooting if we are using identical versions.


Once you install the latest version of the macro set, before you make any changes, try moving a Finder window from 1 to 3, then the same window from 1 to 2.

After those changes, again, please report back. Thanks!

Following are the log entries, first navigating to desktop 3, then to 2.

2024-11-20 22:43:21 Execute macro “04)3” from trigger The Hot Key ⌃3 is pressed
2024-11-20 22:43:22 Execute macro “Go to Previous Desktop” from trigger Space Changed
2024-11-20 22:43:26 Execute macro “03)2” from trigger The Hot Key ⌃2 is pressed
2024-11-20 22:43:26 Execute macro “Go to Previous Desktop” from trigger Space Changed

I omitted the "[^+click]" text when I was typing up the message to save time. I do actually see them in my editor as you described. And, yes, I had downloaded the latest set (4.0) from the beginning of this post. Its readme PDF has the date 2024-10-21 on the upper left corner of the file.

And, just to be sure:

$ sha256sum Desktop\ Spaces\ Macros.kmmacros
c471ef0cdfd9826ad42d3555b831f5d93c55edc1b35076e9fd1ec5b1718fd3d6  Desktop Spaces Macros.kmmacros

Okay, good. Let's continue debugging via PM's. I've already sent you a message.

@HanSooloo and I sorted out the issue via PM's (private messages).

For the benefit of others that might encounter a similar issue, I'm going to include a summary below...


The macros will still properly track the Desktop Numbers if you always switch Desktops with the macro set palette or the macro hot keys.

When you quit WhichSpace, the next time you use one of the macros in the set, you will see this warning dialog...


Yes, you could remove that check, but if you ever attempted to use the macros as designed (say, months later), then you'd probably be confused.

My recommendation would be to:

  • Keep using WhichSpace (modest resources required), or

  • Always switch Desktops using the macro set palette or the macro hot keys. Refer to the above dialog.

MacOS 15.4, Mac Studio 2022 M1 Max, two monitors
Keyboard Maestro 11.0.3
Desktop Spaces v. 4.0

Relatively new to KM, long-time Mac user. Need help/advice getting this set of macros to work and have what seems to me to be a very simple issue but I can't figure out what's wrong.

tl:dr: The Desktop Spaces macros work, but not when triggered by a separate macro simulating the keystroke.

Followed installation directions including changing Mission Control shortcuts for switching desktops.

Installed Whichspace.

Macros indexed in :sys Desktop Spaces work when run from that group using the "Run" button in the KM editor. They also work from direct keyboard key presses; however, "Move To" macros only work on same monitor; if space is on the other monitor, the view switches to that space but the window does not move (Displays have separate Spaces is ON. This is not the main issue and one I can work around)

The macros do not run when using a new "simulate keystroke" macro. I get the system error tone. This applies when using the hot key, or when using the Run or Try functions in KM editor. The log reflects the macro execution from the hot key trigger, but nothing other than the error tone happens. Applies to both Go To and Move Window To macros.

The macros do run from the ctrl-D palette.

The tests in Post 5 function as expected.

Grateful for any assistance.

Hi, @BillC. Sorry that you having some difficulties with this macro set. I'll do my best to help.

I'm not sure I understand the issue, but I'll make some assumptions and you can correct me if I'm wrong.

Let's say you are trying to move from Desktop 1 to Desktop 2. If so, if you manually press ⌃2, does it work? If not, then there is a fundamental problem with the setup.

Are you trying to use the following action from another macro and expecting that to function the same as a manual press of ⌃2?

Keyboard Maestro Export

If so, that won't work with any Keyboard Maestro macros

Now I'm going to assume that you are trying to move to another space within one of your macros. If that is the case, just copy the action that is in the 03)2 macro to your macro.

Keyboard Maestro Export

If you plan to do that often, you might want to copy that action to your Favorites.


Sorry I can't help with this issue since I do not have a second monitor. But if you do find a solution, please share here as others might benefit. Thanks.

1 Like

Thanks for the quick reply, Jim.

I knew it was something simple, and yes, this was the issue.

Embarrassed to say I didn't know that.

Thanks! Hopefully I can puzzle it out from here. My ultimate aim is to create a palette similar to the one you have depicting various scenarios for screen arrangements. Appreciate your generosity in sharing with the community.

1 Like