Can KM bolt on this functionality to Finder?

Or you tested in areas that I didn't test in :), which is most likely the real answer. As noted, this isn't the way I'd tackle this particular problem, but it could work, as long as you knew the "safe" areas to click in.

If I were doing it, I'd write something so that when I was hovering over a folder, the macro (which I'd invoke with a hot key of some sort) would click it to select it, then KM could analyze the path and move it up one level.

-rob.

And if I were doing it, whenever Finder was open, I'd take a screenshot of its front window (perhaps every one second, overwriting the last image) and if the user double clicks on the window, I'd take another screenshot and compare it to the first (probably by taking an MD5 hash, since KM is devoid of image content-detection actions.) If the two images are the same, this tells us that the user double clicked on an empty area, and we could take our additional action.

Thanks! How would you make KM detect that an empty space of Finder is being double clicked on?
EDIT; When I posted this I was only seeing your first reply lol sorry

Damn this sounds complicated, I guess I can't really replicate that Windows workflow and have to think of another way to navigate up folders in Mac. This screenshoting think that KM does to detect changes, it will affect performance a bit, no?

If you haven't discovered it yet then Finder's "Path Bar" might be what you are looking for to navigate up folders (if you're double clicking in an empty area to do things other than move up folders it won't help).

At the bottom of a finder window you should see the full path to the current folder like this:

Screenshot 2024-07-06 at 07.54.17

If it's not visible then select "Show Path Bar" from Finder's View menu. In the above screenshot I'm in the folder Test 3, if I want to move up to Test2 I simply click on the name in the Path Bar, or if I wanted to move up to Documents I can do that in one click by selecting that folder in the Path Bar.

Not really. Not my way. I think I could write this in three actions. I'll take a few minutes write now and try to write it. EDIT: I wrote it; it took ten actions, but I'm debugging it right now. Something isn't working.

Maybe. People are so worried about "performance" and I'm not sure why. It's your computer, and there's no speed limit. But if you won't want to use the full capacity of your CPU, then you sure don't have to. But it's not like speeding in a car, there's no danger in using more CPU cycles.

It wasn't complicated. It took me 15 minutes. Here it is. I did not test its performance. You might find that it takes too much CPU time. I don't know. Give it a try, and if nothing else, you can learn from it.

There are two macros. One takes screenshots every second, the other only triggers when you double click in a Finder window. You will have to update the trigger because you will have a different mouse from me.

The reason it took me 10 minutes to debug is that I forgot the result of an MD5 hash was a string, not a number. I feel dumb.

I spent only 10 seconds testing it once it worked. So you get what you pay for. It may have bugs. Feel free to ask if you have questions. My method uses ZERO CPU if the Finder app is not the frontmost app.

Finder2 Macro (v11.0.3)

Finder2.kmmacros (6.4 KB)

Here's a kind of clunky and largely untested solution that works:

Double Click Empty Space to Navigate Up.kmmacros (5.1 KB)

This uses a combination of a Pause action and the action timeout setting for a Wait Until action to figure out if the user double clicked the mouse or not.
It is dependent on what your System Settings > Accessibility > Pointer Control > Mouse & Trackpad > Double-click speed setting is. Mine is two ticks from the fastest setting and this worked consistently in my 2 minutes of testing.

It's also dependent on how fast your Mac is: since it relies on figuring out if %FinderSelections% is empty or not, if your Mac cannot keep up with your clicking speed, the macro always fails, no matter how low you set the first Pause action to.

EDIT: oops, posted without checking for new replies. @Airy's solution is much more robust! I like that.

Thank you so much for taking the time to assist me with my request, Loop and Airy, I appreciate you guys! I went ahead and imported the macro files but I can't get them to work, (I bound my own mouse's button) but nothing happens when I double click Finder's empty area. Is there anything else I need to do?

So anyway I tried replicating the macro manually, starting with your example Loop, but I can't figure out this second part, I searched for "Wait" but can't find an entry on the list.

That's a Pause Until action. I renamed it to make its purpose clearer. If you search for "pause" it will show up. Also, you can copy actions from one macro to another by selecting the action you want to copy, copying it, selecting an action or an empy action space in the destination macro, and pasting.

I wouldn't remake this from scratch because there are other parameters you have to adjust: in my macro's case you'd have to adjust the action timeout to something appropriate, as well as the "Reduce CPU Usage" setting (both accessible through the gear icon on the right) to X for the Pause Until action. The latter is a (poor) workaround to try making the Pause Until action work more reliably (see this thread for a more detailed explanation), in what is already a sort of clunky implementation.

This is probably an issue with Keyboard Maestro not detecting your mouse's clicks, which would mean it's an issue with either the trigger or the Pause Until action in my macro. I can't speak for Airy's macro. Can you try troubleshooting to try seeing if Keyboard Maestro detects your mouse clicks properly with this macro?

Mouse Click Test.kmmacros (2.7 KB)

Just replace the trigger with your own mouse. This macro will display a notification every single time you press its trigger when Finder is frontmost.

Lastly, since you seem to have a Logitech G604, may I suggest you simply use any of its many many buttons as a trigger for a much simpler macro that consists of just the very last action ("Select "Enclosing Folder" in the Menu "Go" in Finder") in my original macro instead? This a more efficient approach in all respects, down to the number of clicks required (two becomes one).

This seems to work:

Double Click on Empty Finder Area.kmmacros (21 KB)

Macro screenshot

When I run that (Sonoma), all I ever get back is "Double click trigger," regardless of whether I double-click on an item or whitespace in a Finder window or on the Desktop itself.

-rob.

Oh really? Maybe your mac is faster than mine. Does a small pause help?

Ah, yea, that does it—if I very methodically double-click over an item, then I see "Normal."

-rob.

1 Like

Every mouse send its key code, no? Programable or not.

I mean, if you have a non-programable mouse (in case this exists), and you press mouse button 4, it will send the "mouse button 4" key code, and you can do whatever you want with that key code in KM ("USB Device Key Trigger") or similar apps.

If you add a pause at the start of the macro (let's say 0.01s), can you click at normal speed and it still works? I'm thinking there needs to be a small pause for faster machines to allow the selection to update after the macro is triggered.

That seemed to help.

-rob.

Yes, but I think you didn't see my point. My point was that the default USB key code for the primary mouse button is not "eaten" by the KM Engine. As a result, you can't REDEFINE the primary mouse button to not perform its click in macOS when the user clicks on it.

But if you can redefine the USB key code given by the primary mouse button, which not all programmable mice can do, then you can make it so that apps don't do anything when the user clicks on the primary mouse button. I've accomplished this once, when I didn't want my apps to see the mouse clicks, but only see the simulated mouse clicks when my KM macro takes its actions.

This is why I had that first pause in my macro. If it's not there, the time %FinderSelections% takes to update would always cause my macro to fail (I'm on an M1 Ultra).

1 Like

For moving up a folder level in Finder Command + up arrow does that. Use BetterTouchTool to send that key combo from its plethora of device options.

Do the same for other Finder actions you find missing. BTT has enormous options.