Trigger 'Minimize All' by clicking empty area of desktop?

Hi there,

I've been using Minimize All as a hotkey, and it's great, but sometimes I really wish I could just click an empty area of the desktop to access all the files and folders I store there.

Is there any way to configure Keyboard Maestro so that Minimize All could be triggered by clicking the desktop background?

Sorry if this is a stupid question, just keen to get it working if possible. Thanks.

I don't know if KM understands "click an empty area of the desktop". But if you don't want to use the keyboard (hotkey), then you could try the gesture triggers.

This AppleScript (courtesy of Nige_S) will get you pretty far:

tell application "Finder"
	if front window exists then
		tell application "System Events"
			tell process "Finder"
				if enabled of menu item "Close Window" of menu "File" of menu bar 1 then
					display dialog "Window is active"
				else
					display dialog "Desktop is active, window(s) open"
				end if
			end tell
		end tell
	else
		display dialog "Desktop only"
	end if
end tell

Change those display dialog commands to return, and use the variable for your conditional.

The challenge here is getting the Trigger right.

  • "When Finder Activates" doesn't work if you click the Desktop while already in a Finder window.
  • "When Focused Window Title Changes" mostly works, but shows curious behavior when clicking on the Desktop then another Finder window: it somehow triggers twice.

I haven't been able to debug the title change double trigger, but even if you got that to work that trigger would be very frequent, which may be inadvisable.

I use Mission Control's Show Desktop to do this.

image

However – more often than not I use LaunchBar's Desktop index item to access it.

You might be able to do this by using AppleScript to get the current Finder "insertion location" after you clicked... The problem is that you'd be doing this for every mouse click in the Finder, which is a lot of extra work for your poor computer (never mind any unintended consequences).

Personally I access my Desktop in a list-view Finder window, which is easy to add to the Dock for speedy access. Though that probably says more about the mess on my Desktop than anything else!

I've tried all of those and none of them really hit the mark of what I'm trying to achieve. Couldn't get the AppleScript to work, and Mission Control's Show Desktop feature isn't what I'm after.

Bit stumped now - might have to try and find a third party app

Isn't that an option for you?

I'm not understanding, sorry

If what you want to do with clicking doesn't work and you don't want a shortcut, then you can try a gesture tigger.

Assuming you have a mouse (but it also works with the trackpad).

Choose your gesture. For example a horizontal movement (line) to the right, with the mouse. To not accidentally trigger the action it is advisable to press a mouse button at the same time.

Ah. I've found BetterTouchTool to be a much better answer to this problem than recording a horizontal mouse movement trigger.

BetterTouchTool doesn't give you the ability to click on an empty area of desktop either, so this is still unsolved. But you can map a gesture (for me, three finger swipe down) to hide all apps.

Dear @HopelesslyConfused the horizontal line was just an example. The line can also be vertical, which is exactly the same as what is called "swipe down" in BTT, with one finger instead of three. But of course, when it comes to gestures BTT is way ahead of KM, in every aspect.

This may be why the AppleScript suggestions weren't helping -- there's a big difference between your OP's "minimise", which applies to windows, and "hide all apps".

Of course, you may want to hide all open apps and minimise all Finder windows to get to your Desktop!

A discrete BTT gesture is still a better approach than triggering (usually pointlessly) a macro with every mouse-click you make, so you should stick with that if you can.

1 Like

This just reminds me that BTT can do a long press left click. So such a click could execute "hide all apps".

Yes, that works

image

image

@HopelesslyConfused And by the way, to show and hide all apps you only need one trigger (long left click) if you use a BTT cycle action.

Nice.

What does the "Allow mouse movement..." option do? Is that how BTT distinguishes between a long-press-in-place and a click-and-drag? Or will this capture all long-presses that exceed minimum hold?

eg. it allows to highlight text (or drag) when the function is not enabled. Then long press action is not executed, when you move the mouse.

1 Like