-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtoggle_focus_mixer.lua
More file actions
33 lines (29 loc) · 1.04 KB
/
toggle_focus_mixer.lua
File metadata and controls
33 lines (29 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
function Msg(param)
if false then
reaper.ShowConsoleMsg(tostring(param) .. "\n")
end
end
function IsMixerFocused()
local mixer_handle, docked = reaper.BR_Win32_GetMixerHwnd()
if mixer_handle then
if mixer_handle == reaper.BR_Win32_GetForegroundWindow() then
Msg("Mixer is in foreground")
return true -- Mixer window has focus (not docked)
elseif reaper.BR_Win32_GetParent(reaper.BR_Win32_GetFocus()) == mixer_handle then
Msg("Focused is child of mixer")
return true -- focused window is child of docked Mixer
else
-- reaper.JS_Window_SetFocus(mixer_handle)
reaper.BR_Win32_SetFocus(mixer_handle)
return false
end
else
reaper.Main_OnCommand(40078, 0) -- mixer not visible
return false
end
-- reaper.BR_Win32_GetWindowRect
-- reaper.BR_Win32_SetWindowPos(mixer_handle, 0,0,0,0,0, )
end
if IsMixerFocused() then
reaper.Main_OnCommand(40078, 0) -- show mixer
end