Is it possible to change window focus back Ableton's window?

tyler mazaika's icon

If you have a M4L device which shows a window [W] (float window or not), you can cause that window to gain focus by sending 'front' to a thispatcher object within window [W]. (Think "colored zoom dots in the titlebar")

If you send 'front' to a thispatcher object in your main M4L device patch, that will (amusingly) cause that patcher to open as a window, rather than bring focus to the Ableton window.

Is there any way to cause the main Ableton window to regain focus without clicking on it using the mouse? The various focus_view/show_view calls you can send to the "live_app view" api , but those don't magically steal focus from another window, so hopefully I'm ignorant of a neat trick :-)

Much obliged,
Tyler

Sapo's icon

up !

I'm also looking for a way to give back "focus" to the live app window after opening a floating window with "front".

Thanks !

11OLSEN's icon

Hi, yes it seems that we can't open a window without grabbing focus. I made an external once which can switch to the Live app and activate the main window. That can be modified to just switch the focus to the Live main window I think. Or maybe simply return focus to the window that had it before. I'll take a look

Sapo's icon

Thanks a lot 11olsen ! This external would be very nice !!

11OLSEN's icon
Sapo's icon

Great !! I'm going to try it ! Thanks !

Sapo's icon

Hi 11Olsen ! Thanks again it works very well !

But I got a problem I can't solve...
I would like to be able to navigate through tracks with mouse and arrows but each time I'm on a track with a max for live device containing "11live.front" the track is not highlighted anymore.
I tried to select the "selected track" with LOM but it seems it just selected, not highlight.

I think I can select the next track then back to previous one but I'm not sure of it... and it will make strange behavior...
I also found a workaround with "11clicks" but it implies I place the mouse on specific places, but it's not really convenient...

Do you have an idea for making this possible ?

Thanks for your help !

11OLSEN's icon

Not sure what you mean or want to achieve. The external in a device does nothing without sending an input message to it.

Sapo's icon

Hi thanks for replying !

The external in a device does nothing without sending an input message to it

For sure ! I'm not saying the external is not working fine :)

I made a little example to explain my problem better :

I'm looking for a way to get my track "highlighted" without an extra click (to make it work with arrows key)

In this example, I made an "auto open close" floating window.
Everything works fine (every track highlighted) since I select a parameter on my floating window. After selecting this parameter I can't navigate with the arrow keys anymore, it seems the floating window keeps in memory the selection of the parameter.

tyler mazaika's icon

@SAPO: I would wager you need to use LiveAPI to observe selected_track (and probably live_app view mode since this looks like an Arranger view specific window). When your device's track id gets selected you may need to retrigger the external (probably deferred) to return focus to the Live window.

@11OLSEN: Thank you so much for developing and sharing this external... it looks rad and I can't wait to try it out myself.

11OLSEN's icon

@SAPO is this a separate arranger window or the arranger view in main window ?

11OLSEN's icon

Never mind! I see it's the main window, arranger window has no info view. Should work. Best way is to share patcher or device so I/we can reproduce the situation.

Sapo's icon

Thanks to [deferlow] It finally worked with focus on arranger/session ! Thanks @Tyler Mazaika for the lead :)
Thanks @11olsen for your external, very helpful !!

tyler mazaika's icon

@11OLSEN: Your external is working well for me and has re-vitalized some development on a gadget ! (Using Live 11.0.2, macOS 11.2.3 fwiw). Thanks again.

If you can activate the window via the external, is it feasible to return its window bounds, too?

It also inspired a question about determining the front process, which I put in another forum post but I suspect given what your external already does it might be within reach: https://cycling74.com/forums/detect-when-ableton-is-the-currentfront-application-on-an-os

Cheers!

11OLSEN's icon

Hi Tyler. Yes I'm currently finishing the next thing to get the liveset name which is another information we can get from the main window by reading out the title. That window bounds thing seems possible, also knowing if Live is active. I even have something to identify any frontmost application but that's where Mac security kicks in and will request action from the user before it's useable.

Tarik Barri's icon

@11OLSEN, I would be extremely (and i do mean extremely!) interested in seeing your external, or in any info on which technique you used in your c++ code to achieve this. Unfortunately the link is broken though
EDIT - found it, https://www.11olsen.de/max-msp-externals/download/6-max-msp-externals/27-11live-tools

beautiful, thanks for making this