View Window Menu

Just found solution myself: Show Menu “Window” in the Front Application

Before I QUIT an app, almost any app, I view the Windows Menu to make sure that the front window is the only window open in that app. I would like to do this with a KM hotkey so I don't have to move my mouse over the to he Window menu. I've tried Select Menu By Name > Select Menu in Front Application > Default: Window. Unfortunately, this doesn't just drop down the Window menu, but lists lots of different options. I can't just click on a location from the upper left hand corner, because most apps have the Window menu in a different location. I can't click on the Apple menu and use the arrow keys to move to the Window menu because the number of right clicks would be different for each app. Again, all I was to do is click on the Window menu to drop it is I can see the bottom section to see if there is more than one window open. Any thoughts?

This should work: (just use a hotkey as your trigger)

Notice that I took a screenshot of the word Window and placed it into the image box. Your display may have different DPI than mine, or may use dark mode, so you will have to create this action yourself.

Some displays have unusually high or low resolution, so you may have to replace numbers 1000 and 30, but those numbers should work for most displays.

There may be other, better solutions. You could wait for those solutions, or you could try mine.

Thanks for the quick reply, but I already found a better solution and edited my initial question with the answer. Thee is an action called "Show Menu ____" that works perfectly for me.

Great. I didn't know that would work.

Sorry but I am not understanding the problem nor the solution. Please can you post an image of the SHOW MENU action you are using.

I've seen this happen a few times now: There's a very functional difference between these two Keyboard Maestro actions:

Select Menu by Name presents an onscreen Spotlight-like prompt that lets the user search for menus by typing a few letters and then picking from the narrowed results list. That's what @jonathonl tried using first.

But this action should be reserved for those times that require user interactivity; perhaps a macro that just makes it easier for a user to select a menu of their choosing in a given app. The action @jonathonl wound up using is this one:

Select or Show a Menu Item, which lets you code exactly which menu you want Keyboard Maestro to pick, and to actually do the picking:

That would make the frontmost app select and execute the Edit menu item on the File menu. Generally speaking, this is the action you want to use if you're trying to make Keyboard Maestro do something menu-ish in a macro. The other one should be used for those times when you need, for whatever reason, to be able to enter a menu item's name by hand during the macro's execution.

-rob.

Here is the problem: I want a hot key to drop down the Window menu in any app so I can see the bottom item(s) to tell which windows are open before I Quit the app. See below:
Window Menu

KM General Solution:

My Specific Solution:

Hope this helps clarify it.

Thank you both. Makes more sense now.

Mission Control would be another method for checking what windows an app has open. I'm on an older macOS but I assume things remain sufficiently the same. Here, Control–[down arrow] shows the open windows for the front-most app. If that shortcut isn't the default, System Preferences/Settings > Keyboard > Shortcuts > Mission Control > Application Windows will show the default.

I tried to make your nice idea work using KM, but the problem is that the original question was to make sure that "the front window is the only open window in that app" while Mission Control shows an array of windows (plus a vector of windows at the top) that are currently open. Sometimes those windows have the same name as the app (eg, if the window represents a full screen app) but usually the window does not have the app name under it over over it (when you mouse over it) just the window's title. Mission Control isn't really an app manager, it's a window manager. And even worse, it shows only open windows, not minimized ones. I think the original poster wanted to know all windows, including minimized ones.

There's no reliable way to correlate the windows shown in Mission Control with the name of the app that create them. There's no way to tell how many windows a given app has opened. Even if you move your mouse over the window, all you see is the name of the Window, not the name of the app that owns the window.

But I'm going to keep your idea in my toolkit. I may find a use for it in the future.

Back here on Mojave, what you've described for Mission Control is—apologies here, this is one of those times when Apple naming schemes can be confusing—Mission Control, not Mission Control > Application Windows. The concerns you outlined are not seen on my system, but things may have changed in newer versions of macOS.

In an attempt to ensure clarity, what you've described is the top enabled checkbox in the image below, and what I've described is the last enabled checkbox in the image.
image

Thanks. That does clarify things a lot. I wish I had understood you better, that's my fault. You are right, that option does a much better job of showing windows, rather than apps. And it does show minimized windows at the bottom of the screen, (which surprised me a lot) so it's easy to see both.

I'm confident that FindImage and OCR actions could be used here to solve the problem, using this method, but my first method also uses FindImage and OCR and it appears that the person has used my solution to get the problem solved.

An added perk of Mission Control > Application Windows is the ability to navigate and select from among the displayed windows. If there are any windows shown in Mission Control for the front-most app, using the arrow keys will let the user select them, and pressing Return/Enter brings the selected window to the front.

I can see how people would like this feature. My mindset is still in the last century in terms of window management. I might give this a try. I like the keyboard option, although sometimes the arrows don't seem to move to the window that I expect them to move to.

If there was an API for these Mission Control features, KM should use it. But I doubt that there is an API for it, simply because KM doesn't currently use it. I probably would have used Mission Control more often if KM was able to control it. In many respects, I consider KM to be my main interface to macOS. I avoid macOS features that KM doesn't support.

As well as @NaOH's suggestion of using Mission Control, if you simply want to briefly see a list of the front App's open windows, instead of opening the Windows Menu you could have Keyboard Maestro list the App's open windows in a notification.

And once you have the list of Open Windows in a Keyboard Maestro variable, you can expand the Macro to do other things with that list such as directly closing a specific Window. So, instead of displaying the list in a Notification, you could use it in a Keyboard Maestro Prompt with List or in a Keyboard Maestro Prompt for User Input.

Briefly Show Front Application's Open Windows.kmmacros (3.2 KB)

Depending on results, what do you do then? There does seem to be some redundancy here, like checking the menu just to see there's only one window listed so you could have quit anyway -- the type of thing KM can help you avoid!

So here's a little something that, on the normal ⌘Q, will quit the frontmost app if it has only one, unminimised, window and prompt for review otherwise. You can quit regardless of windows by triggering it with ⌥⌘Q

Quit or Review Windows.kmmacros (5.9 KB)

Image

3 Likes

Thanks. Clever,