Thanks! I had to make a small change, though – setting the active layout immediately upon variables being loaded appears to be too soon. I got it working using this instead:
local layloFrame = CreateFrame("FRAME", "LayLo_frame")
layloFrame:RegisterEvent("PLAYER_LOGIN")
layloFrame:SetScript("OnEvent", function()
local layoutInfo = C_EditMode.GetLayouts()
if LocalLayoutDB and LocalLayoutDB.activeLayoutSaved and layoutInfo.activeLayout ~= LocalLayoutDB.activeLayoutSaved then
print("Switching active layout.")
C_EditMode.SetActiveLayout(LocalLayoutDB.activeLayoutSaved)
end
end)
hooksecurefunc(C_EditMode, "SetActiveLayout", function()
local layoutInfo = C_EditMode.GetLayouts()
LocalLayoutDB = { activeLayoutSaved = layoutInfo.activeLayout }
end)
Also, for anyone interested, if you change “SavedVariablesPerCharacter” in toc to just “SavedVariables”, this lets you change your layout across all characters at once! Enjoy!