Is there a way to identify a window, that has a hidden title bar?
I didn’t succeed with %WindowName"%, %WindowFrame% or %WindowPosition%.
Background: I have a touch screen attached and would like to trigger an action, when I have touched the screen / window. In order to have more space, I have hidden the title bar of the window on the touch screen.
When using CTRL+Cursor down, the window name is shown, eventhough the title bar is hidden. But Keyboard Maestro doesn’t seem to be able to read it anyway.
How? And is that a trick that you can only perform on the touch screen?
That keystroke is, by default, assigned by MacOS to using Mission Control (does Apple still call it that?) to show the windows for the front application.
I would guess that your question relates to functionality that is not standard but which is added by software for the touchscreen. If that is correct then all the relevant details about that setup will be needed.
No, it’s a REAPER (Digital Audio Workstation) lua script that is running on the touch screen, which has the ability to run without the title bar => There is an API to remove the frame.
What I meant to say with that: when using Mission Control, it shows all windows of an application. macOS still knows the title of the script and shows it underneath the window. The question was: why does KM not see it and is there a way around it?
Because macOS is privy to information that's not provided to outside developers. We can only see window titles via the Accessibility API, so if the title isn't provided there, then the window is invisible to other apps. Apple being Apple, though, they can see whatever they want to see.
This is only a guess, of course, as I'm not involved with Keyboard Maestro. But we write apps that rely on the Accessibility API to get things done, and a missing window title means we can't see those windows.
As a test, have your window display its title. Does your macro work then? If so, then this is almost assuredly a missing Accessibility API window title (which has to be provided by the app making the window).
Since I don't have Reaper, I went online to find an example, and I found an example, and I see the macOS system menu changes when a Reaper script is running. KM should be able to access those menu items to detect if a Reaper script is running. Perhaps one of those menu items contains the name of the script. You should check that out. Perhaps even show us a screen shot of the menus. I don't have Reaper, so I can't check what information those menus are showing.
Your original request said "is there a way", and yes, I can see a way to identify a window that doesn't have a title. You just perform an OCR action on the top 30 pixels of the window, which, from what I can see, always contains the word Reaper and the name of the file.
Right. I think then that as @griffman suggests, the question about the API that you mention is whether it is public (in which case we can expect Keyboard Maestro to be able to use it). Otherwise, I wonder if you might be able to either (a) edit the Lua script or (b) look at how the script is called, with the aim of toggling the title bar on temporarily so that the title can be got by KM. That is just a shot in the dark because I have not as yet got into Reaper that deeply.
By the way, I think that when you write that the Lua script is “running on the touch screen”, you simply mean that the touch screen happens to be the display that you are using to see the script’s window; the script is running on the Mac, rather than some extra computing resource offered by the touch screen. So I think that whether the script window appears on the touch screen or on another display is a red herring. If it is however an important factor that the window appears on the touch screen, please let us know why.
Yes, KM definitely sees the window title, when the title bar is enabled.
Right, that would tell me if the script itself is running. But I would like to create a trigger either based on the clicked window (the script window) or by display coordinates, that would also work.
Maybe I need to specify a little what I want to achieve:
what I’m planning to do is, check if a “click” on the touch screen has been executed. If that’s the case, refocus the REAPER main window afterwards.
The API is actually REAPER only, it’s basically an extension you can load.
Yes, you are right. The script itself runs on the mac but I moved it over to the touch screen that is attached to the mac.
Triggers are always a great solution, I agree with you, but sometimes there is no trigger for what we want to do, so we take advantage of KM's amazing additional abilities to poll for the events that we want. Just yesterday I posted a macro to this website that uses polling. I would have preferred a trigger, but KM doesn't have a trigger for everything, largely because macOS doesn't have events corresponding to all the things we want to do.
I don't have a touch screen, I didn't even know macOS supported touch screen windows, so I can't really test anything that you want to do.
Did you check if the "USB Device Key" trigger built into KM can detect your touch screen clicks? I can't test if that will work, but it might work, so you should try it.
Okay, so I tested this and unfortunately, KM doesn’t recognize it, when I tap on the touch screen.
I’m pretty certain that’s because I’m running UPDD (a touch screen driver) which obfuscates the input device. So, polling it is…
Yeah that’s what I did this morning!
They told me that their driver indeed blocks the HID currently. But they are investigating, if they can implement that, but no promises.