Isolate Current Window (AKA Hide All Other Windows and Apps)

I want to do something that lets me drown out all the noise by isolating the one single window that I'm currently on, and hiding 1) all other windows from current app and 2) all other apps. The result being that all I have on my screen is one window and the desktop behind it.

I saw other posts (like this, this and this) and I'm gathering that it's just not possible. Especially because I don't want to minimise any windows (they stay minimised permanently until you manually click them back open), I just want to temporarily hide them.

However, I'm wondering if there are any hacky workarounds that any outer-box-thinkers could think of? For example, I've come to find out how powerful the Custom prompt with HTML text action is, with its ability to completely black-out the screen with an overlay html that covers all other windows, as an object that sits on a higher layer than the OS's windows.

Could that be used at all for what I'm trying to do? For example: pull up the HTML "black-out" to cover all windows, and THEN 'reveal' the last active window by pulling it forward to a top layer in front of the HTML??

I'm guessing not, due to this object being on a completely separate layer that can't be overlaid by OS's window management. But maybe the layering could be hacked somehow?? I know that Notifications live above this HTML object.

Or could the HTML object be sent BACK a layer, so that it appears underneath the front-most window?

Just throwing this out there!
:cricket_bat_and_ball:

There are several apps out there that do this but for me Comtion (Command+Option (⌘⌥)) + h is something that I use all the time for this.

I really like the app Session. It is quite customizable if you want focused sessions, and it is built around the Pomodoro technique.

VitiminR and hazeover.com are a couple others among many.

This two macros I've been using that works for me, to hide all and then show all. Maybe you'll find what you're looking for here.
Desktop Images Macros.kmmacros (15.3 KB)

Apple's Stage Manager might do this? I'm not sure though because each time I try to use it, I immediately hit some wall or other that's unviable for my workflow.

Barring that, though, if you use Keyboard Maestro's Application Switcher, you could tick the box to automatically hide other applications when switching. Although this doesn't handle multiple windows in the same application, but you could write macro to—bear with me here—automatically minimise all windows except the frontmost window...

I too heartily dislike being forced to use the mouse in cases where it really need not be necessary, which is why I made this macro to browse my open windows in Firefox where minimised windows are most abundant for me. Except for the first action, it's really app-agnostic and could be used generally...which has only just now in this moment occurred to me :sweat_smile:

Do you need to have the Desktop visible, or can you maximise the front window to cover all the others and avoid distraction.

As @skillet says, ⌥⌘H is the quick way to hide all apps except the frontmost -- and once you have at least one app hidden the "Show All" item should be enabled in every app's named menu.

If you do want to hide (rather than minimise) all the active app's windows bar the frontmost, this AppleScript should work in most apps:

tell application "System Events" to set frontApp to name of first application process whose frontmost is true

tell application frontApp
	using terms from application "Safari"
		set theList to rest of (get id of every window) --set visible of window id 2697 to true
		repeat with eachID in theList
			try
				set visible of window id eachID to false
			on error
				--do nothing
			end try
		end repeat
	end using terms from
end tell

And to restore them all, keeping the currently active window frontmost:

tell application "System Events" to set frontApp to name of first application process whose frontmost is true

tell application frontApp
	using terms from application "Safari"
		set frontWindow to id of window 1
		set visible of every window to true
		set index of window id frontWindow to 1
	end using terms from
end tell

Related to that and very fast here is a simple macro I have use sometimes hudreds of times a day for the past 10 years or so and one I converted from QuicKeys.

Finder - Activate Finder Hide Other Windows.kmmacros (24 KB)

Unfortunately, this doesn’t work reliably for all applications in all spaces on all screens, in my experience.

hey @skillet these are great reccos.
I'm trying Haze out, hooked it up into a KM macro (with a center-front-window) which activates / deactivates haze. I've set haze to 98% opacity and it's working pretty damn nicely!

screenshot

I would consider my needs solved! But it definitely didn't scratch the itch of wanting to create the macro myself without any 3rd party software. I gotta pick my battles though, and for this time round I'm gonna stick to using Haze.

Thanks!!

p.s. I would like to restore the window's original position when turning haze off, but can't find anything that says "retrieve current window coordinates / scale" that could be stored in 4 vars.

Interesting I don't use spaces much other than an occational fullscreen video. I really have given them a lot of attention over the years and experimented with all the differint changes since they interoduced it and with Command+Option+H and window mover shortcuts they never really seemed to help make things faster or cleaner for me so I wonder if there is an issue there. There use to be an option to show Finder in All Spaces but that has since gone the way of the Dodo Bird.

Glad you got at least mostly what you wanted. Always good to know when to throw in the towel and not an easy thing to do. I downloaded HazeOver since it is included with Setapp subscription.

Though another third party app I currently use Magnet for this. There are many windows management apps out there and I have likely tried them all. About 15 years ago there was nothing after 100+ hours of searhing and so I wrote my own.

You might be interested in these macros which can save a window position.

Though not directly what you are asking it might give you some ideas for restoring things.

Example(s) - Skillet Macros.kmmacros (49 KB)