Set Focus to Disk Browser, or to Pattern Editor Globally?

Hi, is there some method of setting cursor focus / selection focus to Disk Browser, or to the Pattern Editor? I’m basically trying to set midi buttons so that if I press one button, I will be brought directly to keyboard focus in Disk Browser, I press another button, I’m immediately keyboard focus in Pattern Editor.

Crucial detail: Will these focuses work with non-bridged plugins that steal keyboard access? Can I somehow escape keyboard-stuck-in-plugin?

I’ve tried to do this:

renoise.tool():add_keybinding {name="Global:Track Devices:Load OhmForce OhmBoyz", invoke = function() loadvst("Audio/Effects/AU/aumf:OByZ:OmFo")
renoise.app().window.lock_keyboard_focus=true
renoise.app().window.active_middle_frame=renoise.ApplicationWindow.MIDDLE_FRAME_PATTERN_EDITOR

 end}

but does not seem to help. Maybe I should lock the keyboard focus twice, once before loadvst, and once after loadvst?

So far the only solution for switching Keyboard Focus to Disk Browser I’ve come across is saving a Screenset with Disk Browser focused.

But then I don’t know how to query which Screenset we’re in, so I could press the shortcut again to go from DiskBrowser_focus to PatternEditor_focus.

so the only thing i can come up with is this

renoise.tool():add_keybinding{name="Global:Paketti:Disk Browser Focus",invoke=function()
renoise.app().window:select_preset(8) end}

and set the 8th preset to always have disk browser focus.

what i don’t know is how to return from that, to pattern editor, and back. so “if disk browser focus = yes then pattern editor focus yes, else disk browser focus = yes”.

it’s like there’s no way of telling where the focus is.

There are a few app properties in the API – here is one example:

//     -- Frame with the pattern editor, mixer...
//     renoise.app().window.active_middle_frame, _observable
//       -> [enum = MIDDLE_FRAME]

That enum looks like:

export enum MIDDLE_FRAME {
        MIDDLE_FRAME_PATTERN_EDITOR,
        MIDDLE_FRAME_MIXER,
        MIDDLE_FRAME_INSTRUMENT_PHRASE_EDITOR,
        MIDDLE_FRAME_INSTRUMENT_SAMPLE_KEYZONES,
        MIDDLE_FRAME_INSTRUMENT_SAMPLE_EDITOR,
        MIDDLE_FRAME_INSTRUMENT_SAMPLE_MODULATION,
        MIDDLE_FRAME_INSTRUMENT_SAMPLE_EFFECTS,
        MIDDLE_FRAME_INSTRUMENT_PLUGIN_EDITOR,
        MIDDLE_FRAME_INSTRUMENT_MIDI_EDITOR,
    }

There are some other properties with other enums. Hope it helps.